Class: Paygate::Response
- Inherits:
-
Object
- Object
- Paygate::Response
- Defined in:
- lib/paygate/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#http_code ⇒ Object
Returns the value of attribute http_code.
-
#json ⇒ Object
Returns the value of attribute json.
-
#message ⇒ Object
Returns the value of attribute message.
-
#raw_info ⇒ Object
Returns the value of attribute raw_info.
-
#transaction_type ⇒ Object
Returns the value of attribute transaction_type.
Class Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/paygate/response.rb', line 5 def body @body end |
#http_code ⇒ Object
Returns the value of attribute http_code.
5 6 7 |
# File 'lib/paygate/response.rb', line 5 def http_code @http_code end |
#json ⇒ Object
Returns the value of attribute json.
5 6 7 |
# File 'lib/paygate/response.rb', line 5 def json @json end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/paygate/response.rb', line 5 def @message end |
#raw_info ⇒ Object
Returns the value of attribute raw_info.
5 6 7 |
# File 'lib/paygate/response.rb', line 5 def raw_info @raw_info end |
#transaction_type ⇒ Object
Returns the value of attribute transaction_type.
5 6 7 |
# File 'lib/paygate/response.rb', line 5 def transaction_type @transaction_type end |
Class Method Details
.build_from_net_http_response(txn_type, response) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/paygate/response.rb', line 7 def self.build_from_net_http_response(txn_type, response) r = new r.transaction_type = txn_type r.http_code = response.code r. = response. r.body = response.body case txn_type when :refund r.json = JSON.parse response.body.gsub(/^callback\((.*)\)$/, '\1') if response.code.to_i == 200 when :profile_pay r.json = {} response.body.split('&').each do |key_value_pair| key_value_ary = key_value_pair.split('=') r.json[key_value_ary[0]] = key_value_ary[1] end end r end |