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,569 @@
1
+ module AvaTax
2
+ class Client
3
+ module Definitions
4
+
5
+
6
+ # Retrieve the full list of Avalara-supported nexus for a country and region.
7
+ #
8
+ # Returns all Avalara-supported nexus for the specified country and region.
9
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by country and region.
10
+ #
11
+ # @param string country The two-character ISO-3166 code for the country.
12
+ # @param string region The two or three character region code for the region.
13
+ # @return FetchResult
14
+ def api_v2_definitions_nexus_by_country_by_region_get(country, region)
15
+ path = "/api/v2/definitions/nexus/#{country}/#{region}"
16
+
17
+ get(path)
18
+ end
19
+
20
+
21
+ # Retrieve the full list of Avalara-supported nexus for a country.
22
+ #
23
+ # Returns all Avalara-supported nexus for the specified country.
24
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by country.
25
+ #
26
+ # @param string country
27
+ # @return FetchResult
28
+ def api_v2_definitions_nexus_by_country_get(country)
29
+ path = "/api/v2/definitions/nexus/#{country}"
30
+
31
+ get(path)
32
+ end
33
+
34
+
35
+ # Retrieve the full list of Avalara-supported nexus for all countries and regions.
36
+ #
37
+ # Returns the full list of all Avalara-supported nexus for all countries and regions.
38
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus.
39
+ #
40
+ # @return FetchResult
41
+ def api_v2_definitions_nexus_get()
42
+ path = "/api/v2/definitions/nexus"
43
+
44
+ get(path)
45
+ end
46
+
47
+
48
+ # Test whether a form supports online login verification
49
+ #
50
+ # This API is intended to be useful to identify whether the user should be allowed
51
+ # to automatically verify their login and password.
52
+ #
53
+ # @param string form The name of the form you would like to verify. This can be the tax form code or the legacy return name
54
+ # @return FetchResult
55
+ def get_login_verifier_by_form(form)
56
+ path = "/api/v2/definitions/filingcalendars/loginverifiers/#{form}"
57
+
58
+ get(path)
59
+ end
60
+
61
+
62
+ # Retrieve the full list of the AvaFile Forms available
63
+ #
64
+ # Returns the full list of Avalara-supported AvaFile Forms
65
+ # This API is intended to be useful to identify all the different AvaFile Forms
66
+ #
67
+ # @return FetchResult
68
+ def list_ava_file_forms()
69
+ path = "/api/v2/definitions/avafileforms"
70
+
71
+ get(path)
72
+ end
73
+
74
+
75
+ # List all ISO 3166 countries
76
+ #
77
+ # Returns a list of all ISO 3166 country codes, and their US English friendly names.
78
+ # This API is intended to be useful when presenting a dropdown box in your website to allow customers to select a country for
79
+ # a shipping address.
80
+ #
81
+ # @return FetchResult
82
+ def list_countries()
83
+ path = "/api/v2/definitions/countries"
84
+
85
+ get(path)
86
+ end
87
+
88
+
89
+ # Retrieve the full list of Avalara-supported entity use codes
90
+ #
91
+ # Returns the full list of Avalara-supported entity use codes.
92
+ # Entity/Use Codes are definitions of the entity who is purchasing something, or the purpose for which the transaction
93
+ # is occurring. This information is generally used to determine taxability of the product.
94
+ # In order to facilitate correct reporting of your taxes, you are encouraged to select the proper entity use codes for
95
+ # all transactions that are exempt.
96
+ #
97
+ # @return FetchResult
98
+ def list_entity_use_codes()
99
+ path = "/api/v2/definitions/entityusecodes"
100
+
101
+ get(path)
102
+ end
103
+
104
+
105
+ # Retrieve the full list of Avalara-supported filing frequencies.
106
+ #
107
+ # Returns the full list of Avalara-supported filing frequencies.
108
+ # This API is intended to be useful to identify all the different filing frequencies that can be used in notices.
109
+ #
110
+ # @return FetchResult
111
+ def list_filing_frequencies()
112
+ path = "/api/v2/definitions/filingfrequencies"
113
+
114
+ get(path)
115
+ end
116
+
117
+
118
+ # List jurisdictions near a specific address
119
+ #
120
+ # Returns a list of all Avalara-supported taxing jurisdictions that apply to this address.
121
+ #
122
+ # This API allows you to identify which jurisdictions are nearby a specific address according to the best available geocoding information.
123
+ # It is intended to allow you to create a "Jurisdiction Override", which allows an address to be configured as belonging to a nearby
124
+ # jurisdiction in AvaTax.
125
+ #
126
+ # The results of this API call can be passed to the `CreateJurisdictionOverride` API call.
127
+ #
128
+ # @param string line1 The first address line portion of this address.
129
+ # @param string line2 The second address line portion of this address.
130
+ # @param string line3 The third address line portion of this address.
131
+ # @param string city The city portion of this address.
132
+ # @param string region The region, state, or province code portion of this address.
133
+ # @param string postalCode The postal code or zip code portion of this address.
134
+ # @param string country The two-character ISO-3166 code of the country portion of this address.
135
+ # @return FetchResult
136
+ def list_jurisdictions_by_address(options={})
137
+ path = "/api/v2/definitions/jurisdictionsnearaddress"
138
+
139
+ get(path, options)
140
+ end
141
+
142
+
143
+ # Retrieve the list of questions that are required for a tax location
144
+ #
145
+ # Returns the list of additional questions you must answer when declaring a location in certain taxing jurisdictions.
146
+ # Some tax jurisdictions require that you register or provide additional information to configure each physical place where
147
+ # your company does business.
148
+ # This information is not usually required in order to calculate tax correctly, but is almost always required to file your tax correctly.
149
+ # You can call this API call for any address and obtain information about what questions must be answered in order to properly
150
+ # file tax in that location.
151
+ #
152
+ # @param string line1 The first line of this location's address.
153
+ # @param string line2 The second line of this location's address.
154
+ # @param string line3 The third line of this location's address.
155
+ # @param string city The city part of this location's address.
156
+ # @param string region The region, state, or province part of this location's address.
157
+ # @param string postalCode The postal code of this location's address.
158
+ # @param string country The country part of this location's address.
159
+ # @param float latitude Optionally identify the location via latitude/longitude instead of via address.
160
+ # @param float longitude Optionally identify the location via latitude/longitude instead of via address.
161
+ # @return FetchResult
162
+ def list_location_questions_by_address(options={})
163
+ path = "/api/v2/definitions/locationquestions"
164
+
165
+ get(path, options)
166
+ end
167
+
168
+
169
+ # List all forms where logins can be verified automatically
170
+ #
171
+ # List all forms where logins can be verified automatically.
172
+ # This API is intended to be useful to identify whether the user should be allowed
173
+ # to automatically verify their login and password.
174
+ #
175
+ # @return FetchResult
176
+ def list_login_verifiers()
177
+ path = "/api/v2/definitions/filingcalendars/loginverifiers"
178
+
179
+ get(path)
180
+ end
181
+
182
+
183
+ # List all nexus that apply to a specific address.
184
+ #
185
+ # Returns a list of all Avalara-supported taxing jurisdictions that apply to this address.
186
+ # This API allows you to identify which tax authorities apply to a physical location, salesperson address, or point of sale.
187
+ # In general, it is usually expected that a company will declare nexus in all the jurisdictions that apply to each physical address
188
+ # where the company does business.
189
+ # The results of this API call can be passed to the 'Create Nexus' API call to declare nexus for this address.
190
+ #
191
+ # @param string line1 The first address line portion of this address.
192
+ # @param string line2 The first address line portion of this address.
193
+ # @param string line3 The first address line portion of this address.
194
+ # @param string city The city portion of this address.
195
+ # @param string region The region, state, or province code portion of this address.
196
+ # @param string postalCode The postal code or zip code portion of this address.
197
+ # @param string country The two-character ISO-3166 code of the country portion of this address.
198
+ # @return FetchResult
199
+ def list_nexus_by_address(options={})
200
+ path = "/api/v2/definitions/nexus/byaddress"
201
+
202
+ get(path, options)
203
+ end
204
+
205
+
206
+ # List nexus related to a tax form
207
+ #
208
+ # Retrieves a list of nexus related to a tax form.
209
+ #
210
+ # The concept of `Nexus` indicates a place where your company has sufficient physical presence and is obligated
211
+ # to collect and remit transaction-based taxes.
212
+ #
213
+ # When defining companies in AvaTax, you must declare nexus for your company in order to correctly calculate tax
214
+ # in all jurisdictions affected by your transactions.
215
+ #
216
+ # This API is intended to provide useful information when examining a tax form. If you are about to begin filing
217
+ # a tax form, you may want to know whether you have declared nexus in all the jurisdictions related to that tax
218
+ # form in order to better understand how the form will be filled out.
219
+ #
220
+ # @param string formCode The form code that we are looking up the nexus for
221
+ # @return NexusByTaxFormModel
222
+ def list_nexus_by_form_code(formCode)
223
+ path = "/api/v2/definitions/nexus/byform/#{formCode}"
224
+
225
+ get(path)
226
+ end
227
+
228
+
229
+ # Retrieve the full list of nexus tax type groups
230
+ #
231
+ # Returns the full list of Avalara-supported nexus tax type groups
232
+ # This API is intended to be useful to identify all the different tax sub-types.
233
+ #
234
+ # @return FetchResult
235
+ def list_nexus_tax_type_groups()
236
+ path = "/api/v2/definitions/nexustaxtypegroups"
237
+
238
+ get(path)
239
+ end
240
+
241
+
242
+ # Retrieve the full list of Avalara-supported tax notice customer funding options.
243
+ #
244
+ # Returns the full list of Avalara-supported tax notice customer funding options.
245
+ # This API is intended to be useful to identify all the different notice customer funding options that can be used in notices.
246
+ #
247
+ # @return FetchResult
248
+ def list_notice_customer_funding_options()
249
+ path = "/api/v2/definitions/noticecustomerfundingoptions"
250
+
251
+ get(path)
252
+ end
253
+
254
+
255
+ # Retrieve the full list of Avalara-supported tax notice customer types.
256
+ #
257
+ # Returns the full list of Avalara-supported tax notice customer types.
258
+ # This API is intended to be useful to identify all the different notice customer types.
259
+ #
260
+ # @return FetchResult
261
+ def list_notice_customer_types()
262
+ path = "/api/v2/definitions/noticecustomertypes"
263
+
264
+ get(path)
265
+ end
266
+
267
+
268
+ # Retrieve the full list of Avalara-supported tax notice filing types.
269
+ #
270
+ # Returns the full list of Avalara-supported tax notice filing types.
271
+ # This API is intended to be useful to identify all the different notice filing types that can be used in notices.
272
+ #
273
+ # @return FetchResult
274
+ def list_notice_filingtypes()
275
+ path = "/api/v2/definitions/noticefilingtypes"
276
+
277
+ get(path)
278
+ end
279
+
280
+
281
+ # Retrieve the full list of Avalara-supported tax notice priorities.
282
+ #
283
+ # Returns the full list of Avalara-supported tax notice priorities.
284
+ # This API is intended to be useful to identify all the different notice priorities that can be used in notices.
285
+ #
286
+ # @return FetchResult
287
+ def list_notice_priorities()
288
+ path = "/api/v2/definitions/noticepriorities"
289
+
290
+ get(path)
291
+ end
292
+
293
+
294
+ # Retrieve the full list of Avalara-supported tax notice reasons.
295
+ #
296
+ # Returns the full list of Avalara-supported tax notice reasons.
297
+ # This API is intended to be useful to identify all the different tax notice reasons.
298
+ #
299
+ # @return FetchResult
300
+ def list_notice_reasons()
301
+ path = "/api/v2/definitions/noticereasons"
302
+
303
+ get(path)
304
+ end
305
+
306
+
307
+ # Retrieve the full list of Avalara-supported tax notice responsibility ids
308
+ #
309
+ # Returns the full list of Avalara-supported tax notice responsibility ids
310
+ # This API is intended to be useful to identify all the different tax notice responsibilities.
311
+ #
312
+ # @return FetchResult
313
+ def list_notice_responsibilities()
314
+ path = "/api/v2/definitions/noticeresponsibilities"
315
+
316
+ get(path)
317
+ end
318
+
319
+
320
+ # Retrieve the full list of Avalara-supported tax notice root causes
321
+ #
322
+ # Returns the full list of Avalara-supported tax notice root causes
323
+ # This API is intended to be useful to identify all the different tax notice root causes.
324
+ #
325
+ # @return FetchResult
326
+ def list_notice_root_causes()
327
+ path = "/api/v2/definitions/noticerootcauses"
328
+
329
+ get(path)
330
+ end
331
+
332
+
333
+ # Retrieve the full list of Avalara-supported tax notice statuses.
334
+ #
335
+ # Returns the full list of Avalara-supported tax notice statuses.
336
+ # This API is intended to be useful to identify all the different tax notice statuses.
337
+ #
338
+ # @return FetchResult
339
+ def list_notice_statuses()
340
+ path = "/api/v2/definitions/noticestatuses"
341
+
342
+ get(path)
343
+ end
344
+
345
+
346
+ # Retrieve the full list of Avalara-supported tax notice types.
347
+ #
348
+ # Returns the full list of Avalara-supported tax notice types.
349
+ # This API is intended to be useful to identify all the different notice types that can be used in notices.
350
+ #
351
+ # @return FetchResult
352
+ def list_notice_types()
353
+ path = "/api/v2/definitions/noticetypes"
354
+
355
+ get(path)
356
+ end
357
+
358
+
359
+ # Retrieve the full list of Avalara-supported extra parameters for creating transactions.
360
+ #
361
+ # Returns the full list of Avalara-supported extra parameters for the 'Create Transaction' API call.
362
+ # This list of parameters is available for use when configuring your transaction.
363
+ # Some parameters are only available for use if you have subscribed to certain features of AvaTax.
364
+ #
365
+ # @return FetchResult
366
+ def list_parameters()
367
+ path = "/api/v2/definitions/parameters"
368
+
369
+ get(path)
370
+ end
371
+
372
+
373
+ # Retrieve the full list of Avalara-supported permissions
374
+ #
375
+ # Returns the full list of Avalara-supported permission types.
376
+ # This API is intended to be useful to identify the capabilities of a particular user logon.
377
+ #
378
+ # @return FetchResult
379
+ def list_permissions()
380
+ path = "/api/v2/definitions/permissions"
381
+
382
+ get(path)
383
+ end
384
+
385
+
386
+ # Retrieve the full list of rate types for each country
387
+ #
388
+ # Returns the full list of Avalara-supported rate type file types
389
+ # This API is intended to be useful to identify all the different rate types.
390
+ #
391
+ # @param string country
392
+ # @return FetchResult
393
+ def list_rate_types_by_country(country)
394
+ path = "/api/v2/definitions/countries/#{country}/ratetypes"
395
+
396
+ get(path)
397
+ end
398
+
399
+
400
+ # List all ISO 3166 regions
401
+ #
402
+ # Returns a list of all ISO 3166 region codes and their US English friendly names.
403
+ # This API is intended to be useful when presenting a dropdown box in your website to allow customers to select a region
404
+ # within the country for a shipping addresses.
405
+ #
406
+ # @return FetchResult
407
+ def list_regions()
408
+ path = "/api/v2/definitions/regions"
409
+
410
+ get(path)
411
+ end
412
+
413
+
414
+ # List all ISO 3166 regions for a country
415
+ #
416
+ # Returns a list of all ISO 3166 region codes for a specific country code, and their US English friendly names.
417
+ # This API is intended to be useful when presenting a dropdown box in your website to allow customers to select a region
418
+ # within the country for a shipping addresses.
419
+ #
420
+ # @param string country
421
+ # @return FetchResult
422
+ def list_regions_by_country(country)
423
+ path = "/api/v2/definitions/countries/#{country}/regions"
424
+
425
+ get(path)
426
+ end
427
+
428
+
429
+ # Retrieve the full list of Avalara-supported resource file types
430
+ #
431
+ # Returns the full list of Avalara-supported resource file types
432
+ # This API is intended to be useful to identify all the different resource file types.
433
+ #
434
+ # @return FetchResult
435
+ def list_resource_file_types()
436
+ path = "/api/v2/definitions/resourcefiletypes"
437
+
438
+ get(path)
439
+ end
440
+
441
+
442
+ # Retrieve the full list of Avalara-supported permissions
443
+ #
444
+ # Returns the full list of Avalara-supported permission types.
445
+ # This API is intended to be useful when designing a user interface for selecting the security role of a user account.
446
+ # Some security roles are restricted for Avalara internal use.
447
+ #
448
+ # @return FetchResult
449
+ def list_security_roles()
450
+ path = "/api/v2/definitions/securityroles"
451
+
452
+ get(path)
453
+ end
454
+
455
+
456
+ # Retrieve the full list of Avalara-supported subscription types
457
+ #
458
+ # Returns the full list of Avalara-supported subscription types.
459
+ # This API is intended to be useful for identifying which features you have added to your account.
460
+ # You may always contact Avalara's sales department for information on available products or services.
461
+ # You cannot change your subscriptions directly through the API.
462
+ #
463
+ # @return FetchResult
464
+ def list_subscription_types()
465
+ path = "/api/v2/definitions/subscriptiontypes"
466
+
467
+ get(path)
468
+ end
469
+
470
+
471
+ # Retrieve the full list of Avalara-supported tax authorities.
472
+ #
473
+ # Returns the full list of Avalara-supported tax authorities.
474
+ # This API is intended to be useful to identify all the different authorities that receive tax.
475
+ #
476
+ # @return FetchResult
477
+ def list_tax_authorities()
478
+ path = "/api/v2/definitions/taxauthorities"
479
+
480
+ get(path)
481
+ end
482
+
483
+
484
+ # Retrieve the full list of Avalara-supported forms for each tax authority.
485
+ #
486
+ # Returns the full list of Avalara-supported forms for each tax authority.
487
+ # This list represents tax forms that Avalara recognizes.
488
+ # Customers who subscribe to Avalara Managed Returns Service can request these forms to be filed automatically
489
+ # based on the customer's AvaTax data.
490
+ #
491
+ # @return FetchResult
492
+ def list_tax_authority_forms()
493
+ path = "/api/v2/definitions/taxauthorityforms"
494
+
495
+ get(path)
496
+ end
497
+
498
+
499
+ # Retrieve the full list of Avalara-supported tax authority types.
500
+ #
501
+ # Returns the full list of Avalara-supported tax authority types.
502
+ # This API is intended to be useful to identify all the different authority types.
503
+ #
504
+ # @return FetchResult
505
+ def list_tax_authority_types()
506
+ path = "/api/v2/definitions/taxauthoritytypes"
507
+
508
+ get(path)
509
+ end
510
+
511
+
512
+ # Retrieve the full list of Avalara-supported tax codes.
513
+ #
514
+ # Retrieves the list of Avalara-supported system tax codes.
515
+ # A 'TaxCode' represents a uniquely identified type of product, good, or service.
516
+ # Avalara supports correct tax rates and taxability rules for all TaxCodes in all supported jurisdictions.
517
+ # If you identify your products by tax code in your 'Create Transacion' API calls, Avalara will correctly calculate tax rates and
518
+ # taxability rules for this product in all supported jurisdictions.
519
+ #
520
+ # @return FetchResult
521
+ def list_tax_codes()
522
+ path = "/api/v2/definitions/taxcodes"
523
+
524
+ get(path)
525
+ end
526
+
527
+
528
+ # Retrieve the full list of Avalara-supported tax code types.
529
+ #
530
+ # Returns the full list of recognized tax code types.
531
+ # A 'Tax Code Type' represents a broad category of tax codes, and is less detailed than a single TaxCode.
532
+ # This API is intended to be useful for broadly searching for tax codes by tax code type.
533
+ #
534
+ # @return TaxCodeTypesModel
535
+ def list_tax_code_types()
536
+ path = "/api/v2/definitions/taxcodetypes"
537
+
538
+ get(path)
539
+ end
540
+
541
+
542
+ # Retrieve the full list of tax sub types
543
+ #
544
+ # Returns the full list of Avalara-supported tax sub-types
545
+ # This API is intended to be useful to identify all the different tax sub-types.
546
+ #
547
+ # @return FetchResult
548
+ def list_tax_sub_types()
549
+ path = "/api/v2/definitions/taxsubtypes"
550
+
551
+ get(path)
552
+ end
553
+
554
+
555
+ # Retrieve the full list of tax type groups
556
+ #
557
+ # Returns the full list of Avalara-supported tax type groups
558
+ # This API is intended to be useful to identify all the different tax type groups.
559
+ #
560
+ # @return FetchResult
561
+ def list_tax_type_groups()
562
+ path = "/api/v2/definitions/taxtypegroups"
563
+
564
+ get(path)
565
+ end
566
+
567
+ end
568
+ end
569
+ end