Class: Ika3::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
# File 'lib/ika3/response.rb', line 5

def initialize(faraday_response)
  @raw_body    = faraday_response.body
  @raw_headers = faraday_response.headers
  @raw_status  = faraday_response.status
end

Instance Method Details

#bodyObject



11
12
13
# File 'lib/ika3/response.rb', line 11

def body
  @raw_body
end

#headersObject



15
16
17
18
19
# File 'lib/ika3/response.rb', line 15

def headers
  @headers ||= @raw_headers.inject({}) do |result, (key, value)|
    result.merge(key.split('-').map(&:capitalize).join('-') => value)
  end
end

#statusObject



21
22
23
# File 'lib/ika3/response.rb', line 21

def status
  @raw_status
end