Exception: Ocs::ApiError
- Defined in:
- lib/ocs/api_error.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#error_response ⇒ Object
readonly
Returns the value of attribute error_response.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
- #error_code ⇒ Object
- #error_text ⇒ Object
-
#initialize(api, parameters, error_response) ⇒ ApiError
constructor
A new instance of ApiError.
- #message ⇒ Object
- #status_code ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(api, parameters, error_response) ⇒ ApiError
Returns a new instance of ApiError.
5 6 7 8 9 |
# File 'lib/ocs/api_error.rb', line 5 def initialize(api, parameters, error_response) @api = api @parameters = parameters @error_response = error_response end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/ocs/api_error.rb', line 3 def api @api end |
#error_response ⇒ Object (readonly)
Returns the value of attribute error_response.
3 4 5 |
# File 'lib/ocs/api_error.rb', line 3 def error_response @error_response end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/ocs/api_error.rb', line 3 def parameters @parameters end |
Instance Method Details
#error_code ⇒ Object
11 12 13 |
# File 'lib/ocs/api_error.rb', line 11 def error_code error_response.content[:cserrorcode] end |
#error_text ⇒ Object
15 16 17 |
# File 'lib/ocs/api_error.rb', line 15 def error_text error_response.content[:errortext] end |
#message ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ocs/api_error.rb', line 19 def { api: api, parameters: parameters, error_response: error_response.raw_body } end |
#status_code ⇒ Object
27 28 29 |
# File 'lib/ocs/api_error.rb', line 27 def status_code error_response.content[:errorcode] end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/ocs/api_error.rb', line 31 def to_s "[#{error_code}] #{error_text}" end |