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.
21 22 23 24 25 26 |
# File 'lib/asana/http_client/response.rb', line 21 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.
13 14 15 |
# File 'lib/asana/http_client/response.rb', line 13 def body @body end |
#faraday_env ⇒ Faraday::Env (readonly)
Returns a Faraday::Env object for debugging.
7 8 9 |
# File 'lib/asana/http_client/response.rb', line 7 def faraday_env @faraday_env end |
#headers ⇒ Hash (readonly)
Returns the Hash of attribute headers.
16 17 18 |
# File 'lib/asana/http_client/response.rb', line 16 def headers @headers end |
#status ⇒ Integer (readonly)
Returns the Integer status code of the response.
10 11 12 |
# File 'lib/asana/http_client/response.rb', line 10 def status @status end |
Instance Method Details
#to_s ⇒ String Also known as: inspect
Returns a String representation of the response.
30 31 32 |
# File 'lib/asana/http_client/response.rb', line 30 def to_s "#<Asana::HttpClient::Response status=#{@status} body=#{@body}>" end |