Class: Stuart::Infrastructure::ApiResponse
- Inherits:
-
Object
- Object
- Stuart::Infrastructure::ApiResponse
- Defined in:
- lib/stuart/infrastructure/api_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status_code, body) ⇒ ApiResponse
constructor
A new instance of ApiResponse.
- #success? ⇒ Boolean
Constructor Details
#initialize(status_code, body) ⇒ ApiResponse
Returns a new instance of ApiResponse.
6 7 8 9 |
# File 'lib/stuart/infrastructure/api_response.rb', line 6 def initialize(status_code, body) @status_code = status_code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/stuart/infrastructure/api_response.rb', line 4 def body @body end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
4 5 6 |
# File 'lib/stuart/infrastructure/api_response.rb', line 4 def status_code @status_code end |
Instance Method Details
#success? ⇒ Boolean
11 12 13 |
# File 'lib/stuart/infrastructure/api_response.rb', line 11 def success? @status_code == (200 || 201) end |