Class: SnapAPIClient::Response

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

Overview

Response

Wrapper for an HTTP response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



12
13
14
# File 'lib/snap_api_client/response.rb', line 12

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



10
11
12
# File 'lib/snap_api_client/response.rb', line 10

def response
  @response
end

Instance Method Details

#body_jsonObject



20
21
22
# File 'lib/snap_api_client/response.rb', line 20

def body_json
  JSON.parse(response.body)
end

#codeObject



16
17
18
# File 'lib/snap_api_client/response.rb', line 16

def code
  response.status.code
end