class Aviator::Response

Attributes

request[R]

Public Class Methods

new(response, request) click to toggle source
# File lib/aviator/core/response.rb, line 10
def initialize(response, request)
  @response = response
  @request  = request
end

Public Instance Methods

body() click to toggle source
# File lib/aviator/core/response.rb, line 16
def body
  @body ||= if raw_body.length > 0
    if Aviator::Compatibility::RUBY_1_8_MODE
      clean_body = raw_body.gsub(/\ /, ' ')
    else
      clean_body = raw_body
    end

    Hashish.new(JSON.parse(clean_body))
  else
    Hashish.new({})
  end
end
headers() click to toggle source
# File lib/aviator/core/response.rb, line 31
def headers
  @headers ||= Hashish.new(@response.headers)
end
to_hash() click to toggle source
# File lib/aviator/core/response.rb, line 36
def to_hash
  Hashish.new({
    :status  => status,
    :headers => headers,
    :body    => body
  })
end