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.



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

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



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

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.



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

def response
  @response
end

Instance Method Details

#bodyObject



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

def body
  @response.body.with_indifferent_access
end