https://github.com/avadev/avatax-calc-rest-ruby
https://github.com/avadev/avatax-calc-rest-ruby
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/avadev/avatax-calc-rest-ruby
- Owner: avadev
- License: apache-2.0
- Created: 2013-12-27T01:26:26.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T02:26:20.000Z (almost 6 years ago)
- Last Synced: 2024-03-27T01:28:10.656Z (over 2 years ago)
- Language: Ruby
- Size: 41 KB
- Stars: 7
- Watchers: 17
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
avatax.rb
=====================
[Other Samples](http://developer.avalara.com/avatax/sample-code)
This is a Ruby client library for the [AvaTax REST API](http://developer.avalara.com/avatax/tax/v1)
methods:
[tax/get POST](http://developer.avalara.com/avatax/tax/v1#getTax),
[tax/get GET](http://developer.avalara.com/avatax/tax/v1#estimateTax),
[tax/cancel POST](http://developer.avalara.com/avatax/tax/v1#cancelTax), and
[address/validate GET](http://developer.avalara.com/avatax/tax/v1#validateAddress).
For more information on the use of these methods and the AvaTax product, please
visit our [developer site](http://developer.avalara.com/) or [homepage](http://www.avalara.com/)
Dependencies
-----------
- Ruby 1.9.2 or later
- [Bundler](http://bundler.io)
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](http://developer.avalara.com/avatax/get-started)
- Specify your authentication credentials as
- environment variables,
- YAML file (see `credentials.yml.example`), or
- in source
Credentials as environment variables
------------------------------------
```shell
$ 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
--------------------------
```ruby
AvaTax.configure_from 'credentials.yml.example'
```
Credentials in source
---------------------
```ruby
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](http://developer.avalara.com/avatax/tax/v1#cancelTax) used to [void a document](http://developer.avalara.com/avatax/tax/v1#voiding-documents) |
| EstimateTaxTest.rb | Demonstrates the [AvaTax::TaxService.estimate](http://developer.avalara.com/avatax/tax/v1#estimateTax) method used for product- and line- indifferent tax estimates. |
| GetTaxTest.rb | Demonstrates the [AvaTax::TaxService.get](http://developer.avalara.com/avatax/tax/v1#getTax) method used for product- and line- specific [calculation](http://developer.avalara.com/avatax/calculating-tax). **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](http://developer.avalara.com/avatax/tax/v1#validateAddress) method to [normalize an address](http://developer.avalara.com/avatax/address-validation). |