Class: Makeleaps::Response::Wrapper

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/makeleaps/response/wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ Wrapper

Returns a new instance of Wrapper.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/makeleaps/response/wrapper.rb', line 14

def initialize(raw_response)
  @status = raw_response.status
begin
  @body = JSON.parse(raw_response.body)
rescue JSON::JSONError
  # TODO: to raise an original error?
  @body = {}
end
  @meta_information = MetaInformation.new @body['meta']
  @resource         = Resource.new @body['response']
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



10
11
12
# File 'lib/makeleaps/response/wrapper.rb', line 10

def body
  @body
end

#meta_informationObject (readonly)

Returns the value of attribute meta_information.



10
11
12
# File 'lib/makeleaps/response/wrapper.rb', line 10

def meta_information
  @meta_information
end

#resourceObject (readonly)

Returns the value of attribute resource.



10
11
12
# File 'lib/makeleaps/response/wrapper.rb', line 10

def resource
  @resource
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/makeleaps/response/wrapper.rb', line 10

def status
  @status
end