Class: PayPro::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/pay_pro/response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/pay_pro/response.rb', line 5

def data
  @data
end

#raw_bodyObject

Returns the value of attribute raw_body.



5
6
7
# File 'lib/pay_pro/response.rb', line 5

def raw_body
  @raw_body
end

#request_idObject

Returns the value of attribute request_id.



5
6
7
# File 'lib/pay_pro/response.rb', line 5

def request_id
  @request_id
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/pay_pro/response.rb', line 5

def status
  @status
end

Class Method Details

.from_response(response_object) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/pay_pro/response.rb', line 10

def self.from_response(response_object)
  response = new

  response.data = JSON.parse(response_object.body)
  response.raw_body = response_object.body
  response.status = response_object.status
  response.request_id = response_object.headers['x-request-id']

  response
end