Class: TaxCloud::Responses::TaxCodes

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

Overview

Response to a TaxCloud getTICs API call.

See api.taxcloud.net/1.0/TaxCloud.asmx?op=GetTICs.

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.

Returns an array of tax codes.



17
18
19
20
21
22
23
24
25
26
# File 'lib/tax_cloud/responses/tax_codes.rb', line 17

def parse(savon_response)
  response = new(savon_response)
  tax_codes = response.match('get_ti_cs_response/get_ti_cs_result/ti_cs/tic')
  tax_codes.map do |tax_code|
    TaxCloud::TaxCode.new(
      ticid: tax_code[:ticid].to_i,
      description: tax_code[:description].strip
    )
  end
end