avatax 21.9.0 → 22.2.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 +22 -11
- data/lib/avatax/client/addresses.rb +4 -2
- data/lib/avatax/client/advancedrules.rb +10 -5
- data/lib/avatax/client/ageverification.rb +29 -0
- data/lib/avatax/client/avafileforms.rb +10 -5
- data/lib/avatax/client/batches.rb +16 -8
- data/lib/avatax/client/certexpressinvites.rb +6 -3
- data/lib/avatax/client/certificates.rb +30 -15
- data/lib/avatax/client/companies.rb +61 -21
- data/lib/avatax/client/compliance.rb +25 -14
- data/lib/avatax/client/contacts.rb +12 -6
- data/lib/avatax/client/customers.rb +26 -13
- data/lib/avatax/client/datasources.rb +12 -6
- data/lib/avatax/client/definitions.rb +140 -70
- data/lib/avatax/client/distancethresholds.rb +12 -6
- data/lib/avatax/client/ecms.rb +73 -73
- data/lib/avatax/client/ecommercetoken.rb +4 -2
- data/lib/avatax/client/errortransactions.rb +61 -61
- data/lib/avatax/client/filingcalendars.rb +9 -4
- data/lib/avatax/client/filings.rb +6 -2
- data/lib/avatax/client/firmclientlinkages.rb +18 -9
- data/lib/avatax/client/free.rb +2 -1
- data/lib/avatax/client/fundingrequests.rb +4 -2
- data/lib/avatax/client/items.rb +50 -25
- data/lib/avatax/client/jurisdictionoverrides.rb +12 -6
- data/lib/avatax/client/locations.rb +24 -12
- data/lib/avatax/client/multidocument.rb +20 -10
- data/lib/avatax/client/nexus.rb +30 -15
- data/lib/avatax/client/notices.rb +8 -4
- data/lib/avatax/client/notifications.rb +6 -3
- data/lib/avatax/client/onboarding.rb +55 -55
- data/lib/avatax/client/pointofsale.rb +21 -21
- data/lib/avatax/client/provisioning.rb +4 -2
- data/lib/avatax/client/registrar.rb +22 -11
- data/lib/avatax/client/reports.rb +8 -4
- data/lib/avatax/client/settings.rb +12 -6
- data/lib/avatax/client/shippingverification.rb +66 -0
- data/lib/avatax/client/subscriptions.rb +6 -3
- data/lib/avatax/client/taxcodes.rb +12 -6
- data/lib/avatax/client/taxcontent.rb +10 -5
- data/lib/avatax/client/taxprofiles.rb +42 -42
- data/lib/avatax/client/taxrules.rb +12 -6
- data/lib/avatax/client/transactions.rb +42 -21
- data/lib/avatax/client/upcs.rb +12 -6
- data/lib/avatax/client/userdefinedfields.rb +52 -0
- data/lib/avatax/client/users.rb +16 -8
- data/lib/avatax/client/utilities.rb +6 -3
- data/lib/avatax/client.rb +37 -35
- data/lib/avatax/configuration.rb +76 -76
- data/lib/avatax/connection.rb +49 -49
- data/lib/avatax/request.rb +51 -42
- 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 +9 -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
|
@@ -23,11 +23,12 @@ module AvaTax
|
|
23
23
|
# ### Security Policies
|
24
24
|
#
|
25
25
|
# * This API requires one of the following user roles: AccountAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
|
26
|
+
# Swagger Name: AvaTaxClient
|
26
27
|
# @param id [Integer] The ID of the account you wish to update.
|
27
28
|
# @param model [Object] A request confirming that you wish to reset the license key of this account.
|
28
29
|
# @return [Object]
|
29
30
|
def account_reset_license_key(id, model) path = "/api/v2/accounts/#{id}/resetlicensekey"
|
30
|
-
post(path, model) end
|
31
|
+
post(path, model, {}, "22.2.0") end
|
31
32
|
|
32
33
|
# Activate an account by accepting terms and conditions
|
33
34
|
#
|
@@ -45,11 +46,12 @@ module AvaTax
|
|
45
46
|
# ### Security Policies
|
46
47
|
#
|
47
48
|
# * This API requires one of the following user roles: AccountAdmin, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
|
49
|
+
# Swagger Name: AvaTaxClient
|
48
50
|
# @param id [Integer] The ID of the account to activate
|
49
51
|
# @param model [Object] The activation request
|
50
52
|
# @return [Object]
|
51
53
|
def activate_account(id, model) path = "/api/v2/accounts/#{id}/activate"
|
52
|
-
post(path, model) end
|
54
|
+
post(path, model, {}, "22.2.0") end
|
53
55
|
|
54
56
|
# Retrieve audit history for an account.
|
55
57
|
#
|
@@ -71,6 +73,7 @@ module AvaTax
|
|
71
73
|
# ### Security Policies
|
72
74
|
#
|
73
75
|
# * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
|
76
|
+
# Swagger Name: AvaTaxClient
|
74
77
|
# @param id [Integer] The ID of the account you wish to audit.
|
75
78
|
# @param start [DateTime] The start datetime of audit history you with to retrieve, e.g. "2018-06-08T17:00:00Z". Defaults to the past 15 minutes.
|
76
79
|
# @param end [DateTime] The end datetime of audit history you with to retrieve, e.g. "2018-06-08T17:15:00Z. Defaults to the current time. Maximum of an hour after the start time.
|
@@ -78,7 +81,7 @@ module AvaTax
|
|
78
81
|
# @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
|
79
82
|
# @return [FetchResult]
|
80
83
|
def audit_account(id, options={}) path = "/api/v2/accounts/#{id}/audit"
|
81
|
-
get(path, options) end
|
84
|
+
get(path, options, "22.2.0") end
|
82
85
|
|
83
86
|
# Create license key for this account
|
84
87
|
#
|
@@ -96,11 +99,12 @@ module AvaTax
|
|
96
99
|
# ### Security Policies
|
97
100
|
#
|
98
101
|
# * This API requires one of the following user roles: AccountAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
|
102
|
+
# Swagger Name: AvaTaxClient
|
99
103
|
# @param id [Integer] The ID of the account you wish to update.
|
100
104
|
# @param model [Object]
|
101
105
|
# @return [Object]
|
102
106
|
def create_license_key(id, model) path = "/api/v2/accounts/#{id}/licensekey"
|
103
|
-
post(path, model) end
|
107
|
+
post(path, model, {}, "22.2.0") end
|
104
108
|
|
105
109
|
# Delete license key for this account by license key name
|
106
110
|
#
|
@@ -113,11 +117,12 @@ module AvaTax
|
|
113
117
|
# ### Security Policies
|
114
118
|
#
|
115
119
|
# * This API requires one of the following user roles: AccountAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
|
120
|
+
# Swagger Name: AvaTaxClient
|
116
121
|
# @param id [Integer] The ID of the account you wish to update.
|
117
122
|
# @param licensekeyname [String] The license key name you wish to update.
|
118
123
|
# @return [ErrorDetail[]]
|
119
124
|
def delete_license_key(id, licensekeyname) path = "/api/v2/accounts/#{id}/licensekey/#{licensekeyname}"
|
120
|
-
delete(path) end
|
125
|
+
delete(path, {}, "22.2.0") end
|
121
126
|
|
122
127
|
# Retrieve a single account
|
123
128
|
#
|
@@ -130,11 +135,12 @@ module AvaTax
|
|
130
135
|
# ### Security Policies
|
131
136
|
#
|
132
137
|
# * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
|
138
|
+
# Swagger Name: AvaTaxClient
|
133
139
|
# @param id [Integer] The ID of the account to retrieve
|
134
140
|
# @param include [String] A comma separated list of special fetch options
|
135
141
|
# @return [Object]
|
136
142
|
def get_account(id, options={}) path = "/api/v2/accounts/#{id}"
|
137
|
-
get(path, options) end
|
143
|
+
get(path, options, "22.2.0") end
|
138
144
|
|
139
145
|
# Get configuration settings for this account
|
140
146
|
#
|
@@ -154,21 +160,23 @@ module AvaTax
|
|
154
160
|
# ### Security Policies
|
155
161
|
#
|
156
162
|
# * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
|
163
|
+
# Swagger Name: AvaTaxClient
|
157
164
|
# @param id [Integer]
|
158
165
|
# @return [AccountConfigurationModel[]]
|
159
166
|
def get_account_configuration(id) path = "/api/v2/accounts/#{id}/configuration"
|
160
|
-
get(path) end
|
167
|
+
get(path, {}, "22.2.0") end
|
161
168
|
|
162
169
|
# Retrieve license key by license key name
|
163
170
|
#
|
164
171
|
# ### Security Policies
|
165
172
|
#
|
166
173
|
# * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
|
174
|
+
# Swagger Name: AvaTaxClient
|
167
175
|
# @param id [Integer] The ID of the account to retrieve
|
168
176
|
# @param licensekeyname [String] The ID of the account to retrieve
|
169
177
|
# @return [Object]
|
170
178
|
def get_license_key(id, licensekeyname) path = "/api/v2/accounts/#{id}/licensekey/#{licensekeyname}"
|
171
|
-
get(path) end
|
179
|
+
get(path, {}, "22.2.0") end
|
172
180
|
|
173
181
|
# Retrieve all license keys for this account
|
174
182
|
#
|
@@ -177,10 +185,11 @@ module AvaTax
|
|
177
185
|
# ### Security Policies
|
178
186
|
#
|
179
187
|
# * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
|
188
|
+
# Swagger Name: AvaTaxClient
|
180
189
|
# @param id [Integer] The ID of the account to retrieve
|
181
190
|
# @return [AccountLicenseKeyModel[]]
|
182
191
|
def get_license_keys(id) path = "/api/v2/accounts/#{id}/licensekeys"
|
183
|
-
get(path) end
|
192
|
+
get(path, {}, "22.2.0") end
|
184
193
|
|
185
194
|
# Retrieve all accounts
|
186
195
|
#
|
@@ -200,6 +209,7 @@ module AvaTax
|
|
200
209
|
# ### Security Policies
|
201
210
|
#
|
202
211
|
# * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
|
212
|
+
# Swagger Name: AvaTaxClient
|
203
213
|
# @param include [String] A comma separated list of objects to fetch underneath this account. Any object with a URL path underneath this account can be fetched by specifying its name.
|
204
214
|
# @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* subscriptions, users
|
205
215
|
# @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
|
@@ -207,7 +217,7 @@ module AvaTax
|
|
207
217
|
# @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
208
218
|
# @return [FetchResult]
|
209
219
|
def query_accounts(options={}) path = "/api/v2/accounts"
|
210
|
-
get(path, options) end
|
220
|
+
get(path, options, "22.2.0") end
|
211
221
|
|
212
222
|
# Change configuration settings for this account
|
213
223
|
#
|
@@ -227,11 +237,12 @@ module AvaTax
|
|
227
237
|
# ### Security Policies
|
228
238
|
#
|
229
239
|
# * This API requires one of the following user roles: AccountAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
|
240
|
+
# Swagger Name: AvaTaxClient
|
230
241
|
# @param id [Integer]
|
231
242
|
# @param model [AccountConfigurationModel[]]
|
232
243
|
# @return [AccountConfigurationModel[]]
|
233
244
|
def set_account_configuration(id, model) path = "/api/v2/accounts/#{id}/configuration"
|
234
|
-
post(path, model) end
|
245
|
+
post(path, model, {}, "22.2.0") end
|
235
246
|
end
|
236
247
|
end
|
237
248
|
end
|
@@ -21,6 +21,7 @@ module AvaTax
|
|
21
21
|
#
|
22
22
|
# * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
|
23
23
|
# * This API depends on the following active services:*Required* (all): AutoAddress.
|
24
|
+
# Swagger Name: AvaTaxClient
|
24
25
|
# @param line1 [String] Line 1
|
25
26
|
# @param line2 [String] Line 2
|
26
27
|
# @param line3 [String] Line 3
|
@@ -31,7 +32,7 @@ module AvaTax
|
|
31
32
|
# @param textCase [String] selectable text case for address validation (See TextCase::* for a list of allowable values)
|
32
33
|
# @return [Object]
|
33
34
|
def resolve_address(options={}) path = "/api/v2/addresses/resolve"
|
34
|
-
get(path, options) end
|
35
|
+
get(path, options, "22.2.0") end
|
35
36
|
|
36
37
|
# Retrieve geolocation information for a specified address
|
37
38
|
#
|
@@ -46,10 +47,11 @@ module AvaTax
|
|
46
47
|
#
|
47
48
|
# * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
|
48
49
|
# * This API depends on the following active services:*Required* (all): AutoAddress.
|
50
|
+
# Swagger Name: AvaTaxClient
|
49
51
|
# @param model [Object] The address to resolve
|
50
52
|
# @return [Object]
|
51
53
|
def resolve_address_post(model) path = "/api/v2/addresses/resolve"
|
52
|
-
post(path, model) end
|
54
|
+
post(path, model, {}, "22.2.0") end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|