Class: ResponseHandler
- Inherits:
-
Object
- Object
- ResponseHandler
- Defined in:
- lib/response_handler.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ ResponseHandler
constructor
A new instance of ResponseHandler.
- #parse! ⇒ Object
Constructor Details
#initialize(response) ⇒ ResponseHandler
Returns a new instance of ResponseHandler.
3 4 5 6 |
# File 'lib/response_handler.rb', line 3 def initialize(response) @response = response @payload = OpenStruct.new end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
8 9 10 |
# File 'lib/response_handler.rb', line 8 def payload @payload end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/response_handler.rb', line 8 def response @response end |
Instance Method Details
#parse! ⇒ Object
10 11 12 13 |
# File 'lib/response_handler.rb', line 10 def parse! parse_data success? ? handle_success : handle_error end |