class DBots::API::Response

The nested response from rest-client

Attributes

body[R]

@return [String] the HTTP response body.

code[R]

@return [Integer] HTTP status code.

cookies[R]

@return [Hash] cookie jar extracted from response headers.

headers[R]

@return [Hash] a hash of the headers, beautified with symbols and underscores.

json[R]

@return [Hash, nil] the parsed JSON of the response

raw[R]

@return [RestClient::Response] the raw response given from rest-client

status[R]

@return [Integer] HTTP status code.

Public Class Methods

new(response, json = nil) click to toggle source

@!visibility private

# File lib/dbots/api.rb, line 65
def initialize(response, json = nil)
  @raw = response
  @code = response.code
  @headers = response.headers
  @cookies = response.cookies
  @json = json
end

Public Instance Methods

inspect() click to toggle source

@!visibility private

# File lib/dbots/api.rb, line 74
def inspect
  "<DBots::API::Response #{@code} #{@raw.body_truncated(10).inspect}>"
end