class MyJohnDeere::Response

Attributes

data[RW]
http_body[RW]
http_headers[RW]
http_status[RW]
request_id[RW]

Public Class Methods

new(response) click to toggle source
# File lib/myjohndeere/response.rb, line 8
def initialize(response)
  self.http_headers = {}
  response.each_capitalized_name do |n|
    self.http_headers[n] = response[n]
  end
  
  self.http_body = response.body
  if response.body then
    begin
      self.data = JSON.parse(response.body)
    rescue JSON::ParserError
      self.data = nil
    end
  else
    self.data = nil
  end
  self.http_status = response.code.to_i
end

Public Instance Methods

code() click to toggle source
# File lib/myjohndeere/response.rb, line 27
def code
  return http_status
end