Class: NOMIS::API::ParsedResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/nomis/api/parsed_response.rb

Overview

decorates a Net::HTTP response with a data method, which parses the JSON in the response body

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ ParsedResponse

Returns a new instance of ParsedResponse.



10
11
12
13
# File 'lib/nomis/api/parsed_response.rb', line 10

def initialize(raw_response)
  self.raw_response = raw_response
  self.data = JSON.parse(raw_response.body)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



8
9
10
# File 'lib/nomis/api/parsed_response.rb', line 8

def body
  @body
end

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/nomis/api/parsed_response.rb', line 8

def data
  @data
end

#raw_responseObject

Returns the value of attribute raw_response.



8
9
10
# File 'lib/nomis/api/parsed_response.rb', line 8

def raw_response
  @raw_response
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/nomis/api/parsed_response.rb', line 8

def status
  @status
end