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,23 @@
1
+ module AvaTax
2
+ class Client
3
+ module Onboarding
4
+
5
+
6
+ # Request a new Avalara account
7
+ #
8
+ # This API is for use by partner onboarding services customers only.
9
+ # Calling this API creates an account with the specified product subscriptions, but does not configure billing.
10
+ # The customer will receive information from Avalara about how to configure billing for their account.
11
+ # You should call this API when a customer has requested to begin using Avalara services.
12
+ #
13
+ # @param NewAccountRequestModel model Information about the account you wish to create and the selected product offerings.
14
+ # @return NewAccountModel
15
+ def request_new_account(model)
16
+ path = "/api/v2/accounts/request"
17
+
18
+ post(path, model)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ module AvaTax
2
+ class Client
3
+ module PointOfSale
4
+
5
+
6
+ # Point of sale data file generation
7
+ #
8
+ # Builds a point-of-sale data file containing tax rates and rules for items and locations that can be used
9
+ # to correctly calculate tax in the event a point-of-sale device is not able to reach AvaTax.
10
+ # This data file can be customized for specific partner devices and usage conditions.
11
+ # The result of this API is the file you requested in the format you requested using the 'responseType' field.
12
+ # This API builds the file on demand, and is limited to files with no more than 7500 scenarios.
13
+ #
14
+ # @param PointOfSaleDataRequestModel model Parameters about the desired file format and report format, specifying which company, locations and TaxCodes to include.
15
+ # @return FileResult
16
+ def build_point_of_sale_data_file(model)
17
+ path = "/api/v2/pointofsaledata/build"
18
+
19
+ post(path, model)
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,216 @@
1
+ module AvaTax
2
+ class Client
3
+ module Registrar
4
+
5
+
6
+ # Change Password
7
+ #
8
+ # # For Registrar Use Only
9
+ # This API is for use by Avalara Registrar administrative users only.
10
+ #
11
+ # Allows a user to change their password via the API.
12
+ # This API only allows the currently authenticated user to change their password; it cannot be used to apply to a
13
+ # different user than the one authenticating the current API call.
14
+ #
15
+ # @param PasswordChangeModel model An object containing your current password and the new password.
16
+ # @return string
17
+ def change_password(model)
18
+ path = "/api/v2/passwords"
19
+
20
+ put(path, model)
21
+ end
22
+
23
+
24
+ # Create a new account
25
+ #
26
+ # # For Registrar Use Only
27
+ # This API is for use by Avalara Registrar administrative users only.
28
+ #
29
+ # Create a single new account object.
30
+ # When creating an account object you may attach subscriptions and users as part of the 'Create' call.
31
+ #
32
+ # @param AccountModel model The account you wish to create.
33
+ # @return AccountModel
34
+ def create_account(model)
35
+ path = "/api/v2/accounts"
36
+
37
+ post(path, model)
38
+ end
39
+
40
+
41
+ # Create a new subscription
42
+ #
43
+ # # For Registrar Use Only
44
+ # This API is for use by Avalara Registrar administrative users only.
45
+ #
46
+ # Create one or more new subscription objects attached to this account.
47
+ # A 'subscription' indicates a licensed subscription to a named Avalara service.
48
+ # To request or remove subscriptions, please contact Avalara sales or your customer account manager.
49
+ #
50
+ # @param int accountId The ID of the account that owns this subscription.
51
+ # @param SubscriptionModel[] model The subscription you wish to create.
52
+ # @return SubscriptionModel[]
53
+ def create_subscriptions(accountId, model)
54
+ path = "/api/v2/accounts/#{accountId}/subscriptions"
55
+
56
+ post(path, model)
57
+ end
58
+
59
+
60
+ # Create new users
61
+ #
62
+ # # For Registrar Use Only
63
+ # This API is for use by Avalara Registrar administrative users only.
64
+ #
65
+ # Create one or more new user objects attached to this account.
66
+ # A user represents one person with access privileges to make API calls and work with a specific account.
67
+ #
68
+ # @param int accountId The unique ID number of the account where these users will be created.
69
+ # @param UserModel[] model The user or array of users you wish to create.
70
+ # @return UserModel[]
71
+ def create_users(accountId, model)
72
+ path = "/api/v2/accounts/#{accountId}/users"
73
+
74
+ post(path, model)
75
+ end
76
+
77
+
78
+ # Delete a single account
79
+ #
80
+ # # For Registrar Use Only
81
+ # This API is for use by Avalara Registrar administrative users only.
82
+ #
83
+ # Delete an account.
84
+ # Deleting an account will delete all companies and all account level users attached to this account.
85
+ #
86
+ # @param int id The ID of the account you wish to delete.
87
+ # @return ErrorDetail[]
88
+ def delete_account(id)
89
+ path = "/api/v2/accounts/#{id}"
90
+
91
+ delete(path)
92
+ end
93
+
94
+
95
+ # Delete a single subscription
96
+ #
97
+ # # For Registrar Use Only
98
+ # This API is for use by Avalara Registrar administrative users only.
99
+ #
100
+ # Mark the existing account identified by this URL as deleted.
101
+ #
102
+ # @param int accountId The ID of the account that owns this subscription.
103
+ # @param int id The ID of the subscription you wish to delete.
104
+ # @return ErrorDetail[]
105
+ def delete_subscription(accountId, id)
106
+ path = "/api/v2/accounts/#{accountId}/subscriptions/#{id}"
107
+
108
+ delete(path)
109
+ end
110
+
111
+
112
+ # Delete a single user
113
+ #
114
+ # # For Registrar Use Only
115
+ # This API is for use by Avalara Registrar administrative users only.
116
+ #
117
+ # Mark the user object identified by this URL as deleted.
118
+ #
119
+ # @param int id The ID of the user you wish to delete.
120
+ # @param int accountId The accountID of the user you wish to delete.
121
+ # @return ErrorDetail[]
122
+ def delete_user(id, accountId)
123
+ path = "/api/v2/accounts/#{accountId}/users/#{id}"
124
+
125
+ delete(path)
126
+ end
127
+
128
+
129
+ # Retrieve all accounts
130
+ #
131
+ # # For Registrar Use Only
132
+ # This API is for use by Avalara Registrar administrative users only.
133
+ #
134
+ # Get multiple account objects.
135
+ # 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/) .
136
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
137
+ # 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:
138
+ #
139
+ # * Subscriptions
140
+ # * Users
141
+ #
142
+ # For more information about filtering in REST, please see the documentation at http://developer.avalara.com/avatax/filtering-in-rest/ .
143
+ #
144
+ # @param string include A comma separated list of child objects to return underneath the primary object.
145
+ # @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/) .
146
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
147
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
148
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
149
+ # @return FetchResult
150
+ def query_accounts(options={})
151
+ path = "/api/v2/accounts"
152
+
153
+ get(path, options)
154
+ end
155
+
156
+
157
+ # Reset a user's password programmatically
158
+ #
159
+ # # For Registrar Use Only
160
+ # This API is for use by Avalara Registrar administrative users only.
161
+ #
162
+ # Allows a system admin to reset the password for a specific user via the API.
163
+ # This API is only available for Avalara Registrar Admins, and can be used to reset the password of any
164
+ # user based on internal Avalara business processes.
165
+ #
166
+ # @param int userId The unique ID of the user whose password will be changed
167
+ # @param SetPasswordModel model The new password for this user
168
+ # @return string
169
+ def reset_password(userId, model)
170
+ path = "/api/v2/passwords/#{userId}/reset"
171
+
172
+ post(path, model)
173
+ end
174
+
175
+
176
+ # Update a single account
177
+ #
178
+ # # For Registrar Use Only
179
+ # This API is for use by Avalara Registrar administrative users only.
180
+ #
181
+ # Replace an existing account object with an updated account object.
182
+ #
183
+ # @param int id The ID of the account you wish to update.
184
+ # @param AccountModel model The account object you wish to update.
185
+ # @return AccountModel
186
+ def update_account(id, model)
187
+ path = "/api/v2/accounts/#{id}"
188
+
189
+ put(path, model)
190
+ end
191
+
192
+
193
+ # Update a single subscription
194
+ #
195
+ # # For Registrar Use Only
196
+ # This API is for use by Avalara Registrar administrative users only.
197
+ #
198
+ # Replace the existing subscription object at this URL with an updated object.
199
+ # A 'subscription' indicates a licensed subscription to a named Avalara service.
200
+ # To request or remove subscriptions, please contact Avalara sales or your customer account manager.
201
+ # All data from the existing object will be replaced with data in the object you PUT.
202
+ # 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.
203
+ #
204
+ # @param int accountId The ID of the account that this subscription belongs to.
205
+ # @param int id The ID of the subscription you wish to update
206
+ # @param SubscriptionModel model The subscription you wish to update.
207
+ # @return SubscriptionModel
208
+ def update_subscription(accountId, id, model)
209
+ path = "/api/v2/accounts/#{accountId}/subscriptions/#{id}"
210
+
211
+ put(path, model)
212
+ end
213
+
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,137 @@
1
+ module AvaTax
2
+ class Client
3
+ module Settings
4
+
5
+
6
+ # Create a new setting
7
+ #
8
+ # Create one or more new setting objects attached to this company.
9
+ # A 'setting' is a piece of user-defined data that can be attached to a company, and it provides you the ability to store information
10
+ # not defined or managed by Avalara.
11
+ # You may create, update, and delete your own settings objects as required, and there is no mandatory data format for the 'name' and
12
+ # 'value' data fields.
13
+ # To ensure correct operation of other programs or connectors, please create a new GUID for your application and use that value for
14
+ # the 'set' data field.
15
+ #
16
+ # @param int companyId The ID of the company that owns this setting.
17
+ # @param SettingModel[] model The setting you wish to create.
18
+ # @return SettingModel[]
19
+ def create_settings(companyId, model)
20
+ path = "/api/v2/companies/#{companyId}/settings"
21
+
22
+ post(path, model)
23
+ end
24
+
25
+
26
+ # Delete a single setting
27
+ #
28
+ # Mark the setting object at this URL as deleted.
29
+ #
30
+ # @param int companyId The ID of the company that owns this setting.
31
+ # @param int id The ID of the setting you wish to delete.
32
+ # @return ErrorDetail[]
33
+ def delete_setting(companyId, id)
34
+ path = "/api/v2/companies/#{companyId}/settings/#{id}"
35
+
36
+ delete(path)
37
+ end
38
+
39
+
40
+ # Retrieve a single setting
41
+ #
42
+ # Get a single setting object by its unique ID.
43
+ # A 'setting' is a piece of user-defined data that can be attached to a company, and it provides you the ability to store information
44
+ # not defined or managed by Avalara.
45
+ # You may create, update, and delete your own settings objects as required, and there is no mandatory data format for the 'name' and
46
+ # 'value' data fields.
47
+ # To ensure correct operation of other programs or connectors, please create a new GUID for your application and use that value for
48
+ # the 'set' data field.
49
+ #
50
+ # @param int companyId The ID of the company that owns this setting
51
+ # @param int id The primary key of this setting
52
+ # @return SettingModel
53
+ def get_setting(companyId, id)
54
+ path = "/api/v2/companies/#{companyId}/settings/#{id}"
55
+
56
+ get(path)
57
+ end
58
+
59
+
60
+ # Retrieve all settings for this company
61
+ #
62
+ # List all setting objects attached to this company.
63
+ # A 'setting' is a piece of user-defined data that can be attached to a company, and it provides you the ability to store information
64
+ # not defined or managed by Avalara.
65
+ # You may create, update, and delete your own settings objects as required, and there is no mandatory data format for the 'name' and
66
+ # 'value' data fields.
67
+ # To ensure correct operation of other programs or connectors, please create a new GUID for your application and use that value for
68
+ # the 'set' data field.
69
+ #
70
+ # 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/) .
71
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
72
+ #
73
+ # @param int companyId The ID of the company that owns these settings
74
+ # @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/) .
75
+ # @param string include A comma separated list of child objects to return underneath the primary object.
76
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
77
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
78
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
79
+ # @return FetchResult
80
+ def list_settings_by_company(companyId, options={})
81
+ path = "/api/v2/companies/#{companyId}/settings"
82
+
83
+ get(path, options)
84
+ end
85
+
86
+
87
+ # Retrieve all settings
88
+ #
89
+ # Get multiple setting objects across all companies.
90
+ # A 'setting' is a piece of user-defined data that can be attached to a company, and it provides you the ability to store information
91
+ # not defined or managed by Avalara.
92
+ # You may create, update, and delete your own settings objects as required, and there is no mandatory data format for the 'name' and
93
+ # 'value' data fields.
94
+ # To ensure correct operation of other programs or connectors, please create a new GUID for your application and use that value for
95
+ # the 'set' data field.
96
+ #
97
+ # 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/) .
98
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
99
+ #
100
+ # @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/) .
101
+ # @param string include A comma separated list of child objects to return underneath the primary object.
102
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
103
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
104
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
105
+ # @return FetchResult
106
+ def query_settings(options={})
107
+ path = "/api/v2/settings"
108
+
109
+ get(path, options)
110
+ end
111
+
112
+
113
+ # Update a single setting
114
+ #
115
+ # Replace the existing setting object at this URL with an updated object.
116
+ # A 'setting' is a piece of user-defined data that can be attached to a company, and it provides you the ability to store information
117
+ # not defined or managed by Avalara.
118
+ # You may create, update, and delete your own settings objects as required, and there is no mandatory data format for the 'name' and
119
+ # 'value' data fields.
120
+ # To ensure correct operation of other programs or connectors, please create a new GUID for your application and use that value for
121
+ # the 'set' data field.
122
+ # All data from the existing object will be replaced with data in the object you PUT.
123
+ # 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.
124
+ #
125
+ # @param int companyId The ID of the company that this setting belongs to.
126
+ # @param int id The ID of the setting you wish to update
127
+ # @param SettingModel model The setting you wish to update.
128
+ # @return SettingModel
129
+ def update_setting(companyId, id, model)
130
+ path = "/api/v2/companies/#{companyId}/settings/#{id}"
131
+
132
+ put(path, model)
133
+ end
134
+
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,66 @@
1
+ module AvaTax
2
+ class Client
3
+ module Subscriptions
4
+
5
+
6
+ # Retrieve a single subscription
7
+ #
8
+ # Get the subscription object identified by this URL.
9
+ # A 'subscription' indicates a licensed subscription to a named Avalara service.
10
+ # To request or remove subscriptions, please contact Avalara sales or your customer account manager.
11
+ #
12
+ # @param int accountId The ID of the account that owns this subscription
13
+ # @param int id The primary key of this subscription
14
+ # @return SubscriptionModel
15
+ def get_subscription(accountId, id)
16
+ path = "/api/v2/accounts/#{accountId}/subscriptions/#{id}"
17
+
18
+ get(path)
19
+ end
20
+
21
+
22
+ # Retrieve subscriptions for this account
23
+ #
24
+ # List all subscription objects attached to this account.
25
+ # A 'subscription' indicates a licensed subscription to a named Avalara service.
26
+ # To request or remove subscriptions, please contact Avalara sales or your customer account manager.
27
+ #
28
+ # 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/) .
29
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
30
+ #
31
+ # @param int accountId The ID of the account that owns these subscriptions
32
+ # @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/) .
33
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
34
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
35
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
36
+ # @return FetchResult
37
+ def list_subscriptions_by_account(accountId, options={})
38
+ path = "/api/v2/accounts/#{accountId}/subscriptions"
39
+
40
+ get(path, options)
41
+ end
42
+
43
+
44
+ # Retrieve all subscriptions
45
+ #
46
+ # Get multiple subscription objects across all accounts.
47
+ # A 'subscription' indicates a licensed subscription to a named Avalara service.
48
+ # To request or remove subscriptions, please contact Avalara sales or your customer account manager.
49
+ #
50
+ # 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/) .
51
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
52
+ #
53
+ # @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/) .
54
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
55
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
56
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
57
+ # @return FetchResult
58
+ def query_subscriptions(options={})
59
+ path = "/api/v2/subscriptions"
60
+
61
+ get(path, options)
62
+ end
63
+
64
+ end
65
+ end
66
+ end