Class: TreezorConnect::TreezorResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/treezor_connect/treezor_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/treezor_connect/treezor_response.rb', line 5

def data
  @data
end

#http_bodyObject

Returns the value of attribute http_body.



5
6
7
# File 'lib/treezor_connect/treezor_response.rb', line 5

def http_body
  @http_body
end

#http_headersObject

Returns the value of attribute http_headers.



5
6
7
# File 'lib/treezor_connect/treezor_response.rb', line 5

def http_headers
  @http_headers
end

#http_statusObject

Returns the value of attribute http_status.



5
6
7
# File 'lib/treezor_connect/treezor_response.rb', line 5

def http_status
  @http_status
end

Class Method Details

.from_http_response(http_resp) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/treezor_connect/treezor_response.rb', line 7

def self.from_http_response(http_resp)
  resp = TreezorResponse.new
  resp.data = JSON.parse(http_resp.body) if http_resp.body.to_s != ''
  resp.http_body = http_resp.body
  resp.http_headers = http_resp.headers
  resp.http_status = http_resp.status
  resp
end