Skip to content

FinditParts/AvaTax-Calc-REST-Ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Add the avatax gem to your Gemfile with gem 'avatax'
  • Run bundle install to retrieve avatax and all its dependencies
  • Authentication requires an valid Account Number and License Key. If you do not have an AvaTax account, a free trial account can be acquired through our developer site
  • Specify your authentication credentials as
    • environment variables,
    • YAML file (see credentials.yml.example), or
    • in source

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%