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.



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

#bodyHash (readonly)

Returns the Hash representing the parsed JSON body.

Returns:

  • (Hash)

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

Returns a Faraday::Env object for debugging.

Returns:

  • (Faraday::Env)

    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

#headersHash (readonly)

Returns the Hash of attribute headers.

Returns:

  • (Hash)

    Returns the Hash of attribute headers.



16
17
18
# File 'lib/asana/http_client/response.rb', line 16

def headers
  @headers
end

#statusInteger (readonly)

Returns the Integer status code of the response.

Returns:

  • (Integer)

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

Returns a String representation of the response.

Returns:

  • (String)

    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