Method: Bandwidth::ApiResponse#initialize

Defined in:
lib/bandwidth/http/api_response.rb

#initialize(http_response, data: nil, errors: nil) ⇒ ApiResponse

The constructor

Parameters:

  • The (HttpResponse)

    original, raw response from the api.

  • The (Object)

    data field specified for the response.

  • Any (Array<String>)

    errors returned by the server.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bandwidth/http/api_response.rb', line 16

def initialize(http_response,
               data: nil,
               errors: nil)
  @status_code = http_response.status_code
  @reason_phrase = http_response.reason_phrase
  @headers = http_response.headers
  @raw_body = http_response.raw_body
  @request = http_response.request
  @data = data
  @errors = errors
end