Class: SageWorld::ResponseHandler
- Inherits:
-
Object
- Object
- SageWorld::ResponseHandler
- Includes:
- Api::FindHelper
- Defined in:
- lib/sage_world/response_handler.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(response) ⇒ ResponseHandler
constructor
A new instance of ResponseHandler.
- #method_missing(method_name) ⇒ Object
Methods included from Api::FindHelper
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
#response ⇒ Object (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
#body ⇒ Object
13 14 15 |
# File 'lib/sage_world/response_handler.rb', line 13 def body @response.body.with_indifferent_access end |