avatax 14.4.4 → 17.5.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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +54 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +7 -0
  5. data/.yardopts +5 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +201 -191
  8. data/README.md +63 -61
  9. data/Rakefile +9 -0
  10. data/avatax.gemspec +39 -0
  11. data/example/avatax.rb +14 -0
  12. data/example/credentials.example.yaml +5 -0
  13. data/lib/avatax.rb +19 -13
  14. data/lib/avatax/api.rb +27 -0
  15. data/lib/avatax/client.rb +32 -0
  16. data/lib/avatax/client/accounts.rb +110 -0
  17. data/lib/avatax/client/addresses.rb +52 -0
  18. data/lib/avatax/client/batches.rb +117 -0
  19. data/lib/avatax/client/companies.rb +218 -0
  20. data/lib/avatax/client/contacts.rb +115 -0
  21. data/lib/avatax/client/definitions.rb +569 -0
  22. data/lib/avatax/client/filingcalendars.rb +313 -0
  23. data/lib/avatax/client/filings.rb +417 -0
  24. data/lib/avatax/client/free.rb +104 -0
  25. data/lib/avatax/client/fundingrequests.rb +53 -0
  26. data/lib/avatax/client/items.rb +111 -0
  27. data/lib/avatax/client/jurisdictionoverrides.rb +125 -0
  28. data/lib/avatax/client/locations.rb +158 -0
  29. data/lib/avatax/client/nexus.rb +157 -0
  30. data/lib/avatax/client/notices.rb +297 -0
  31. data/lib/avatax/client/onboarding.rb +23 -0
  32. data/lib/avatax/client/pointofsale.rb +24 -0
  33. data/lib/avatax/client/registrar.rb +216 -0
  34. data/lib/avatax/client/settings.rb +137 -0
  35. data/lib/avatax/client/subscriptions.rb +66 -0
  36. data/lib/avatax/client/taxcodes.rb +127 -0
  37. data/lib/avatax/client/taxrules.rb +127 -0
  38. data/lib/avatax/client/transactions.rb +473 -0
  39. data/lib/avatax/client/upcs.rb +112 -0
  40. data/lib/avatax/client/users.rb +112 -0
  41. data/lib/avatax/client/utilities.rb +52 -0
  42. data/lib/avatax/configuration.rb +53 -18
  43. data/lib/avatax/connection.rb +28 -0
  44. data/lib/avatax/request.rb +38 -0
  45. data/lib/avatax/version.rb +3 -0
  46. data/spec/avatax/client/accounts_spec.rb +26 -0
  47. data/spec/avatax_spec.rb +59 -0
  48. data/spec/fixtures/accounts.json +16 -0
  49. data/spec/spec_helper.rb +47 -0
  50. metadata +143 -30
  51. data/lib/avatax/address_service.rb +0 -31
  52. data/lib/avatax/tax_service.rb +0 -61
