Exception: InstantQuote::ApiError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ApiError

Returns a new instance of ApiError.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/instant_quote/api_error.rb', line 10

def initialize(params = {})
  super

  @adapter = params[:adapter]
  @error = params[:error]
  @data = params[:data] || {}
  @code = params[:code]

  # Delete the metaData key, because it's irrelevant and has long strings
  @data.delete(:metaData) if @data.respond_to?(:key?) && @data.key?(:metaData)
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



5
6
7
# File 'lib/instant_quote/api_error.rb', line 5

def adapter
  @adapter
end

#codeObject

Returns the value of attribute code.



5
6
7
# File 'lib/instant_quote/api_error.rb', line 5

def code
  @code
end

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/instant_quote/api_error.rb', line 5

def data
  @data
end

#errorObject Also known as: message, to_s

Returns the value of attribute error.



5
6
7
# File 'lib/instant_quote/api_error.rb', line 5

def error
  @error
end