Class: Asana::HttpClient::Response Private
- Inherits:
-
Object
- Object
- Asana::HttpClient::Response
- Defined in:
- lib/asana/http_client/response.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a response from the Asana API.
Instance Attribute Summary collapse
-
#body ⇒ Hash
readonly
Returns the Hash representing the parsed JSON body.
-
#faraday_env ⇒ Faraday::Env
readonly
Returns a Faraday::Env object for debugging.
-
#headers ⇒ Hash
readonly
Returns the Hash of attribute headers.
-
#status ⇒ Integer
readonly
Returns the Integer status code of the response.
Instance Method Summary collapse
-
#initialize(faraday_response) ⇒ Response
constructor
Wraps a Faraday response.
-
#to_s ⇒ String
(also: #inspect)
Returns a String representation of the response.
Constructor Details
#initialize(faraday_response) ⇒ Response
Wraps a Faraday response.
23 24 25 26 27 28 |
# File 'lib/asana/http_client/response.rb', line 23 def initialize(faraday_response) @faraday_env = faraday_response.env @status = faraday_env.status @body = faraday_env.body @headers = faraday_response.headers end |
Instance Attribute Details
#body ⇒ Hash (readonly)
Returns the Hash representing the parsed JSON body.
15 16 17 |
# File 'lib/asana/http_client/response.rb', line 15 def body @body end |
#faraday_env ⇒ Faraday::Env (readonly)
Returns a Faraday::Env object for debugging.
9 10 11 |
# File 'lib/asana/http_client/response.rb', line 9 def faraday_env @faraday_env end |
#headers ⇒ Hash (readonly)
Returns the Hash of attribute headers.
18 19 20 |
# File 'lib/asana/http_client/response.rb', line 18 def headers @headers end |
#status ⇒ Integer (readonly)
Returns the Integer status code of the response.
12 13 14 |
# File 'lib/asana/http_client/response.rb', line 12 def status @status end |
Instance Method Details
#to_s ⇒ String Also known as: inspect
Returns a String representation of the response.
32 33 34 |
# File 'lib/asana/http_client/response.rb', line 32 def to_s "#<Asana::HttpClient::Response status=#{@status} body=#{@body}>" end |