Class: XingApi::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, headers) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/xing_api/response.rb', line 7

def initialize(body, headers)
  @headers = headers

  body =
    begin
      JSON.parse(body, symbolize_names: true)
    rescue JSON::ParserError
      {}
    end

  super(body)
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end