Class: APICake::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/apicake/payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Payload

Returns a new instance of Payload.



5
6
7
8
9
10
# File 'lib/apicake/payload.rb', line 5

def initialize(response)
  @request         = response.request
  @headers         = response.headers
  @response        = response.response
  @parsed_response = response.parsed_response
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



3
4
5
# File 'lib/apicake/payload.rb', line 3

def headers
  @headers
end

#parsed_responseObject (readonly)

Returns the value of attribute parsed_response.



3
4
5
# File 'lib/apicake/payload.rb', line 3

def parsed_response
  @parsed_response
end

#requestObject (readonly)

Returns the value of attribute request.



3
4
5
# File 'lib/apicake/payload.rb', line 3

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/apicake/payload.rb', line 3

def response
  @response
end

Instance Method Details

#to_hObject



12
13
14
15
# File 'lib/apicake/payload.rb', line 12

def to_h
  { request: request, response: response, headers: headers, 
    parsed_response: parsed_response }
end

#to_sObject



17
18
19
# File 'lib/apicake/payload.rb', line 17

def to_s
  parsed_response.to_s
end