Exception: Barion::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/barion.rb

Overview

Generic error class for Barion module

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dataObject (readonly)

Returns the value of attribute auth_data.



182
183
184
# File 'lib/barion.rb', line 182

def auth_data
  @auth_data
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



182
183
184
# File 'lib/barion.rb', line 182

def endpoint
  @endpoint
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



182
183
184
# File 'lib/barion.rb', line 182

def error_code
  @error_code
end

#errorsObject (readonly)

Returns the value of attribute errors.



182
183
184
# File 'lib/barion.rb', line 182

def errors
  @errors
end

#happened_atObject (readonly)

Returns the value of attribute happened_at.



182
183
184
# File 'lib/barion.rb', line 182

def happened_at
  @happened_at
end

#titleObject (readonly)

Returns the value of attribute title.



182
183
184
# File 'lib/barion.rb', line 182

def title
  @title
end

Instance Method Details

#all_errorsObject



194
195
196
# File 'lib/barion.rb', line 194

def all_errors
  Array(@errors).map(&:message).join("\n")
end