Exception: QboApi::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors = {}) ⇒ Error

Returns a new instance of Error.



16
17
18
19
# File 'lib/qbo_api/error.rb', line 16

def initialize(errors = {})
  @fault = errors
  super(errors[:error_body])
end

Instance Attribute Details

#faultObject (readonly)

Returns the value of attribute fault.



14
15
16
# File 'lib/qbo_api/error.rb', line 14

def fault
  @fault
end

Instance Method Details

#error_codeObject



25
26
27
# File 'lib/qbo_api/error.rb', line 25

def error_code
  fault.dig(:error_body, 0, :error_code)
end

#error_detailObject



33
34
35
# File 'lib/qbo_api/error.rb', line 33

def error_detail
  fault.dig(:error_body, 0, :error_detail)
end

#error_messageObject



29
30
31
# File 'lib/qbo_api/error.rb', line 29

def error_message
  fault.dig(:error_body, 0, :error_message)
end

#fault_typeObject



21
22
23
# File 'lib/qbo_api/error.rb', line 21

def fault_type
  fault.dig(:error_body, 0, :fault_type)
end