Sha256: cd9917112c91eea59e7012c25bbb6f5c7107c612aa2fd598d76f84a0fc197f77

Contents?: true

Size: 1.02 KB

Versions: 27

Compression:

Stored size: 1.02 KB

Contents

# bandwidth
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).

module Bandwidth
  # Http response received.
  class ApiResponse
    attr_reader(:status_code, :reason_phrase, :headers, :raw_body, :request,
                :data, :errors)

    # The constructor
    # @param [HttpResponse] The original, raw response from the api.
    # @param [Object] The data field specified for the response.
    # @param [Array<String>] Any errors returned by the server.
    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

    def success?
      status_code >= 200 && status_code < 300
    end

    def error?
      status_code >= 400 && status_code < 600
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
bandwidth-sdk-3.13.2 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.13.1 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.13.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.12.1 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.12.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.11.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.10.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.9.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.8.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.7.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.6.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.5.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.4.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.3.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.2.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.1.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-3.0.0 lib/bandwidth/http/api_response.rb
bandwidth-sdk-2.2.2 lib/bandwidth/http/api_response.rb
bandwidth-sdk-2.2.1 lib/bandwidth/http/api_response.rb
bandwidth-sdk-2.2.0 lib/bandwidth/http/api_response.rb