Class: TaxCloud::Responses::Generic

Inherits:
Base
  • Object
show all
Defined in:
lib/tax_cloud/responses/generic.rb

Overview

A generic response to a TaxCloud API call.

Direct Known Subclasses

Authorized, AuthorizedWithCapture, Captured, Ping, Returned

Instance Attribute Summary

Attributes inherited from Base

#raw

Class Method Summary collapse

Methods inherited from Base

error_message, error_number, #initialize, #match, response_type, set_dsl

Constructor Details

This class inherits a constructor from TaxCloud::Responses::Base

Class Method Details

.parse(savon_response) ⇒ Object

Parse a TaxCloud response.

Parameters

savon_response

SOAP response.

Usually returns “OK” or raises an error.



24
25
26
27
# File 'lib/tax_cloud/responses/generic.rb', line 24

def parse(savon_response)
  response = new(savon_response)
  response.raw["#{key}_response".to_sym]["#{key}_result".to_sym][:response_type]
end

.response_key(key) ⇒ Object

Set the response key.

Parameters

key

Response key.



12
13
14
15
16
# File 'lib/tax_cloud/responses/generic.rb', line 12

def response_key(key)
  self.key = key
  response_type "#{key}_response/#{key}_result/response_type"
  error_message "#{key}_response/#{key}_result/messages/response_message/message"
end