Exception: IOTServices::Evolens::ServerError
- Inherits:
-
IOTServices::Error
- Object
- StandardError
- IOTServices::Error
- IOTServices::Evolens::ServerError
- Defined in:
- lib/iot_services/evolens/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response) ⇒ ServerError
constructor
A new instance of ServerError.
- #response_code(response) ⇒ Object
- #response_message(response) ⇒ Object
Constructor Details
#initialize(response) ⇒ ServerError
Returns a new instance of ServerError.
6 7 8 9 10 |
# File 'lib/iot_services/evolens/errors.rb', line 6 def initialize response super (response) @code = response_code(response) @status = response.status end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/iot_services/evolens/errors.rb', line 4 def code @code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/iot_services/evolens/errors.rb', line 4 def status @status end |
Instance Method Details
#response_code(response) ⇒ Object
22 23 24 |
# File 'lib/iot_services/evolens/errors.rb', line 22 def response_code response response.body['error']['code'] if response.body['error'] end |
#response_message(response) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/iot_services/evolens/errors.rb', line 12 def response if response.body['error'] response.body['error']['message'] elsif response.body['Message'] [response.body['Message'], response.body['MessageDetail']].join("\n") else 'Error response not recognized' end end |