Class: ManageIQ::API::Client::Error
- Inherits:
-
Object
- Object
- ManageIQ::API::Client::Error
- Defined in:
- lib/manageiq/api/client/error.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(status = 0, json_response = {}) ⇒ Error
constructor
A new instance of Error.
- #update(status, json_response = {}) ⇒ Object
Constructor Details
#initialize(status = 0, json_response = {}) ⇒ Error
Returns a new instance of Error.
10 11 12 |
# File 'lib/manageiq/api/client/error.rb', line 10 def initialize(status = 0, json_response = {}) update(status, json_response) end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
6 7 8 |
# File 'lib/manageiq/api/client/error.rb', line 6 def kind @kind end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
8 9 10 |
# File 'lib/manageiq/api/client/error.rb', line 8 def klass @klass end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/manageiq/api/client/error.rb', line 7 def @message end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/manageiq/api/client/error.rb', line 5 def status @status end |
Instance Method Details
#clear ⇒ Object
14 15 16 |
# File 'lib/manageiq/api/client/error.rb', line 14 def clear update(0) end |
#update(status, json_response = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/manageiq/api/client/error.rb', line 18 def update(status, json_response = {}) @status = status @kind, @message, @klass = nil error = json_response["error"] if status >= 400 && error.present? if error.kind_of?(Hash) @kind, @message, @klass = error.values_at("kind", "message", "klass") else @message = error end end end |