Class: Files::Response
- Inherits:
-
Object
- Object
- Files::Response
- Defined in:
- lib/files.com/response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#http_body ⇒ Object
Returns the value of attribute http_body.
-
#http_headers ⇒ Object
Returns the value of attribute http_headers.
-
#http_status ⇒ Object
Returns the value of attribute http_status.
Class Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/files.com/response.rb', line 5 def data @data end |
#http_body ⇒ Object
Returns the value of attribute http_body.
5 6 7 |
# File 'lib/files.com/response.rb', line 5 def http_body @http_body end |
#http_headers ⇒ Object
Returns the value of attribute http_headers.
5 6 7 |
# File 'lib/files.com/response.rb', line 5 def http_headers @http_headers end |
#http_status ⇒ Object
Returns the value of attribute http_status.
5 6 7 |
# File 'lib/files.com/response.rb', line 5 def http_status @http_status end |
Class Method Details
.from_faraday_hash(http_resp) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/files.com/response.rb', line 7 def self.from_faraday_hash(http_resp) resp = new resp.data = JSON.parse(http_resp[:body], symbolize_names: true) if http_resp[:status] != 204 resp.http_body = http_resp[:body] resp.http_headers = http_resp[:headers] resp.http_status = http_resp[:status] resp end |
.from_faraday_response(http_resp) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/files.com/response.rb', line 16 def self.from_faraday_response(http_resp) resp = new resp.data = JSON.parse(http_resp.body, symbolize_names: true) if http_resp.status != 204 resp.http_body = http_resp.body resp.http_headers = http_resp.headers resp.http_status = http_resp.status resp end |