Class: Totter::Transport::HTTP::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/totter/transport/http.rb

Overview

Response class responsible for deserializing API calls

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response, result_format = :mashie) ⇒ Response

Initializes a new result

Parameters:

  • http_response (Net::HTTPResponse)

    the raw response to parse



131
132
133
134
135
# File 'lib/totter/transport/http.rb', line 131

def initialize(http_response, result_format = :mashie)
  @result_format = result_format
  @headers = parse_headers(http_response.to_hash)
  @body = parse_body(http_response.body)
end

Instance Attribute Details

#bodyObject

The parsed response

Returns:

  • (Object)

    the current value of body



125
126
127
# File 'lib/totter/transport/http.rb', line 125

def body
  @body
end

#headersHash

HTTP headers returned as part of the response

Returns:

  • (Hash)

    the current value of headers



125
126
127
# File 'lib/totter/transport/http.rb', line 125

def headers
  @headers
end