Class: SirenClient::RawResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/siren_client/raw_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_res) ⇒ RawResponse

Returns a new instance of RawResponse.



5
6
7
8
9
10
# File 'lib/siren_client/raw_response.rb', line 5

def initialize(http_res)
    unless http_res.class == HTTParty::Response
      raise InvalidResponseError, "SirenClient::RawResponse expects a HTTParty::Response instance."
    end
    @response = http_res
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/siren_client/raw_response.rb', line 3

def response
  @response
end

Instance Method Details

#bodyObject



16
17
18
# File 'lib/siren_client/raw_response.rb', line 16

def body
  @response.body
end

#codeObject



20
21
22
# File 'lib/siren_client/raw_response.rb', line 20

def code
  @response.code
end

#headersObject



28
29
30
# File 'lib/siren_client/raw_response.rb', line 28

def headers
  @response.headers
end

#messageObject



24
25
26
# File 'lib/siren_client/raw_response.rb', line 24

def message
  @response.message.strip
end

#parsed_responseObject



12
13
14
# File 'lib/siren_client/raw_response.rb', line 12

def parsed_response
  @response.parsed_response
end