Class: Asana::HttpClient::Response Private

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response) ⇒ Response

Wraps a Faraday response.

Parameters:

  • faraday_response (Faraday::Response)

    the Faraday response to wrap.



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

#bodyHash (readonly)

Returns the Hash representing the parsed JSON body.

Returns:

  • (Hash)

    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_envFaraday::Env (readonly)

Returns a Faraday::Env object for debugging.

Returns:

  • (Faraday::Env)

    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

#headersHash (readonly)

Returns the Hash of attribute headers.

Returns:

  • (Hash)

    Returns the Hash of attribute headers.



18
19
20
# File 'lib/asana/http_client/response.rb', line 18

def headers
  @headers
end

#statusInteger (readonly)

Returns the Integer status code of the response.

Returns:

  • (Integer)

    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_sString Also known as: inspect

Returns a String representation of the response.

Returns:

  • (String)

    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