Exception: BeyondApi::Error
- Inherits:
-
StandardError
- Object
- StandardError
- BeyondApi::Error
- Defined in:
- lib/beyond_api/error.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#error_description ⇒ Object
readonly
Returns the value of attribute error_description.
-
#error_id ⇒ Object
readonly
Returns the value of attribute error_id.
-
#full_message ⇒ Object
readonly
Returns the value of attribute full_message.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#trace_id ⇒ Object
readonly
Returns the value of attribute trace_id.
Instance Method Summary collapse
-
#initialize(data, status_code = nil) ⇒ Error
constructor
A new instance of Error.
- #to_json ⇒ Object
Constructor Details
#initialize(data, status_code = nil) ⇒ Error
Returns a new instance of Error.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/beyond_api/error.rb', line 7 def initialize(data, status_code = nil) data ||= {} @error_id = data["errorId"] @details = data["details"] @trace_id = data["traceId"] @error = data["error"] @error_description = data["error_description"] @full_message = data @status_code = status_code super(data["message"] || data["error_description"]) end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def details @details end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def error @error end |
#error_description ⇒ Object (readonly)
Returns the value of attribute error_description.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def error_description @error_description end |
#error_id ⇒ Object (readonly)
Returns the value of attribute error_id.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def error_id @error_id end |
#full_message ⇒ Object (readonly)
Returns the value of attribute full_message.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def @full_message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def status_code @status_code end |
#trace_id ⇒ Object (readonly)
Returns the value of attribute trace_id.
5 6 7 |
# File 'lib/beyond_api/error.rb', line 5 def trace_id @trace_id end |
Instance Method Details
#to_json ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/beyond_api/error.rb', line 21 def to_json { error_id: @error_id, message: @message, details: @details, error: @error, error_description: @error_description, trace_id: @trace_id, status_code: @status_code } end |