avatax 21.12.0 → 22.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +55 -55
- data/.rspec +1 -1
- data/.travis.yml +18 -18
- data/.vs/VSWorkspaceState.json +5 -5
- data/.yardopts +4 -4
- data/Gemfile +2 -2
- data/LICENSE +201 -201
- data/README.md +98 -98
- data/Rakefile +9 -9
- data/avatax.gemspec +38 -38
- data/example/avatax.rb +47 -47
- data/example/credentials.example.yaml +5 -5
- data/lib/avatax/api.rb +27 -27
- data/lib/avatax/client/accounts.rb +11 -11
- data/lib/avatax/client/addresses.rb +2 -2
- data/lib/avatax/client/advancedrules.rb +5 -5
- data/lib/avatax/client/avafileforms.rb +5 -5
- data/lib/avatax/client/batches.rb +8 -8
- data/lib/avatax/client/certexpressinvites.rb +3 -3
- data/lib/avatax/client/certificates.rb +15 -15
- data/lib/avatax/client/companies.rb +40 -21
- data/lib/avatax/client/compliance.rb +1 -1
- data/lib/avatax/client/contacts.rb +6 -6
- data/lib/avatax/client/customers.rb +13 -13
- data/lib/avatax/client/datasources.rb +6 -6
- data/lib/avatax/client/definitions.rb +75 -72
- data/lib/avatax/client/distancethresholds.rb +6 -6
- data/lib/avatax/client/ecms.rb +73 -73
- data/lib/avatax/client/ecommercetoken.rb +2 -2
- data/lib/avatax/client/errortransactions.rb +61 -61
- data/lib/avatax/client/filingcalendars.rb +3 -3
- data/lib/avatax/client/filings.rb +2 -2
- data/lib/avatax/client/firmclientlinkages.rb +9 -9
- data/lib/avatax/client/free.rb +1 -1
- data/lib/avatax/client/fundingrequests.rb +2 -2
- data/lib/avatax/client/items.rb +165 -28
- data/lib/avatax/client/jurisdictionoverrides.rb +6 -6
- data/lib/avatax/client/locations.rb +12 -12
- data/lib/avatax/client/multidocument.rb +10 -10
- data/lib/avatax/client/nexus.rb +15 -15
- data/lib/avatax/client/notices.rb +4 -4
- data/lib/avatax/client/notifications.rb +3 -3
- data/lib/avatax/client/onboarding.rb +55 -55
- data/lib/avatax/client/pointofsale.rb +21 -21
- data/lib/avatax/client/provisioning.rb +2 -2
- data/lib/avatax/client/registrar.rb +10 -21
- data/lib/avatax/client/reports.rb +4 -4
- data/lib/avatax/client/settings.rb +6 -6
- data/lib/avatax/client/shippingverification.rb +25 -9
- data/lib/avatax/client/subscriptions.rb +3 -3
- data/lib/avatax/client/taxcodes.rb +6 -6
- data/lib/avatax/client/taxcontent.rb +5 -5
- data/lib/avatax/client/taxprofiles.rb +42 -42
- data/lib/avatax/client/taxrules.rb +6 -6
- data/lib/avatax/client/transactions.rb +22 -23
- data/lib/avatax/client/upcs.rb +6 -6
- data/lib/avatax/client/userdefinedfields.rb +3 -3
- data/lib/avatax/client/users.rb +8 -8
- data/lib/avatax/client/utilities.rb +3 -3
- data/lib/avatax/client.rb +37 -37
- data/lib/avatax/configuration.rb +76 -76
- data/lib/avatax/connection.rb +49 -49
- data/lib/avatax/request.rb +51 -50
- data/lib/avatax/version.rb +3 -3
- data/lib/avatax.rb +26 -26
- data/spec/avatax/client/accounts_spec.rb +13 -13
- data/spec/avatax/client/transactions_spec.rb +80 -80
- data/spec/avatax/request_spec.rb +25 -25
- data/spec/avatax_spec.rb +45 -45
- data/spec/credentials.yaml.example +4 -4
- data/spec/fixtures/accounts.json +15 -15
- data/spec/spec_helper.rb +27 -27
- metadata +6 -13
data/README.md
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
The AvaTax Ruby Gem
|
2
|
-
====================
|
3
|
-
A Ruby wrapper for the AvaTax REST V2 APIs
|
4
|
-
|
5
|
-
Installation
|
6
|
-
------------
|
7
|
-
gem install avatax
|
8
|
-
|
9
|
-
Simple Code Example
|
10
|
-
-------------------------
|
11
|
-
```ruby
|
12
|
-
@client = AvaTax::Client.new(:logger => true)
|
13
|
-
|
14
|
-
createTransactionModel = {
|
15
|
-
"type" => 'SalesInvoice',
|
16
|
-
"companyCode" => '12670',
|
17
|
-
"date" => '2017-06-05',
|
18
|
-
"customerCode" => 'ABC',
|
19
|
-
"addresses" => {
|
20
|
-
"ShipFrom" => {
|
21
|
-
"line1" => "123 Main Street",
|
22
|
-
"city" => "Irvine",
|
23
|
-
"region" => "CA",
|
24
|
-
"country" => "US",
|
25
|
-
"postalCode" => "92615"
|
26
|
-
},
|
27
|
-
"ShipTo" => {
|
28
|
-
"line1" => "100 Market Street",
|
29
|
-
"city" => "San Francisco",
|
30
|
-
"region" => "CA",
|
31
|
-
"country" => "US",
|
32
|
-
"postalCode" => "94105"
|
33
|
-
}
|
34
|
-
},
|
35
|
-
"lines" => [ { "amount" => 100 }]
|
36
|
-
}
|
37
|
-
|
38
|
-
transaction = @client.create_transaction(createTransactionModel)
|
39
|
-
```
|
40
|
-
|
41
|
-
If you'd like to see a more complete code example with credentials, check out our [example folder](/example).
|
42
|
-
|
43
|
-
AvaTax REST and Search APIs
|
44
|
-
------------------------------
|
45
|
-
Our [developer site](https://developer.avalara.com/) documents all the AvaTax REST and other APIs. Subscribe to the [RSS feed](developer.avalara.com/feed.xml) to stay up to date on the lates news and announcements.
|
46
|
-
|
47
|
-
[API docs](http://www.rubydoc.info/github/avadev/AvaTax-REST-V2-Ruby-SDK/)
|
48
|
-
|
49
|
-
Blog
|
50
|
-
----------------------------
|
51
|
-
The [Developer Blog](https://developer.avalara.com/blog/) features news and important announcements about the AvaTax Platform and SDKs. You will also find tutorials and best practices to help you build great platform integrations.
|
52
|
-
|
53
|
-
Contributing
|
54
|
-
------------
|
55
|
-
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
56
|
-
|
57
|
-
Here are some ways *you* can contribute:
|
58
|
-
|
59
|
-
* by using alpha, beta, and prerelease versions
|
60
|
-
* by reporting bugs
|
61
|
-
* by suggesting new features
|
62
|
-
* by writing or editing documentation
|
63
|
-
* by writing specifications
|
64
|
-
* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
|
65
|
-
* by refactoring code
|
66
|
-
* by closing [issues](https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK/issues)
|
67
|
-
* by reviewing patches
|
68
|
-
|
69
|
-
|
70
|
-
Submitting an Issue
|
71
|
-
-------------------
|
72
|
-
We use the [GitHub issue tracker](https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK/issues) to track bugs and
|
73
|
-
features. Before submitting a bug report or feature request, check to make sure it hasn't already
|
74
|
-
been submitted. You can indicate support for an existing issue by voting it up. When submitting a
|
75
|
-
bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
|
76
|
-
details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
|
77
|
-
operating system. Ideally, a bug report should include a pull request with failing specs.
|
78
|
-
|
79
|
-
Submitting a Pull Request
|
80
|
-
-------------------------
|
81
|
-
1. Fork the project.
|
82
|
-
2. Create a topic branch.
|
83
|
-
3. Implement your feature or bug fix.
|
84
|
-
4. Add documentation for your feature or bug fix.
|
85
|
-
5. Run <tt>rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
|
86
|
-
6. Add specs for your feature or bug fix.
|
87
|
-
7. Commit and push your changes.
|
88
|
-
8. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
|
89
|
-
|
90
|
-
Build Status
|
91
|
-
------------
|
92
|
-
[](https://travis-ci.org/avadev/AvaTax-REST-V2-Ruby-SDK)
|
93
|
-
|
94
|
-
Copyright
|
95
|
-
---------
|
96
|
-
Copyright (c) 2017, Avalara, Inc. All rights reserved.
|
97
|
-
By contributing to AvaTax Ruby Gem, you agree that your contributions will be licensed under its Apache License.
|
98
|
-
See [LICENSE](https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK/) for details.
|
1
|
+
The AvaTax Ruby Gem
|
2
|
+
====================
|
3
|
+
A Ruby wrapper for the AvaTax REST V2 APIs
|
4
|
+
|
5
|
+
Installation
|
6
|
+
------------
|
7
|
+
gem install avatax
|
8
|
+
|
9
|
+
Simple Code Example
|
10
|
+
-------------------------
|
11
|
+
```ruby
|
12
|
+
@client = AvaTax::Client.new(:logger => true)
|
13
|
+
|
14
|
+
createTransactionModel = {
|
15
|
+
"type" => 'SalesInvoice',
|
16
|
+
"companyCode" => '12670',
|
17
|
+
"date" => '2017-06-05',
|
18
|
+
"customerCode" => 'ABC',
|
19
|
+
"addresses" => {
|
20
|
+
"ShipFrom" => {
|
21
|
+
"line1" => "123 Main Street",
|
22
|
+
"city" => "Irvine",
|
23
|
+
"region" => "CA",
|
24
|
+
"country" => "US",
|
25
|
+
"postalCode" => "92615"
|
26
|
+
},
|
27
|
+
"ShipTo" => {
|
28
|
+
"line1" => "100 Market Street",
|
29
|
+
"city" => "San Francisco",
|
30
|
+
"region" => "CA",
|
31
|
+
"country" => "US",
|
32
|
+
"postalCode" => "94105"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"lines" => [ { "amount" => 100 }]
|
36
|
+
}
|
37
|
+
|
38
|
+
transaction = @client.create_transaction(createTransactionModel)
|
39
|
+
```
|
40
|
+
|
41
|
+
If you'd like to see a more complete code example with credentials, check out our [example folder](/example).
|
42
|
+
|
43
|
+
AvaTax REST and Search APIs
|
44
|
+
------------------------------
|
45
|
+
Our [developer site](https://developer.avalara.com/) documents all the AvaTax REST and other APIs. Subscribe to the [RSS feed](developer.avalara.com/feed.xml) to stay up to date on the lates news and announcements.
|
46
|
+
|
47
|
+
[API docs](http://www.rubydoc.info/github/avadev/AvaTax-REST-V2-Ruby-SDK/)
|
48
|
+
|
49
|
+
Blog
|
50
|
+
----------------------------
|
51
|
+
The [Developer Blog](https://developer.avalara.com/blog/) features news and important announcements about the AvaTax Platform and SDKs. You will also find tutorials and best practices to help you build great platform integrations.
|
52
|
+
|
53
|
+
Contributing
|
54
|
+
------------
|
55
|
+
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
56
|
+
|
57
|
+
Here are some ways *you* can contribute:
|
58
|
+
|
59
|
+
* by using alpha, beta, and prerelease versions
|
60
|
+
* by reporting bugs
|
61
|
+
* by suggesting new features
|
62
|
+
* by writing or editing documentation
|
63
|
+
* by writing specifications
|
64
|
+
* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
|
65
|
+
* by refactoring code
|
66
|
+
* by closing [issues](https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK/issues)
|
67
|
+
* by reviewing patches
|
68
|
+
|
69
|
+
|
70
|
+
Submitting an Issue
|
71
|
+
-------------------
|
72
|
+
We use the [GitHub issue tracker](https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK/issues) to track bugs and
|
73
|
+
features. Before submitting a bug report or feature request, check to make sure it hasn't already
|
74
|
+
been submitted. You can indicate support for an existing issue by voting it up. When submitting a
|
75
|
+
bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
|
76
|
+
details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
|
77
|
+
operating system. Ideally, a bug report should include a pull request with failing specs.
|
78
|
+
|
79
|
+
Submitting a Pull Request
|
80
|
+
-------------------------
|
81
|
+
1. Fork the project.
|
82
|
+
2. Create a topic branch.
|
83
|
+
3. Implement your feature or bug fix.
|
84
|
+
4. Add documentation for your feature or bug fix.
|
85
|
+
5. Run <tt>rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
|
86
|
+
6. Add specs for your feature or bug fix.
|
87
|
+
7. Commit and push your changes.
|
88
|
+
8. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
|
89
|
+
|
90
|
+
Build Status
|
91
|
+
------------
|
92
|
+
[](https://travis-ci.org/avadev/AvaTax-REST-V2-Ruby-SDK)
|
93
|
+
|
94
|
+
Copyright
|
95
|
+
---------
|
96
|
+
Copyright (c) 2017, Avalara, Inc. All rights reserved.
|
97
|
+
By contributing to AvaTax Ruby Gem, you agree that your contributions will be licensed under its Apache License.
|
98
|
+
See [LICENSE](https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK/) for details.
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
begin
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
task :default => :spec
|
7
|
-
rescue LoadError
|
8
|
-
# no rspec available
|
9
|
-
end
|
1
|
+
begin
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
rescue LoadError
|
8
|
+
# no rspec available
|
9
|
+
end
|
data/avatax.gemspec
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
require File.expand_path('../lib/avatax/version', __FILE__)
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.add_development_dependency('rake', '~> 12.0.0')
|
5
|
-
s.add_development_dependency('rspec', '~> 3.5.0')
|
6
|
-
s.add_development_dependency('webmock', '>= 2.0.0')
|
7
|
-
s.add_runtime_dependency('faraday', '>= 0.10')
|
8
|
-
s.add_runtime_dependency('faraday_middleware', '>= 0.10')
|
9
|
-
s.add_runtime_dependency('multi_json', '>= 1.0.3')
|
10
|
-
s.authors = ["Marcus Vorwaller"]
|
11
|
-
s.description = %q{A Ruby wrapper for the AvaTax REST and Search APIs}
|
12
|
-
s.post_install_message =<<eos
|
13
|
-
********************************************************************************
|
14
|
-
|
15
|
-
AvaTax REST API
|
16
|
-
------------------------------
|
17
|
-
Our developer site documents the AvaTax REST API.
|
18
|
-
(http://developer.avatax.com).
|
19
|
-
Blog
|
20
|
-
----------------------------
|
21
|
-
The Developer Blog is a great place to learn more about the API and AvaTax integrations
|
22
|
-
Subscribe to the RSS feed be notified of new posts:
|
23
|
-
(http://developer.avatax.com/blog).
|
24
|
-
|
25
|
-
********************************************************************************
|
26
|
-
eos
|
27
|
-
s.email = ['marcus.vorwaller@avalara.com']
|
28
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
29
|
-
s.files = `git ls-files`.split("\n")
|
30
|
-
s.homepage = 'https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK'
|
31
|
-
s.name = 'avatax'
|
32
|
-
s.platform = Gem::Platform::RUBY
|
33
|
-
s.require_paths = ['lib']
|
34
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 2.0.0') if s.respond_to? :required_rubygems_version=
|
35
|
-
s.summary = %q{Ruby wrapper for the AvaTax API}
|
36
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
37
|
-
s.version = AvaTax::VERSION.dup
|
38
|
-
end
|
1
|
+
require File.expand_path('../lib/avatax/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.add_development_dependency('rake', '~> 12.0.0')
|
5
|
+
s.add_development_dependency('rspec', '~> 3.5.0')
|
6
|
+
s.add_development_dependency('webmock', '>= 2.0.0')
|
7
|
+
s.add_runtime_dependency('faraday', '>= 0.10')
|
8
|
+
s.add_runtime_dependency('faraday_middleware', '>= 0.10')
|
9
|
+
s.add_runtime_dependency('multi_json', '>= 1.0.3')
|
10
|
+
s.authors = ["Marcus Vorwaller"]
|
11
|
+
s.description = %q{A Ruby wrapper for the AvaTax REST and Search APIs}
|
12
|
+
s.post_install_message =<<eos
|
13
|
+
********************************************************************************
|
14
|
+
|
15
|
+
AvaTax REST API
|
16
|
+
------------------------------
|
17
|
+
Our developer site documents the AvaTax REST API.
|
18
|
+
(http://developer.avatax.com).
|
19
|
+
Blog
|
20
|
+
----------------------------
|
21
|
+
The Developer Blog is a great place to learn more about the API and AvaTax integrations
|
22
|
+
Subscribe to the RSS feed be notified of new posts:
|
23
|
+
(http://developer.avatax.com/blog).
|
24
|
+
|
25
|
+
********************************************************************************
|
26
|
+
eos
|
27
|
+
s.email = ['marcus.vorwaller@avalara.com']
|
28
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
29
|
+
s.files = `git ls-files`.split("\n")
|
30
|
+
s.homepage = 'https://github.com/avadev/AvaTax-REST-V2-Ruby-SDK'
|
31
|
+
s.name = 'avatax'
|
32
|
+
s.platform = Gem::Platform::RUBY
|
33
|
+
s.require_paths = ['lib']
|
34
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 2.0.0') if s.respond_to? :required_rubygems_version=
|
35
|
+
s.summary = %q{Ruby wrapper for the AvaTax API}
|
36
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
37
|
+
s.version = AvaTax::VERSION.dup
|
38
|
+
end
|
data/example/avatax.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require File.expand_path('../../lib/avatax', __FILE__)
|
3
|
-
|
4
|
-
credentials = YAML.load_file(File.expand_path('../credentials.yaml', __FILE__))
|
5
|
-
|
6
|
-
AvaTax.configure do |config|
|
7
|
-
begin
|
8
|
-
credentials = YAML.load_file(File.expand_path('../credentials.yaml', __FILE__))
|
9
|
-
config.endpoint = credentials['endpoint']
|
10
|
-
config.username = credentials['username']
|
11
|
-
config.password = credentials['password']
|
12
|
-
rescue
|
13
|
-
config.endpoint = 'https://sandbox-rest.avatax.com'
|
14
|
-
config.username = ENV['SANDBOX_USERNAME']
|
15
|
-
config.password = ENV['SANDBOX_PASSWORD']
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
@client = AvaTax::Client.new(:logger => true)
|
20
|
-
|
21
|
-
# puts @client.query_companies
|
22
|
-
|
23
|
-
createTransactionModel = {
|
24
|
-
"type" => 'SalesInvoice',
|
25
|
-
"companyCode" => '12670',
|
26
|
-
"date" => '2017-06-05',
|
27
|
-
"customerCode" => 'ABC',
|
28
|
-
"addresses" => {
|
29
|
-
"ShipFrom" => {
|
30
|
-
"line1" => "123 Main Street",
|
31
|
-
"city" => "Irvine",
|
32
|
-
"region" => "CA",
|
33
|
-
"country" => "US",
|
34
|
-
"postalCode" => "92615"
|
35
|
-
},
|
36
|
-
"ShipTo" => {
|
37
|
-
"line1" => "100 Market Street",
|
38
|
-
"city" => "San Francisco",
|
39
|
-
"region" => "CA",
|
40
|
-
"country" => "US",
|
41
|
-
"postalCode" => "94105"
|
42
|
-
}
|
43
|
-
},
|
44
|
-
"lines" => [ { "amount" => 100 }]
|
45
|
-
}
|
46
|
-
transaction = @client.create_transaction(createTransactionModel)
|
47
|
-
puts JSON.pretty_generate(transaction)
|
1
|
+
require 'yaml'
|
2
|
+
require File.expand_path('../../lib/avatax', __FILE__)
|
3
|
+
|
4
|
+
credentials = YAML.load_file(File.expand_path('../credentials.yaml', __FILE__))
|
5
|
+
|
6
|
+
AvaTax.configure do |config|
|
7
|
+
begin
|
8
|
+
credentials = YAML.load_file(File.expand_path('../credentials.yaml', __FILE__))
|
9
|
+
config.endpoint = credentials['endpoint']
|
10
|
+
config.username = credentials['username']
|
11
|
+
config.password = credentials['password']
|
12
|
+
rescue
|
13
|
+
config.endpoint = 'https://sandbox-rest.avatax.com'
|
14
|
+
config.username = ENV['SANDBOX_USERNAME']
|
15
|
+
config.password = ENV['SANDBOX_PASSWORD']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
@client = AvaTax::Client.new(:logger => true)
|
20
|
+
|
21
|
+
# puts @client.query_companies
|
22
|
+
|
23
|
+
createTransactionModel = {
|
24
|
+
"type" => 'SalesInvoice',
|
25
|
+
"companyCode" => '12670',
|
26
|
+
"date" => '2017-06-05',
|
27
|
+
"customerCode" => 'ABC',
|
28
|
+
"addresses" => {
|
29
|
+
"ShipFrom" => {
|
30
|
+
"line1" => "123 Main Street",
|
31
|
+
"city" => "Irvine",
|
32
|
+
"region" => "CA",
|
33
|
+
"country" => "US",
|
34
|
+
"postalCode" => "92615"
|
35
|
+
},
|
36
|
+
"ShipTo" => {
|
37
|
+
"line1" => "100 Market Street",
|
38
|
+
"city" => "San Francisco",
|
39
|
+
"region" => "CA",
|
40
|
+
"country" => "US",
|
41
|
+
"postalCode" => "94105"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"lines" => [ { "amount" => 100 }]
|
45
|
+
}
|
46
|
+
transaction = @client.create_transaction(createTransactionModel)
|
47
|
+
puts JSON.pretty_generate(transaction)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copy this file as credentials.yaml and update the values to match your account
|
2
|
-
---
|
3
|
-
endpoint: https://sandbox-rest.avatax.com
|
4
|
-
username: 'example_user'
|
5
|
-
password: 'abcd1234'
|
1
|
+
# Copy this file as credentials.yaml and update the values to match your account
|
2
|
+
---
|
3
|
+
endpoint: https://sandbox-rest.avatax.com
|
4
|
+
username: 'example_user'
|
5
|
+
password: 'abcd1234'
|
data/lib/avatax/api.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
require File.expand_path('../connection', __FILE__)
|
2
|
-
require File.expand_path('../request', __FILE__)
|
3
|
-
|
4
|
-
module AvaTax
|
5
|
-
class API
|
6
|
-
|
7
|
-
attr_accessor *Configuration::VALID_OPTIONS_KEYS
|
8
|
-
|
9
|
-
def initialize(options={})
|
10
|
-
options = AvaTax.options.merge(options)
|
11
|
-
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
12
|
-
send("#{key}=", options[key])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def config
|
17
|
-
conf = {}
|
18
|
-
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
19
|
-
conf[key] = send key
|
20
|
-
end
|
21
|
-
conf
|
22
|
-
end
|
23
|
-
|
24
|
-
include Connection
|
25
|
-
include Request
|
26
|
-
end
|
27
|
-
end
|
1
|
+
require File.expand_path('../connection', __FILE__)
|
2
|
+
require File.expand_path('../request', __FILE__)
|
3
|
+
|
4
|
+
module AvaTax
|
5
|
+
class API
|
6
|
+
|
7
|
+
attr_accessor *Configuration::VALID_OPTIONS_KEYS
|
8
|
+
|
9
|
+
def initialize(options={})
|
10
|
+
options = AvaTax.options.merge(options)
|
11
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
12
|
+
send("#{key}=", options[key])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def config
|
17
|
+
conf = {}
|
18
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
19
|
+
conf[key] = send key
|
20
|
+
end
|
21
|
+
conf
|
22
|
+
end
|
23
|
+
|
24
|
+
include Connection
|
25
|
+
include Request
|
26
|
+
end
|
27
|
+
end
|
@@ -28,7 +28,7 @@ module AvaTax
|
|
28
28
|
# @param model [Object] A request confirming that you wish to reset the license key of this account.
|
29
29
|
# @return [Object]
|
30
30
|
def account_reset_license_key(id, model) path = "/api/v2/accounts/#{id}/resetlicensekey"
|
31
|
-
post(path, model, {}, "
|
31
|
+
post(path, model, {}, "22.3.0") end
|
32
32
|
|
33
33
|
# Activate an account by accepting terms and conditions
|
34
34
|
#
|
@@ -51,7 +51,7 @@ module AvaTax
|
|
51
51
|
# @param model [Object] The activation request
|
52
52
|
# @return [Object]
|
53
53
|
def activate_account(id, model) path = "/api/v2/accounts/#{id}/activate"
|
54
|
-
post(path, model, {}, "
|
54
|
+
post(path, model, {}, "22.3.0") end
|
55
55
|
|
56
56
|
# Retrieve audit history for an account.
|
57
57
|
#
|
@@ -81,7 +81,7 @@ module AvaTax
|
|
81
81
|
# @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
|
82
82
|
# @return [FetchResult]
|
83
83
|
def audit_account(id, options={}) path = "/api/v2/accounts/#{id}/audit"
|
84
|
-
get(path, options, "
|
84
|
+
get(path, options, "22.3.0") end
|
85
85
|
|
86
86
|
# Create license key for this account
|
87
87
|
#
|
@@ -104,7 +104,7 @@ module AvaTax
|
|
104
104
|
# @param model [Object]
|
105
105
|
# @return [Object]
|
106
106
|
def create_license_key(id, model) path = "/api/v2/accounts/#{id}/licensekey"
|
107
|
-
post(path, model, {}, "
|
107
|
+
post(path, model, {}, "22.3.0") end
|
108
108
|
|
109
109
|
# Delete license key for this account by license key name
|
110
110
|
#
|
@@ -122,7 +122,7 @@ module AvaTax
|
|
122
122
|
# @param licensekeyname [String] The license key name you wish to update.
|
123
123
|
# @return [ErrorDetail[]]
|
124
124
|
def delete_license_key(id, licensekeyname) path = "/api/v2/accounts/#{id}/licensekey/#{licensekeyname}"
|
125
|
-
delete(path, {}, "
|
125
|
+
delete(path, {}, "22.3.0") end
|
126
126
|
|
127
127
|
# Retrieve a single account
|
128
128
|
#
|
@@ -140,7 +140,7 @@ module AvaTax
|
|
140
140
|
# @param include [String] A comma separated list of special fetch options
|
141
141
|
# @return [Object]
|
142
142
|
def get_account(id, options={}) path = "/api/v2/accounts/#{id}"
|
143
|
-
get(path, options, "
|
143
|
+
get(path, options, "22.3.0") end
|
144
144
|
|
145
145
|
# Get configuration settings for this account
|
146
146
|
#
|
@@ -164,7 +164,7 @@ module AvaTax
|
|
164
164
|
# @param id [Integer]
|
165
165
|
# @return [AccountConfigurationModel[]]
|
166
166
|
def get_account_configuration(id) path = "/api/v2/accounts/#{id}/configuration"
|
167
|
-
get(path, {}, "
|
167
|
+
get(path, {}, "22.3.0") end
|
168
168
|
|
169
169
|
# Retrieve license key by license key name
|
170
170
|
#
|
@@ -176,7 +176,7 @@ module AvaTax
|
|
176
176
|
# @param licensekeyname [String] The ID of the account to retrieve
|
177
177
|
# @return [Object]
|
178
178
|
def get_license_key(id, licensekeyname) path = "/api/v2/accounts/#{id}/licensekey/#{licensekeyname}"
|
179
|
-
get(path, {}, "
|
179
|
+
get(path, {}, "22.3.0") end
|
180
180
|
|
181
181
|
# Retrieve all license keys for this account
|
182
182
|
#
|
@@ -189,7 +189,7 @@ module AvaTax
|
|
189
189
|
# @param id [Integer] The ID of the account to retrieve
|
190
190
|
# @return [AccountLicenseKeyModel[]]
|
191
191
|
def get_license_keys(id) path = "/api/v2/accounts/#{id}/licensekeys"
|
192
|
-
get(path, {}, "
|
192
|
+
get(path, {}, "22.3.0") end
|
193
193
|
|
194
194
|
# Retrieve all accounts
|
195
195
|
#
|
@@ -217,7 +217,7 @@ module AvaTax
|
|
217
217
|
# @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
218
218
|
# @return [FetchResult]
|
219
219
|
def query_accounts(options={}) path = "/api/v2/accounts"
|
220
|
-
get(path, options, "
|
220
|
+
get(path, options, "22.3.0") end
|
221
221
|
|
222
222
|
# Change configuration settings for this account
|
223
223
|
#
|
@@ -242,7 +242,7 @@ module AvaTax
|
|
242
242
|
# @param model [AccountConfigurationModel[]]
|
243
243
|
# @return [AccountConfigurationModel[]]
|
244
244
|
def set_account_configuration(id, model) path = "/api/v2/accounts/#{id}/configuration"
|
245
|
-
post(path, model, {}, "
|
245
|
+
post(path, model, {}, "22.3.0") end
|
246
246
|
end
|
247
247
|
end
|
248
248
|
end
|
@@ -32,7 +32,7 @@ module AvaTax
|
|
32
32
|
# @param textCase [String] selectable text case for address validation (See TextCase::* for a list of allowable values)
|
33
33
|
# @return [Object]
|
34
34
|
def resolve_address(options={}) path = "/api/v2/addresses/resolve"
|
35
|
-
get(path, options, "
|
35
|
+
get(path, options, "22.3.0") end
|
36
36
|
|
37
37
|
# Retrieve geolocation information for a specified address
|
38
38
|
#
|
@@ -51,7 +51,7 @@ module AvaTax
|
|
51
51
|
# @param model [Object] The address to resolve
|
52
52
|
# @return [Object]
|
53
53
|
def resolve_address_post(model) path = "/api/v2/addresses/resolve"
|
54
|
-
post(path, model, {}, "
|
54
|
+
post(path, model, {}, "22.3.0") end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -12,7 +12,7 @@ module AvaTax
|
|
12
12
|
# @param model [Object] The lookup file you wish to create
|
13
13
|
# @return [Object]
|
14
14
|
def create_company_lookup_file(accountId, companyId, model) path = "/api/v2/advancedrules/accounts/#{accountId}/companies/#{companyId}/lookupFiles"
|
15
|
-
post(path, model, {}, "
|
15
|
+
post(path, model, {}, "22.3.0") end
|
16
16
|
|
17
17
|
# Delete a lookup file
|
18
18
|
#
|
@@ -22,7 +22,7 @@ module AvaTax
|
|
22
22
|
# @param id [String] The unique ID/GUID for the company lookup file to be deleted
|
23
23
|
# @return [ErrorDetail[]]
|
24
24
|
def delete_lookup_file(accountId, id) path = "/api/v2/advancedrules/accounts/#{accountId}/lookupFiles/#{id}"
|
25
|
-
delete(path, {}, "
|
25
|
+
delete(path, {}, "22.3.0") end
|
26
26
|
|
27
27
|
# Get the lookup files for a company
|
28
28
|
#
|
@@ -32,7 +32,7 @@ module AvaTax
|
|
32
32
|
# @param companyId [Integer] The ID of the company for which to retrieve lookup files
|
33
33
|
# @return [FetchResult]
|
34
34
|
def get_company_lookup_files(accountId, companyId) path = "/api/v2/advancedrules/accounts/#{accountId}/companies/#{companyId}/lookupFiles"
|
35
|
-
get(path, {}, "
|
35
|
+
get(path, {}, "22.3.0") end
|
36
36
|
|
37
37
|
# Get a lookup file for an accountId and companyLookupFileId
|
38
38
|
#
|
@@ -42,7 +42,7 @@ module AvaTax
|
|
42
42
|
# @param id [String] The unique ID/GUID of the company lookup file to return
|
43
43
|
# @return [Object]
|
44
44
|
def get_lookup_file(accountId, id) path = "/api/v2/advancedrules/accounts/#{accountId}/lookupFiles/#{id}"
|
45
|
-
get(path, {}, "
|
45
|
+
get(path, {}, "22.3.0") end
|
46
46
|
|
47
47
|
# Update a lookup file
|
48
48
|
#
|
@@ -53,7 +53,7 @@ module AvaTax
|
|
53
53
|
# @param model [Object] The new values to update the lookup file
|
54
54
|
# @return [Object]
|
55
55
|
def update_lookup_file(accountId, id, model) path = "/api/v2/advancedrules/accounts/#{accountId}/lookupFiles/#{id}"
|
56
|
-
put(path, model, {}, "
|
56
|
+
put(path, model, {}, "22.3.0") end
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -16,7 +16,7 @@ module AvaTax
|
|
16
16
|
# @param model [AvaFileFormModel[]] The AvaFileForm you wish to create.
|
17
17
|
# @return [AvaFileFormModel[]]
|
18
18
|
def create_ava_file_forms(model) path = "/api/v2/avafileforms"
|
19
|
-
post(path, model, {}, "
|
19
|
+
post(path, model, {}, "22.3.0") end
|
20
20
|
|
21
21
|
# Delete a single AvaFileForm
|
22
22
|
#
|
@@ -30,7 +30,7 @@ module AvaTax
|
|
30
30
|
# @param id [Integer] The ID of the AvaFileForm you wish to delete.
|
31
31
|
# @return [ErrorDetail[]]
|
32
32
|
def delete_ava_file_form(id) path = "/api/v2/avafileforms/#{id}"
|
33
|
-
delete(path, {}, "
|
33
|
+
delete(path, {}, "22.3.0") end
|
34
34
|
|
35
35
|
# Retrieve a single AvaFileForm
|
36
36
|
#
|
@@ -44,7 +44,7 @@ module AvaTax
|
|
44
44
|
# @param id [Integer] The primary key of this AvaFileForm
|
45
45
|
# @return [Object]
|
46
46
|
def get_ava_file_form(id) path = "/api/v2/avafileforms/#{id}"
|
47
|
-
get(path, {}, "
|
47
|
+
get(path, {}, "22.3.0") end
|
48
48
|
|
49
49
|
# Retrieve all AvaFileForms
|
50
50
|
#
|
@@ -62,7 +62,7 @@ module AvaTax
|
|
62
62
|
# @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
63
63
|
# @return [FetchResult]
|
64
64
|
def query_ava_file_forms(options={}) path = "/api/v2/avafileforms"
|
65
|
-
get(path, options, "
|
65
|
+
get(path, options, "22.3.0") end
|
66
66
|
|
67
67
|
# Update a AvaFileForm
|
68
68
|
#
|
@@ -78,7 +78,7 @@ module AvaTax
|
|
78
78
|
# @param model [Object] The AvaFileForm model you wish to update.
|
79
79
|
# @return [Object]
|
80
80
|
def update_ava_file_form(id, model) path = "/api/v2/avafileforms/#{id}"
|
81
|
-
put(path, model, {}, "
|
81
|
+
put(path, model, {}, "22.3.0") end
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|