Class: Esa::Response
- Inherits:
-
Object
- Object
- Esa::Response
- Defined in:
- lib/esa/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.
3 4 5 6 7 |
# File 'lib/esa/response.rb', line 3 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
9 10 11 |
# File 'lib/esa/response.rb', line 9 def body @raw_body end |
#headers ⇒ Object
13 14 15 16 17 |
# File 'lib/esa/response.rb', line 13 def headers @headers ||= @raw_headers.inject({}) do |result, (key, value)| result.merge(key.split("-").map(&:capitalize).join("-") => value) end end |
#status ⇒ Object
19 20 21 |
# File 'lib/esa/response.rb', line 19 def status @raw_status end |