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.
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
#response ⇒ Object (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
#body ⇒ Object
12 13 14 |
# File 'lib/sage_world/response_handler.rb', line 12 def body @response.body.with_indifferent_access end |