Class: MxHero::API::Response
- Inherits:
-
Struct
- Object
- Struct
- MxHero::API::Response
- Defined in:
- lib/response.rb
Overview
The class that contains the response information
The code represent the HTTP code of the response.
The msg represent a hash with the response information. Example:
{ status: 500, code: 500,
developerMessage: "rules.already.exists.for.component",
moreInfoUrl: "mailto:[email protected]" }
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#msg ⇒ Object
(also: #content)
Returns the value of attribute msg.
Instance Method Summary collapse
-
#error ⇒ String
The error message.
-
#success? ⇒ Boolean
Response is successful? Based in HTTP status code.
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code
16 17 18 |
# File 'lib/response.rb', line 16 def code @code end |
#msg ⇒ Object Also known as: content
Returns the value of attribute msg
16 17 18 |
# File 'lib/response.rb', line 16 def msg @msg end |
Instance Method Details
#error ⇒ String
Returns the error message.
24 25 26 |
# File 'lib/response.rb', line 24 def error content[:developerMessage] if content.is_a? Hash end |
#success? ⇒ Boolean
Response is successful? Based in HTTP status code
19 20 21 |
# File 'lib/response.rb', line 19 def success? code.to_i == 200 || code.to_i == 201 end |