Class: Ika3::Response
- Inherits:
-
Object
- Object
- Ika3::Response
- Defined in:
- lib/ika3/response.rb
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
- #status ⇒ Object
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
#body ⇒ Object
11 12 13 |
# File 'lib/ika3/response.rb', line 11 def body @raw_body end |
#headers ⇒ Object
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 |
#status ⇒ Object
21 22 23 |
# File 'lib/ika3/response.rb', line 21 def status @raw_status end |