avadev / AvaTax-Calc-REST-Ruby

Apache License 2.0
7 stars 12 forks source link

avatax.rb

Other Samples

This is a Ruby client library for the AvaTax REST API methods: tax/get POST, tax/get GET, tax/cancel POST, and address/validate GET.

For more information on the use of these methods and the AvaTax product, please visit our developer site or homepage

Dependencies

Requirements

Credentials as environment variables

$ AVATAX_ACCOUNT_NUMBER=1234567890 AVATAX_LICENSE_KEY=A1B2C3D4E5F6G7H8 AVATAX_SERVICE_URL=https://development.avalara.net bundle exec ruby examples/PingTest.rb

Credentials from YAML file

AvaTax.configure_from 'credentials.yml.example'

Credentials in source

AvaTax.configure do
  account_number '1234567890'
  license_key 'A1B2C3D4E5F6G7H8'
  service_url 'https://development.avalara.net'
end

Examples

Filename Description
CancelTaxTest.rb Demonstrates AvaTax::TaxService.cancel used to void a document
EstimateTaxTest.rb Demonstrates the AvaTax::TaxService.estimate method used for product- and line- indifferent tax estimates.
GetTaxTest.rb Demonstrates the AvaTax::TaxService.get method used for product- and line- specific calculation. NOTE: This will generate a new transaction/document each time.
PingTest.rb Uses a hardcoded AvaTax::TaxService.estimate call to test connectivity and credential information.
ValidateTest.rb Demonstrates the AvaTax::AddressService.validate method to normalize an address.