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.
-
#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 ⇒ Object
-
#initialize(params) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(params) ⇒ Error
Returns a new instance of Error.
184 185 186 187 188 189 190 191 192 |
# File 'lib/barion.rb', line 184 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 super(params[:Description]) end |
Instance Attribute Details
#auth_data ⇒ Object (readonly)
Returns the value of attribute auth_data.
182 183 184 |
# File 'lib/barion.rb', line 182 def auth_data @auth_data end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
182 183 184 |
# File 'lib/barion.rb', line 182 def endpoint @endpoint end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
182 183 184 |
# File 'lib/barion.rb', line 182 def error_code @error_code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
182 183 184 |
# File 'lib/barion.rb', line 182 def errors @errors end |
#happened_at ⇒ Object (readonly)
Returns the value of attribute happened_at.
182 183 184 |
# File 'lib/barion.rb', line 182 def happened_at @happened_at end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
182 183 184 |
# File 'lib/barion.rb', line 182 def title @title end |
Instance Method Details
#all_errors ⇒ Object
194 195 196 |
# File 'lib/barion.rb', line 194 def all_errors Array(@errors).map(&:message).join("\n") end |