Sha256: b2d7e4dbc8a5094b885f712570128e4ef5ee4694c270f84bf4daaf76b46cee4c

Contents?: true

Size: 695 Bytes

Versions: 23

Compression:

Stored size: 695 Bytes

Contents

module MyJohnDeere
  class Response
    attr_accessor :request_id
    attr_accessor :http_body
    attr_accessor :http_headers
    attr_accessor :http_status
    attr_accessor :data
    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

    def code
      return http_status
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
myjohndeere-0.1.11 lib/myjohndeere/response.rb
myjohndeere-0.1.10 lib/myjohndeere/response.rb
myjohndeere-0.1.9 lib/myjohndeere/response.rb
myjohndeere-0.1.8 lib/myjohndeere/response.rb
myjohndeere-0.1.7 lib/myjohndeere/response.rb
myjohndeere-0.1.6 lib/myjohndeere/response.rb
myjohndeere-0.1.5 lib/myjohndeere/response.rb
myjohndeere-0.1.4 lib/myjohndeere/response.rb
myjohndeere-0.1.3 lib/myjohndeere/response.rb
myjohndeere-0.1.2 lib/myjohndeere/response.rb
myjohndeere-0.1.1 lib/myjohndeere/response.rb
myjohndeere-0.1.0 lib/myjohndeere/response.rb
myjohndeere-0.0.11 lib/myjohndeere/response.rb
myjohndeere-0.0.10 lib/myjohndeere/response.rb
myjohndeere-0.0.9 lib/myjohndeere/response.rb
myjohndeere-0.0.8 lib/myjohndeere/response.rb
myjohndeere-0.0.7 lib/myjohndeere/response.rb
myjohndeere-0.0.6 lib/myjohndeere/response.rb
myjohndeere-0.0.5 lib/myjohndeere/response.rb
myjohndeere-0.0.4 lib/myjohndeere/response.rb