Class: ConoStorage::Response
- Inherits:
-
Object
- Object
- ConoStorage::Response
- Defined in:
- lib/cono_storage/response.rb
Instance Attribute Summary collapse
-
#faraday_response ⇒ Object
Returns the value of attribute faraday_response.
Instance Method Summary collapse
-
#body ⇒ Hash, ...
Conostorage::Response#body.
-
#headers ⇒ Hash
Conostorage::Response#headers.
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
-
#status ⇒ Fixnum
Conostorage::Response#status.
-
#url ⇒ String
Conostorage::Response#url.
Constructor Details
#initialize(faraday_response) ⇒ Response
5 6 7 8 9 10 11 |
# File 'lib/cono_storage/response.rb', line 5 def initialize(faraday_response) @body = faraday_response.body @headers = faraday_response.headers @status = faraday_response.status @url = faraday_response.env[:url].to_s @faraday_response = faraday_response end |
Instance Attribute Details
#faraday_response ⇒ Object
Returns the value of attribute faraday_response.
3 4 5 |
# File 'lib/cono_storage/response.rb', line 3 def faraday_response @faraday_response end |
Instance Method Details
#body ⇒ Hash, ...
Conostorage::Response#body
27 28 29 30 31 32 33 34 35 |
# File 'lib/cono_storage/response.rb', line 27 def body if @body and @body.size > 0 JSON.parse(@body) else @body end rescue JSON::ParserError @body end |
#headers ⇒ Hash
Conostorage::Response#headers
41 42 43 |
# File 'lib/cono_storage/response.rb', line 41 def headers @headers end |
#status ⇒ Fixnum
Conostorage::Response#status
17 18 19 |
# File 'lib/cono_storage/response.rb', line 17 def status @status end |
#url ⇒ String
Conostorage::Response#url
49 50 51 |
# File 'lib/cono_storage/response.rb', line 49 def url @url end |