@@ -0,0 +1,117 @@
1
+ module AvaTax
2
+ class Client
3
+ module Batches
4
+
5
+
6
+ # Create a new batch
7
+ #
8
+ # Create one or more new batch objects attached to this company.
9
+ # A batch object is a large collection of API calls stored in a compact file.
10
+ # When you create a batch, it is added to the AvaTax Batch Queue and will be processed in the order it was received.
11
+ # You may fetch a batch to check on its status and retrieve the results of the batch operation.
12
+ # Each batch object may have one or more file objects attached.
13
+ #
14
+ # @param int companyId The ID of the company that owns this batch.
15
+ # @param BatchModel[] model The batch you wish to create.
16
+ # @return BatchModel[]
17
+ def create_batches(companyId, model)
18
+ path = "/api/v2/companies/#{companyId}/batches"
19
+
20
+ post(path, model)
21
+ end
22
+
23
+
24
+ # Delete a single batch
25
+ #
26
+ # Mark the existing batch object at this URL as deleted.
27
+ #
28
+ # @param int companyId The ID of the company that owns this batch.
29
+ # @param int id The ID of the batch you wish to delete.
30
+ # @return ErrorDetail[]
31
+ def delete_batch(companyId, id)
32
+ path = "/api/v2/companies/#{companyId}/batches/#{id}"
33
+
34
+ delete(path)
35
+ end
36
+
37
+
38
+ # Download a single batch file
39
+ #
40
+ # Download a single batch file identified by this URL.
41
+ #
42
+ # @param int companyId The ID of the company that owns this batch
43
+ # @param int batchId The ID of the batch object
44
+ # @param int id The primary key of this batch file object
45
+ # @return FileResult
46
+ def download_batch(companyId, batchId, id)
47
+ path = "/api/v2/companies/#{companyId}/batches/#{batchId}/files/#{id}/attachment"
48
+
49
+ get(path)
50
+ end
51
+
52
+
53
+ # Retrieve a single batch
54
+ #
55
+ # Get the batch object identified by this URL.
56
+ # A batch object is a large collection of API calls stored in a compact file.
57
+ # When you create a batch, it is added to the AvaTax Batch Queue and will be processed in the order it was received.
58
+ # You may fetch a batch to check on its status and retrieve the results of the batch operation.
59
+ #
60
+ # @param int companyId The ID of the company that owns this batch
61
+ # @param int id The primary key of this batch
62
+ # @return BatchModel
63
+ def get_batch(companyId, id)
64
+ path = "/api/v2/companies/#{companyId}/batches/#{id}"
65
+
66
+ get(path)
67
+ end
68
+
69
+
70
+ # Retrieve all batches for this company
71
+ #
72
+ # List all batch objects attached to the specified company.
73
+ # A batch object is a large collection of API calls stored in a compact file.
74
+ # When you create a batch, it is added to the AvaTax Batch Queue and will be processed in the order it was received.
75
+ # You may fetch a batch to check on its status and retrieve the results of the batch operation.
76
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
77
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
78
+ #
79
+ # @param int companyId The ID of the company that owns these batches
80
+ # @param string filter 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/) .
81
+ # @param string include A comma separated list of child objects to return underneath the primary object.
82
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
83
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
84
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
85
+ # @return FetchResult
86
+ def list_batches_by_company(companyId, options={})
87
+ path = "/api/v2/companies/#{companyId}/batches"
88
+
89
+ get(path, options)
90
+ end
91
+
92
+
93
+ # Retrieve all batches
94
+ #
95
+ # Get multiple batch objects across all companies.
96
+ # A batch object is a large collection of API calls stored in a compact file.
97
+ # When you create a batch, it is added to the AvaTax Batch Queue and will be processed in the order it was received.
98
+ # You may fetch a batch to check on its status and retrieve the results of the batch operation.
99
+ #
100
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
101
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
102
+ #
103
+ # @param string filter 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/) .
104
+ # @param string include A comma separated list of child objects to return underneath the primary object.
105
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
106
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
107
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
108
+ # @return FetchResult
109
+ def query_batches(options={})
110
+ path = "/api/v2/batches"
111
+
112
+ get(path, options)
113
+ end
114
+
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,218 @@
1
+ module AvaTax
2
+ class Client
3
+ module Companies
4
+
5
+
6
+ # Quick setup for a company with a single physical address
7
+ #
8
+ # Shortcut to quickly setup a single-physical-location company with critical information and activate it.
9
+ # This API provides quick and simple company setup functionality and does the following things:
10
+ #
11
+ # * Create a company object with its own tax profile
12
+ # * Add a key contact person for the company
13
+ # * Set up one physical location for the main office
14
+ # * Declare nexus in all taxing jurisdictions for that main office address
15
+ # * Activate the company
16
+ #
17
+ # This API only provides a limited subset of functionality compared to the 'Create Company' API call.
18
+ # If you need additional features or options not present in this 'Quick Setup' API call, please use the full 'Create Company' call instead.
19
+ #
20
+ # @param CompanyInitializationModel model Information about the company you wish to create.
21
+ # @return CompanyModel
22
+ def company_initialize(model)
23
+ path = "/api/v2/companies/initialize"
24
+
25
+ post(path, model)
26
+ end
27
+
28
+
29
+ # Create new companies
30
+ #
31
+ # Create one or more new company objects.
32
+ # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
33
+ # You may attach nested data objects such as contacts, locations, and nexus with this CREATE call, and those objects will be created with the company.
34
+ #
35
+ # @param CompanyModel[] model Either a single company object or an array of companies to create
36
+ # @return CompanyModel[]
37
+ def create_companies(model)
38
+ path = "/api/v2/companies"
39
+
40
+ post(path, model)
41
+ end
42
+
43
+
44
+ # Request managed returns funding setup for a company
45
+ #
46
+ # This API is available by invitation only.
47
+ # Companies that use the Avalara Managed Returns or the SST Certified Service Provider services are
48
+ # required to setup their funding configuration before Avalara can begin filing tax returns on their
49
+ # behalf.
50
+ # Funding configuration for each company is set up by submitting a funding setup request, which can
51
+ # be sent either via email or via an embedded HTML widget.
52
+ # When the funding configuration is submitted to Avalara, it will be reviewed by treasury team members
53
+ # before approval.
54
+ # This API records that an ambedded HTML funding setup widget was activated.
55
+ # This API requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
56
+ #
57
+ # @param int id The unique identifier of the company
58
+ # @param FundingInitiateModel model The funding initialization request
59
+ # @return FundingStatusModel
60
+ def create_funding_request(id, model)
61
+ path = "/api/v2/companies/#{id}/funding/setup"
62
+
63
+ post(path, model)
64
+ end
65
+
66
+
67
+ # Delete a single company
68
+ #
69
+ # Deleting a company will delete all child companies, and all users attached to this company.
70
+ #
71
+ # @param int id The ID of the company you wish to delete.
72
+ # @return ErrorDetail[]
73
+ def delete_company(id)
74
+ path = "/api/v2/companies/#{id}"
75
+
76
+ delete(path)
77
+ end
78
+
79
+
80
+ # Retrieve a single company
81
+ #
82
+ # Get the company object identified by this URL.
83
+ # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
84
+ # You may specify one or more of the following values in the '$include' parameter to fetch additional nested data, using commas to separate multiple values:
85
+ #
86
+ # * Contacts
87
+ # * Items
88
+ # * Locations
89
+ # * Nexus
90
+ # * Settings
91
+ # * TaxCodes
92
+ # * TaxRules
93
+ # * UPC
94
+ #
95
+ # @param int id The ID of the company to retrieve.
96
+ # @param string include A comma separated list of child objects to return underneath the primary object.
97
+ # @return CompanyModel
98
+ def get_company(id, options={})
99
+ path = "/api/v2/companies/#{id}"
100
+
101
+ get(path, options)
102
+ end
103
+
104
+
105
+ # Get configuration settings for this company
106
+ #
107
+ # Retrieve a list of all configuration settings tied to this company.
108
+ #
109
+ # Configuration settings provide you with the ability to control features of your account and of your
110
+ # tax software. The category names `AvaCertServiceConfig` is reserved for
111
+ # Avalara internal software configuration values; to store your own account-level settings, please
112
+ # create a new category name that begins with `X-`, for example, `X-MyCustomCategory`.
113
+ #
114
+ # Company settings are permanent settings that cannot be deleted. You can set the value of a
115
+ # company setting to null if desired.
116
+ #
117
+ # Avalara-based account settings for `AvaCertServiceConfig` affect your account's exemption certificate
118
+ # processing, and should only be changed with care.
119
+ #
120
+ # @param int id
121
+ # @return CompanyConfigurationModel[]
122
+ def get_company_configuration(id)
123
+ path = "/api/v2/companies/#{id}/configuration"
124
+
125
+ get(path)
126
+ end
127
+
128
+
129
+ # Check managed returns funding configuration for a company
130
+ #
131
+ # This API is available by invitation only.
132
+ # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
133
+ # Returns a list of funding setup requests and their current status.
134
+ # Each object in the result is a request that was made to setup or adjust funding configuration for this company.
135
+ #
136
+ # @param int id The unique identifier of the company
137
+ # @return FundingStatusModel[]
138
+ def list_funding_requests_by_company(id)
139
+ path = "/api/v2/companies/#{id}/funding"
140
+
141
+ get(path)
142
+ end
143
+
144
+
145
+ # Retrieve all companies
146
+ #
147
+ # Get multiple company objects.
148
+ # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
149
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
150
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
151
+ # You may specify one or more of the following values in the `$include` parameter to fetch additional nested data, using commas to separate multiple values:
152
+ #
153
+ # * Contacts
154
+ # * Items
155
+ # * Locations
156
+ # * Nexus
157
+ # * Settings
158
+ # * TaxCodes
159
+ # * TaxRules
160
+ # * UPC
161
+ #
162
+ # @param string include A comma separated list of child objects to return underneath the primary object.
163
+ # @param string filter 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/) .
164
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
165
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
166
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
167
+ # @return FetchResult
168
+ def query_companies(options={})
169
+ path = "/api/v2/companies"
170
+
171
+ get(path, options)
172
+ end
173
+
174
+
175
+ # Change configuration settings for this account
176
+ #
177
+ # Update configuration settings tied to this account.
178
+ #
179
+ # Configuration settings provide you with the ability to control features of your account and of your
180
+ # tax software. The category names `AvaCertServiceConfig` is reserved for
181
+ # Avalara internal software configuration values; to store your own account-level settings, please
182
+ # create a new category name that begins with `X-`, for example, `X-MyCustomCategory`.
183
+ #
184
+ # Company settings are permanent settings that cannot be deleted. You can set the value of a
185
+ # company setting to null if desired.
186
+ #
187
+ # Avalara-based account settings for `AvaCertServiceConfig` affect your account's exemption certificate
188
+ # processing, and should only be changed with care.
189
+ #
190
+ # @param int id
191
+ # @param CompanyConfigurationModel[] model
192
+ # @return CompanyConfigurationModel[]
193
+ def set_company_configuration(id, model)
194
+ path = "/api/v2/companies/#{id}/configuration"
195
+
196
+ post(path, model)
197
+ end
198
+
199
+
200
+ # Update a single company
201
+ #
202
+ # Replace the existing company object at this URL with an updated object.
203
+ # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
204
+ # All data from the existing object will be replaced with data in the object you PUT.
205
+ # To set a field's value to null, you may either set its value to null or omit that field from the object you post.
206
+ #
207
+ # @param int id The ID of the company you wish to update.
208
+ # @param CompanyModel model The company object you wish to update.
209
+ # @return CompanyModel
210
+ def update_company(id, model)
211
+ path = "/api/v2/companies/#{id}"
212
+
213
+ put(path, model)
214
+ end
215
+
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,115 @@
1
+ module AvaTax
2
+ class Client
3
+ module Contacts
4
+
5
+
6
+ # Create a new contact
7
+ #
8
+ # Create one or more new contact objects.
9
+ # A 'contact' is a person associated with a company who is designated to handle certain responsibilities of
10
+ # a tax collecting and filing entity.
11
+ #
12
+ # @param int companyId The ID of the company that owns this contact.
13
+ # @param ContactModel[] model The contacts you wish to create.
14
+ # @return ContactModel[]
15
+ def create_contacts(companyId, model)
16
+ path = "/api/v2/companies/#{companyId}/contacts"
17
+
18
+ post(path, model)
19
+ end
20
+
21
+
22
+ # Delete a single contact
23
+ #
24
+ # Mark the existing contact object at this URL as deleted.
25
+ #
26
+ # @param int companyId The ID of the company that owns this contact.
27
+ # @param int id The ID of the contact you wish to delete.
28
+ # @return ErrorDetail[]
29
+ def delete_contact(companyId, id)
30
+ path = "/api/v2/companies/#{companyId}/contacts/#{id}"
31
+
32
+ delete(path)
33
+ end
34
+
35
+
36
+ # Retrieve a single contact
37
+ #
38
+ # Get the contact object identified by this URL.
39
+ # A 'contact' is a person associated with a company who is designated to handle certain responsibilities of
40
+ # a tax collecting and filing entity.
41
+ #
42
+ # @param int companyId The ID of the company for this contact
43
+ # @param int id The primary key of this contact
44
+ # @return ContactModel
45
+ def get_contact(companyId, id)
46
+ path = "/api/v2/companies/#{companyId}/contacts/#{id}"
47
+
48
+ get(path)
49
+ end
50
+
51
+
52
+ # Retrieve contacts for this company
53
+ #
54
+ # List all contact objects assigned to this company.
55
+ #
56
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
57
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
58
+ #
59
+ # @param int companyId The ID of the company that owns these contacts
60
+ # @param string filter 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/) .
61
+ # @param string include A comma separated list of child objects to return underneath the primary object.
62
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
63
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
64
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
65
+ # @return FetchResult
66
+ def list_contacts_by_company(companyId, options={})
67
+ path = "/api/v2/companies/#{companyId}/contacts"
68
+
69
+ get(path, options)
70
+ end
71
+
72
+
73
+ # Retrieve all contacts
74
+ #
75
+ # Get multiple contact objects across all companies.
76
+ # A 'contact' is a person associated with a company who is designated to handle certain responsibilities of
77
+ # a tax collecting and filing entity.
78
+ #
79
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
80
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
81
+ #
82
+ # @param string filter 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/) .
83
+ # @param string include A comma separated list of child objects to return underneath the primary object.
84
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
85
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
86
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
87
+ # @return FetchResult
88
+ def query_contacts(options={})
89
+ path = "/api/v2/contacts"
90
+
91
+ get(path, options)
92
+ end
93
+
94
+
95
+ # Update a single contact
96
+ #
97
+ # Replace the existing contact object at this URL with an updated object.
98
+ # A 'contact' is a person associated with a company who is designated to handle certain responsibilities of
99
+ # a tax collecting and filing entity.
100
+ # All data from the existing object will be replaced with data in the object you PUT.
101
+ # To set a field's value to null, you may either set its value to null or omit that field from the object you post.
102
+ #
103
+ # @param int companyId The ID of the company that this contact belongs to.
104
+ # @param int id The ID of the contact you wish to update
105
+ # @param ContactModel model The contact you wish to update.
106
+ # @return ContactModel
107
+ def update_contact(companyId, id, model)
108
+ path = "/api/v2/companies/#{companyId}/contacts/#{id}"
109
+
110
+ put(path, model)
111
+ end
112
+
113
+ end
114
+ end
115
+ end