class TaxCloud::Client
A Client
communicates with the TaxCloud
service.
Public Class Methods
new()
click to toggle source
Create a new client.
Calls superclass method
# File lib/tax_cloud/client.rb, line 7 def initialize super client_params end
Public Instance Methods
call(method, message = {})
click to toggle source
Make a safe SOAP call. Will raise a TaxCloud::Errors::SoapError
on error.
Parameters¶ ↑
- method
-
SOAP method.
- body
-
Body content.
Calls superclass method
# File lib/tax_cloud/client.rb, line 17 def call(method, message = {}) safe do super method, message: message.merge(auth_params) end end
ping()
click to toggle source
request(method, message = {})
click to toggle source
# File lib/tax_cloud/client.rb, line 23 def request(method, message = {}) call method, message end
Private Instance Methods
auth_params()
click to toggle source
Authorization hash to use with all SOAP requests
# File lib/tax_cloud/client.rb, line 37 def auth_params return {} unless TaxCloud.configuration { 'apiLoginID' => TaxCloud.configuration.api_login_id, 'apiKey' => TaxCloud.configuration.api_key } end
client_params()
click to toggle source
# File lib/tax_cloud/client.rb, line 46 def client_params { wsdl: TaxCloud::WSDL_URL }.tap do |params| params[:open_timeout] = TaxCloud.configuration.open_timeout if TaxCloud.configuration.open_timeout params[:read_timeout] = TaxCloud.configuration.read_timeout if TaxCloud.configuration.read_timeout end end
safe() { || ... }
click to toggle source
# File lib/tax_cloud/client.rb, line 53 def safe yield rescue Savon::SOAPFault => e raise TaxCloud::Errors::SoapError, e end