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 5 def initialize super TaxCloud::WSDL_URL http.read_timeout = client_params[:read_timeout] if client_params.key?(:read_timeout) http.open_timeout = client_params[:open_timeout] if client_params.key?(:open_timeout) end
Public Instance Methods
ping()
click to toggle source
request(method, body = {})
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 18 def request(method, body = {}) safe do super method, body: body.merge(auth_params) end 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 34 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 42 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 49 def safe yield rescue Savon::SOAP::Fault => e raise TaxCloud::Errors::SoapError.new(e) end