Exception: SpreeAvatax::Shared::FailedApiResponse
- Inherits:
-
StandardError
- Object
- StandardError
- SpreeAvatax::Shared::FailedApiResponse
- Defined in:
- app/models/spree_avatax/shared.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ FailedApiResponse
constructor
A new instance of FailedApiResponse.
Constructor Details
#initialize(response) ⇒ FailedApiResponse
Returns a new instance of FailedApiResponse.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/spree_avatax/shared.rb', line 5 def initialize(response) @response = response # avatax seems to have two different error message formats: # https://gist.github.com/jordan-brough/a22163e4551c692365b8 # https://gist.github.com/jordan-brough/c778a3417850dfa2307c # We should pester Avatax about this sometime. if @response[:messages].is_a?(Array) @messages = response[:messages] else @messages = Array.wrap(response[:messages][:message]) end super(.map { |msg| msg[:summary] }) end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
3 4 5 |
# File 'app/models/spree_avatax/shared.rb', line 3 def @messages end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'app/models/spree_avatax/shared.rb', line 3 def response @response end |