Exception: Barion::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Barion::Error
- Defined in:
- lib/barion.rb
Overview
Generic error class for Barion module
Instance Attribute Summary collapse
-
#auth_data ⇒ Object
readonly
Returns the value of attribute auth_data.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#happened_at ⇒ Object
readonly
Returns the value of attribute happened_at.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#all_errors ⇒ String
Returns all errors that happened in the request in a single string.
-
#initialize(params) ⇒ Error
constructor
Creates a new instance of the Barion::Error class.
Constructor Details
#initialize(params) ⇒ Error
Creates a new instance of the Barion::Error class. It can hold nested errors.
316 317 318 319 320 321 322 323 324 325 |
# File 'lib/barion.rb', line 316 def initialize(params) @title = params[:Title] @error_code = params[:ErrorCode] @happened_at = params[:HappenedAt] @auth_data = params[:AuthData] @endpoint = params[:Endpoint] @errors = Array(params[:Errors]).map { |e| Barion::Error.new(e) } if params.key? :Errors @description = params[:Description] super(@description) end |
Instance Attribute Details
#auth_data ⇒ Object (readonly)
Returns the value of attribute auth_data.
304 305 306 |
# File 'lib/barion.rb', line 304 def auth_data @auth_data end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
304 305 306 |
# File 'lib/barion.rb', line 304 def description @description end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
304 305 306 |
# File 'lib/barion.rb', line 304 def endpoint @endpoint end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
304 305 306 |
# File 'lib/barion.rb', line 304 def error_code @error_code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
304 305 306 |
# File 'lib/barion.rb', line 304 def errors @errors end |
#happened_at ⇒ Object (readonly)
Returns the value of attribute happened_at.
304 305 306 |
# File 'lib/barion.rb', line 304 def happened_at @happened_at end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
304 305 306 |
# File 'lib/barion.rb', line 304 def title @title end |
Instance Method Details
#all_errors ⇒ String
Returns all errors that happened in the request in a single string
330 331 332 |
# File 'lib/barion.rb', line 330 def all_errors Array(@errors).map(&:message).join("\n") end |