Class: SageWorld::ResponseHandler

Inherits:
Object
  • Object
show all
Includes:
Api::FindHelper
Defined in:
lib/sage_world/response_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Api::FindHelper

included

Constructor Details

#initialize(response) ⇒ ResponseHandler

Returns a new instance of ResponseHandler.



8
9
10
11
# File 'lib/sage_world/response_handler.rb', line 8

def initialize(response)
  validate_response(response)
  @response = response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



17
18
19
20
# File 'lib/sage_world/response_handler.rb', line 17

def method_missing(method_name)
  key_name = method_name.to_s.camelize
  find_in_hash(key_name)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/sage_world/response_handler.rb', line 6

def response
  @response
end

Instance Method Details

#bodyObject



13
14
15
# File 'lib/sage_world/response_handler.rb', line 13

def body
  @response.body.with_indifferent_access
end