Class: Tolq::Api::Response
- Inherits:
-
Object
- Object
- Tolq::Api::Response
- Defined in:
- lib/tolq-api/response.rb
Overview
Wraps the responses of the Tolq Api
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(status:, body:) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(status:, body:) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 |
# File 'lib/tolq-api/response.rb', line 7 def initialize(status:, body:) raise ArgumentError.new('Expected body to be a string') unless !body || body.is_a?(String) @status = status.to_i @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/tolq-api/response.rb', line 5 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/tolq-api/response.rb', line 5 def status @status end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# File 'lib/tolq-api/response.rb', line 14 def ==(other) self.status == other.status && self.body == other.body end |