Class: Ampsy::Response
- Inherits:
-
Object
- Object
- Ampsy::Response
- Defined in:
- lib/ampsy/response.rb
Instance Method Summary collapse
- #data ⇒ Object
- #error? ⇒ Boolean
- #error_message ⇒ Object
-
#initialize(response, success_status) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response, success_status) ⇒ Response
Returns a new instance of Response.
3 4 5 6 |
# File 'lib/ampsy/response.rb', line 3 def initialize(response, success_status) @response = response @success_status = success_status end |
Instance Method Details
#data ⇒ Object
20 21 22 |
# File 'lib/ampsy/response.rb', line 20 def data @response.parsed_response end |
#error? ⇒ Boolean
12 13 14 |
# File 'lib/ampsy/response.rb', line 12 def error? !success? end |
#error_message ⇒ Object
16 17 18 |
# File 'lib/ampsy/response.rb', line 16 def data['error'] end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/ampsy/response.rb', line 8 def success? @response.code == @success_status end |