avalara_sdk 25.6.0 → 25.7.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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -3
  3. data/docs/A1099/V2/BulkUpsert1099FormsRequest.md +3 -1
  4. data/docs/A1099/V2/CompaniesW9Api.md +45 -31
  5. data/docs/A1099/V2/CoveredIndividualReference.md +58 -0
  6. data/docs/A1099/V2/CoveredIndividualRequest.md +54 -0
  7. data/docs/A1099/V2/Form1095B.md +86 -0
  8. data/docs/A1099/V2/Form1095BList.md +20 -0
  9. data/docs/A1099/V2/Form1095BListItem.md +74 -0
  10. data/docs/A1099/V2/Form1095BRequest.md +76 -0
  11. data/docs/A1099/V2/Form1099Base.md +8 -8
  12. data/docs/A1099/V2/Form1099DivListItem.md +11 -11
  13. data/docs/A1099/V2/Form1099DivRequest.md +11 -17
  14. data/docs/A1099/V2/Form1099DivResponse.md +88 -0
  15. data/docs/A1099/V2/Form1099K.md +8 -8
  16. data/docs/A1099/V2/Form1099KListItem.md +11 -11
  17. data/docs/A1099/V2/Form1099KRequest.md +11 -17
  18. data/docs/A1099/V2/Form1099List.md +1 -1
  19. data/docs/A1099/V2/Form1099ListDataInner.md +32 -0
  20. data/docs/A1099/V2/Form1099Misc.md +8 -8
  21. data/docs/A1099/V2/Form1099MiscListItem.md +11 -11
  22. data/docs/A1099/V2/Form1099MiscRequest.md +11 -17
  23. data/docs/A1099/V2/Form1099MiscResponse.md +120 -0
  24. data/docs/A1099/V2/Form1099Nec.md +8 -8
  25. data/docs/A1099/V2/Form1099NecListItem.md +11 -11
  26. data/docs/A1099/V2/Form1099NecRequest.md +11 -17
  27. data/docs/A1099/V2/Form1099NecResponse.md +96 -0
  28. data/docs/A1099/V2/Form1099R.md +8 -8
  29. data/docs/A1099/V2/Form1099RListItem.md +11 -11
  30. data/docs/A1099/V2/Form1099RRequest.md +11 -17
  31. data/docs/A1099/V2/FormRequestBase.md +9 -13
  32. data/docs/A1099/V2/FormRequestCsvBase.md +66 -0
  33. data/docs/A1099/V2/FormResponseBase.md +43 -9
  34. data/docs/A1099/V2/FormSingleRequestBase.md +11 -15
  35. data/docs/A1099/V2/Forms1099Api.md +75 -57
  36. data/docs/A1099/V2/FormsW9Api.md +63 -123
  37. data/docs/A1099/V2/Get1099Form200Response.md +55 -0
  38. data/docs/A1099/V2/IncludedBase.md +20 -0
  39. data/docs/A1099/V2/Issuers1099Api.md +45 -31
  40. data/docs/A1099/V2/Jobs1099Api.md +10 -6
  41. data/docs/A1099/V2/StateAndLocalWithholdingResponse.md +32 -0
  42. data/docs/A1099/V2/StateEfileStatusDetail.md +1 -1
  43. data/docs/A1099/V2/StateEfileStatusDetailApp.md +22 -0
  44. data/docs/A1099/V2/StatusDetail.md +20 -0
  45. data/docs/A1099/V2/Update1099Form200Response.md +53 -0
  46. data/docs/A1099/V2/ValidationErrorApp.md +20 -0
  47. data/docs/EInvoicing/V1/DataInputFieldsApi.md +4 -4
  48. data/docs/EInvoicing/V1/DocumentsApi.md +2 -2
  49. data/docs/EInvoicing/V1/MandatesApi.md +4 -4
  50. data/docs/EInvoicing/V1/SubscriptionsApi.md +4 -4
  51. data/docs/EInvoicing/V1/TradingPartnersApi.md +4 -4
  52. data/lib/avalara_sdk/api/A1099/V2/companies_w9_api.rb +103 -43
  53. data/lib/avalara_sdk/api/A1099/V2/forms1099_api.rb +171 -87
  54. data/lib/avalara_sdk/api/A1099/V2/forms_w9_api.rb +135 -176
  55. data/lib/avalara_sdk/api/A1099/V2/issuers1099_api.rb +103 -43
  56. data/lib/avalara_sdk/api/A1099/V2/jobs1099_api.rb +19 -7
  57. data/lib/avalara_sdk/api/EInvoicing/V1/data_input_fields_api.rb +6 -6
  58. data/lib/avalara_sdk/api/EInvoicing/V1/documents_api.rb +4 -4
  59. data/lib/avalara_sdk/api/EInvoicing/V1/interop_api.rb +1 -1
  60. data/lib/avalara_sdk/api/EInvoicing/V1/mandates_api.rb +6 -6
  61. data/lib/avalara_sdk/api/EInvoicing/V1/subscriptions_api.rb +6 -6
  62. data/lib/avalara_sdk/api/EInvoicing/V1/trading_partners_api.rb +7 -7
  63. data/lib/avalara_sdk/models/A1099/V2/bulk_upsert1099_forms_request.rb +1 -0
  64. data/lib/avalara_sdk/models/A1099/V2/covered_individual_reference.rb +403 -0
  65. data/lib/avalara_sdk/models/A1099/V2/covered_individual_request.rb +378 -0
  66. data/lib/avalara_sdk/models/A1099/V2/form1095_b.rb +572 -0
  67. data/lib/avalara_sdk/models/A1099/V2/form1095_b_list.rb +238 -0
  68. data/lib/avalara_sdk/models/A1099/V2/form1095_b_list_item.rb +538 -0
  69. data/lib/avalara_sdk/models/A1099/V2/form1095_b_request.rb +559 -0
  70. data/lib/avalara_sdk/models/A1099/V2/form1099_base.rb +29 -29
  71. data/lib/avalara_sdk/models/A1099/V2/form1099_div_list_item.rb +78 -36
  72. data/lib/avalara_sdk/models/A1099/V2/form1099_div_request.rb +80 -53
  73. data/lib/avalara_sdk/models/A1099/V2/form1099_div_response.rb +600 -0
  74. data/lib/avalara_sdk/models/A1099/V2/form1099_k.rb +29 -29
  75. data/lib/avalara_sdk/models/A1099/V2/form1099_k_list_item.rb +56 -37
  76. data/lib/avalara_sdk/models/A1099/V2/form1099_k_request.rb +80 -54
  77. data/lib/avalara_sdk/models/A1099/V2/form1099_list.rb +1 -1
  78. data/lib/avalara_sdk/models/A1099/V2/form1099_list_data_inner.rb +20 -68
  79. data/lib/avalara_sdk/models/A1099/V2/form1099_misc.rb +29 -29
  80. data/lib/avalara_sdk/models/A1099/V2/form1099_misc_list_item.rb +78 -36
  81. data/lib/avalara_sdk/models/A1099/V2/form1099_misc_request.rb +80 -53
  82. data/lib/avalara_sdk/models/A1099/V2/form1099_misc_response.rb +744 -0
  83. data/lib/avalara_sdk/models/A1099/V2/form1099_nec.rb +29 -29
  84. data/lib/avalara_sdk/models/A1099/V2/form1099_nec_list_item.rb +78 -36
  85. data/lib/avalara_sdk/models/A1099/V2/form1099_nec_request.rb +80 -53
  86. data/lib/avalara_sdk/models/A1099/V2/form1099_nec_response.rb +636 -0
  87. data/lib/avalara_sdk/models/A1099/V2/form1099_r.rb +29 -29
  88. data/lib/avalara_sdk/models/A1099/V2/form1099_r_list_item.rb +56 -36
  89. data/lib/avalara_sdk/models/A1099/V2/form1099_r_request.rb +80 -53
  90. data/lib/avalara_sdk/models/A1099/V2/form_request_base.rb +68 -44
  91. data/lib/avalara_sdk/models/A1099/V2/form_request_csv_base.rb +475 -0
  92. data/lib/avalara_sdk/models/A1099/V2/form_response_base.rb +252 -31
  93. data/lib/avalara_sdk/models/A1099/V2/form_single_request_base.rb +80 -44
  94. data/lib/avalara_sdk/models/A1099/V2/get1099_form200_response.rb +104 -0
  95. data/lib/avalara_sdk/models/A1099/V2/included_base.rb +219 -0
  96. data/lib/avalara_sdk/models/A1099/V2/state_and_local_withholding_request.rb +1 -0
  97. data/lib/avalara_sdk/models/A1099/V2/state_and_local_withholding_response.rb +274 -0
  98. data/lib/avalara_sdk/models/A1099/V2/state_efile_status_detail_app.rb +231 -0
  99. data/lib/avalara_sdk/models/A1099/V2/status_detail.rb +221 -0
  100. data/lib/avalara_sdk/models/A1099/V2/update1099_form200_response.rb +103 -0
  101. data/lib/avalara_sdk/models/A1099/V2/validation_error_app.rb +229 -0
  102. data/lib/avalara_sdk/version.rb +1 -1
  103. data/lib/avalara_sdk.rb +17 -0
  104. data/spec/integration/a1099_spec.rb +12 -12
  105. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/byebug-11.1.3/gem_make.out +5 -5
  106. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/date-3.4.1/gem_make.out +5 -5
  107. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/debase-0.2.9/gem_make.out +5 -5
  108. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/debug-1.10.0/gem_make.out +5 -5
  109. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/erb-5.0.1/gem_make.out +5 -5
  110. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-console-0.8.0/gem_make.out +5 -5
  111. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-2.12.2/gem_make.out +5 -5
  112. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.4.0/gem_make.out +5 -5
  113. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/psych-5.2.6/gem_make.out +5 -5
  114. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out +5 -5
  115. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/stringio-3.1.7/gem_make.out +5 -5
  116. metadata +36 -2
@@ -0,0 +1,475 @@
1
+ =begin
2
+ #Avalara 1099 & W-9 API Definition
3
+
4
+ ### 🔐 Authentication Use **username/password** or generate a **license key** from: *Avalara Portal → Settings → License and API Keys*. [More on authentication methods](https://developer.avalara.com/avatax-dm-combined-erp/common-setup/authentication/authentication-methods/) [Test your credentials](https://developer.avalara.com/avatax/test-credentials/) ## 📘 API & SDK Documentation [Avalara SDK (.NET) on GitHub](https://github.com/avadev/Avalara-SDK-DotNet#avalarasdk--the-unified-c-library-for-next-gen-avalara-services) [Code Examples – 1099 API](https://github.com/avadev/Avalara-SDK-DotNet/blob/main/docs/A1099/V2/Class1099IssuersApi.md#call1099issuersget)
5
+
6
+
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module AvalaraSdk::A1099::V2
13
+ class FormRequestCsvBase
14
+ attr_accessor :issuer_reference_id
15
+
16
+ attr_accessor :issuer_tin
17
+
18
+ attr_accessor :tax_year
19
+
20
+ attr_accessor :issuer_id
21
+
22
+ attr_accessor :reference_id
23
+
24
+ attr_accessor :recipient_name
25
+
26
+ attr_accessor :recipient_tin
27
+
28
+ attr_accessor :tin_type
29
+
30
+ attr_accessor :recipient_second_name
31
+
32
+ attr_accessor :address
33
+
34
+ attr_accessor :address2
35
+
36
+ attr_accessor :city
37
+
38
+ attr_accessor :state
39
+
40
+ attr_accessor :zip
41
+
42
+ attr_accessor :recipient_email
43
+
44
+ attr_accessor :account_number
45
+
46
+ attr_accessor :office_code
47
+
48
+ attr_accessor :recipient_non_us_province
49
+
50
+ attr_accessor :country_code
51
+
52
+ attr_accessor :federal_e_file
53
+
54
+ attr_accessor :postal_mail
55
+
56
+ attr_accessor :state_e_file
57
+
58
+ attr_accessor :tin_match
59
+
60
+ attr_accessor :address_verification
61
+
62
+ attr_accessor :state_and_local_withholding
63
+
64
+ class EnumAttributeValidator
65
+ attr_reader :datatype
66
+ attr_reader :allowable_values
67
+
68
+ def initialize(datatype, allowable_values)
69
+ @allowable_values = allowable_values.map do |value|
70
+ case datatype.to_s
71
+ when /Integer/i
72
+ value.to_i
73
+ when /Float/i
74
+ value.to_f
75
+ else
76
+ value
77
+ end
78
+ end
79
+ end
80
+
81
+ def valid?(value)
82
+ !value || allowable_values.include?(value)
83
+ end
84
+ end
85
+
86
+ # Attribute mapping from ruby-style variable name to JSON key.
87
+ def self.attribute_map
88
+ {
89
+ :'issuer_reference_id' => :'issuerReferenceId',
90
+ :'issuer_tin' => :'issuerTin',
91
+ :'tax_year' => :'taxYear',
92
+ :'issuer_id' => :'issuerId',
93
+ :'reference_id' => :'referenceId',
94
+ :'recipient_name' => :'recipientName',
95
+ :'recipient_tin' => :'recipientTin',
96
+ :'tin_type' => :'tinType',
97
+ :'recipient_second_name' => :'recipientSecondName',
98
+ :'address' => :'address',
99
+ :'address2' => :'address2',
100
+ :'city' => :'city',
101
+ :'state' => :'state',
102
+ :'zip' => :'zip',
103
+ :'recipient_email' => :'recipientEmail',
104
+ :'account_number' => :'accountNumber',
105
+ :'office_code' => :'officeCode',
106
+ :'recipient_non_us_province' => :'recipientNonUsProvince',
107
+ :'country_code' => :'countryCode',
108
+ :'federal_e_file' => :'federalEFile',
109
+ :'postal_mail' => :'postalMail',
110
+ :'state_e_file' => :'stateEFile',
111
+ :'tin_match' => :'tinMatch',
112
+ :'address_verification' => :'addressVerification',
113
+ :'state_and_local_withholding' => :'stateAndLocalWithholding'
114
+ }
115
+ end
116
+
117
+ # Returns all the JSON keys this model knows about
118
+ def self.acceptable_attributes
119
+ attribute_map.values
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.openapi_types
124
+ {
125
+ :'issuer_reference_id' => :'String',
126
+ :'issuer_tin' => :'String',
127
+ :'tax_year' => :'Integer',
128
+ :'issuer_id' => :'String',
129
+ :'reference_id' => :'String',
130
+ :'recipient_name' => :'String',
131
+ :'recipient_tin' => :'String',
132
+ :'tin_type' => :'String',
133
+ :'recipient_second_name' => :'String',
134
+ :'address' => :'String',
135
+ :'address2' => :'String',
136
+ :'city' => :'String',
137
+ :'state' => :'String',
138
+ :'zip' => :'String',
139
+ :'recipient_email' => :'String',
140
+ :'account_number' => :'String',
141
+ :'office_code' => :'String',
142
+ :'recipient_non_us_province' => :'String',
143
+ :'country_code' => :'String',
144
+ :'federal_e_file' => :'Boolean',
145
+ :'postal_mail' => :'Boolean',
146
+ :'state_e_file' => :'Boolean',
147
+ :'tin_match' => :'Boolean',
148
+ :'address_verification' => :'Boolean',
149
+ :'state_and_local_withholding' => :'StateAndLocalWithholdingRequest'
150
+ }
151
+ end
152
+
153
+ # List of attributes with nullable: true
154
+ def self.openapi_nullable
155
+ Set.new([
156
+ :'issuer_id',
157
+ :'reference_id',
158
+ :'recipient_name',
159
+ :'address2',
160
+ :'recipient_email',
161
+ :'account_number',
162
+ :'office_code',
163
+ :'recipient_non_us_province',
164
+ ])
165
+ end
166
+
167
+ # List of class defined in allOf (OpenAPI v3)
168
+ def self.openapi_all_of
169
+ [
170
+ :'FormRequestBase'
171
+ ]
172
+ end
173
+
174
+ # Initializes the object
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ def initialize(attributes = {})
177
+ if (!attributes.is_a?(Hash))
178
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AvalaraSdk::A1099::V2::FormRequestCsvBase` initialize method"
179
+ end
180
+
181
+ # check to see if the attribute exists and convert string to symbol for hash key
182
+ attributes = attributes.each_with_object({}) { |(k, v), h|
183
+ if (!self.class.attribute_map.key?(k.to_sym))
184
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AvalaraSdk::A1099::V2::FormRequestCsvBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
185
+ end
186
+ h[k.to_sym] = v
187
+ }
188
+
189
+ if attributes.key?(:'issuer_reference_id')
190
+ self.issuer_reference_id = attributes[:'issuer_reference_id']
191
+ end
192
+
193
+ if attributes.key?(:'issuer_tin')
194
+ self.issuer_tin = attributes[:'issuer_tin']
195
+ end
196
+
197
+ if attributes.key?(:'tax_year')
198
+ self.tax_year = attributes[:'tax_year']
199
+ end
200
+
201
+ if attributes.key?(:'issuer_id')
202
+ self.issuer_id = attributes[:'issuer_id']
203
+ end
204
+
205
+ if attributes.key?(:'reference_id')
206
+ self.reference_id = attributes[:'reference_id']
207
+ end
208
+
209
+ if attributes.key?(:'recipient_name')
210
+ self.recipient_name = attributes[:'recipient_name']
211
+ end
212
+
213
+ if attributes.key?(:'recipient_tin')
214
+ self.recipient_tin = attributes[:'recipient_tin']
215
+ end
216
+
217
+ if attributes.key?(:'tin_type')
218
+ self.tin_type = attributes[:'tin_type']
219
+ end
220
+
221
+ if attributes.key?(:'recipient_second_name')
222
+ self.recipient_second_name = attributes[:'recipient_second_name']
223
+ end
224
+
225
+ if attributes.key?(:'address')
226
+ self.address = attributes[:'address']
227
+ end
228
+
229
+ if attributes.key?(:'address2')
230
+ self.address2 = attributes[:'address2']
231
+ end
232
+
233
+ if attributes.key?(:'city')
234
+ self.city = attributes[:'city']
235
+ end
236
+
237
+ if attributes.key?(:'state')
238
+ self.state = attributes[:'state']
239
+ end
240
+
241
+ if attributes.key?(:'zip')
242
+ self.zip = attributes[:'zip']
243
+ end
244
+
245
+ if attributes.key?(:'recipient_email')
246
+ self.recipient_email = attributes[:'recipient_email']
247
+ end
248
+
249
+ if attributes.key?(:'account_number')
250
+ self.account_number = attributes[:'account_number']
251
+ end
252
+
253
+ if attributes.key?(:'office_code')
254
+ self.office_code = attributes[:'office_code']
255
+ end
256
+
257
+ if attributes.key?(:'recipient_non_us_province')
258
+ self.recipient_non_us_province = attributes[:'recipient_non_us_province']
259
+ end
260
+
261
+ if attributes.key?(:'country_code')
262
+ self.country_code = attributes[:'country_code']
263
+ end
264
+
265
+ if attributes.key?(:'federal_e_file')
266
+ self.federal_e_file = attributes[:'federal_e_file']
267
+ end
268
+
269
+ if attributes.key?(:'postal_mail')
270
+ self.postal_mail = attributes[:'postal_mail']
271
+ end
272
+
273
+ if attributes.key?(:'state_e_file')
274
+ self.state_e_file = attributes[:'state_e_file']
275
+ end
276
+
277
+ if attributes.key?(:'tin_match')
278
+ self.tin_match = attributes[:'tin_match']
279
+ end
280
+
281
+ if attributes.key?(:'address_verification')
282
+ self.address_verification = attributes[:'address_verification']
283
+ end
284
+
285
+ if attributes.key?(:'state_and_local_withholding')
286
+ self.state_and_local_withholding = attributes[:'state_and_local_withholding']
287
+ end
288
+ end
289
+
290
+ # Show invalid properties with the reasons. Usually used together with valid?
291
+ # @return Array for valid properties with the reasons
292
+ def list_invalid_properties
293
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
294
+ invalid_properties = Array.new
295
+ invalid_properties
296
+ end
297
+
298
+ # Check to see if the all the properties in the model are valid
299
+ # @return true if the model is valid
300
+ def valid?
301
+ warn '[DEPRECATED] the `valid?` method is obsolete'
302
+ tin_type_validator = EnumAttributeValidator.new('String', ["EIN", "SSN", "ITIN", "ATIN"])
303
+ return false unless tin_type_validator.valid?(@tin_type)
304
+ true
305
+ end
306
+
307
+ # Custom attribute writer method checking allowed values (enum).
308
+ # @param [Object] tin_type Object to be assigned
309
+ def tin_type=(tin_type)
310
+ validator = EnumAttributeValidator.new('String', ["EIN", "SSN", "ITIN", "ATIN"])
311
+ unless validator.valid?(tin_type)
312
+ fail ArgumentError, "invalid value for \"tin_type\", must be one of #{validator.allowable_values}."
313
+ end
314
+ @tin_type = tin_type
315
+ end
316
+
317
+ # Checks equality by comparing each attribute.
318
+ # @param [Object] Object to be compared
319
+ def ==(o)
320
+ return true if self.equal?(o)
321
+ self.class == o.class &&
322
+ issuer_reference_id == o.issuer_reference_id &&
323
+ issuer_tin == o.issuer_tin &&
324
+ tax_year == o.tax_year &&
325
+ issuer_id == o.issuer_id &&
326
+ reference_id == o.reference_id &&
327
+ recipient_name == o.recipient_name &&
328
+ recipient_tin == o.recipient_tin &&
329
+ tin_type == o.tin_type &&
330
+ recipient_second_name == o.recipient_second_name &&
331
+ address == o.address &&
332
+ address2 == o.address2 &&
333
+ city == o.city &&
334
+ state == o.state &&
335
+ zip == o.zip &&
336
+ recipient_email == o.recipient_email &&
337
+ account_number == o.account_number &&
338
+ office_code == o.office_code &&
339
+ recipient_non_us_province == o.recipient_non_us_province &&
340
+ country_code == o.country_code &&
341
+ federal_e_file == o.federal_e_file &&
342
+ postal_mail == o.postal_mail &&
343
+ state_e_file == o.state_e_file &&
344
+ tin_match == o.tin_match &&
345
+ address_verification == o.address_verification &&
346
+ state_and_local_withholding == o.state_and_local_withholding
347
+ end
348
+
349
+ # @see the `==` method
350
+ # @param [Object] Object to be compared
351
+ def eql?(o)
352
+ self == o
353
+ end
354
+
355
+ # Calculates hash code according to all attributes.
356
+ # @return [Integer] Hash code
357
+ def hash
358
+ [issuer_reference_id, issuer_tin, tax_year, issuer_id, reference_id, recipient_name, recipient_tin, tin_type, recipient_second_name, address, address2, city, state, zip, recipient_email, account_number, office_code, recipient_non_us_province, country_code, federal_e_file, postal_mail, state_e_file, tin_match, address_verification, state_and_local_withholding].hash
359
+ end
360
+
361
+ # Builds the object from hash
362
+ # @param [Hash] attributes Model attributes in the form of hash
363
+ # @return [Object] Returns the model itself
364
+ def self.build_from_hash(attributes)
365
+ return nil unless attributes.is_a?(Hash)
366
+ attributes = attributes.transform_keys(&:to_sym)
367
+ transformed_hash = {}
368
+ openapi_types.each_pair do |key, type|
369
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
370
+ transformed_hash["#{key}"] = nil
371
+ elsif type =~ /\AArray<(.*)>/i
372
+ # check to ensure the input is an array given that the attribute
373
+ # is documented as an array but the input is not
374
+ if attributes[attribute_map[key]].is_a?(Array)
375
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
376
+ end
377
+ elsif !attributes[attribute_map[key]].nil?
378
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
379
+ end
380
+ end
381
+ new(transformed_hash)
382
+ end
383
+
384
+ # Deserializes the data based on type
385
+ # @param string type Data type
386
+ # @param string value Value to be deserialized
387
+ # @return [Object] Deserialized data
388
+ def self._deserialize(type, value)
389
+ case type.to_sym
390
+ when :Time
391
+ Time.parse(value)
392
+ when :Date
393
+ Date.parse(value)
394
+ when :String
395
+ value.to_s
396
+ when :Integer
397
+ value.to_i
398
+ when :Float
399
+ value.to_f
400
+ when :Boolean
401
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
402
+ true
403
+ else
404
+ false
405
+ end
406
+ when :Object
407
+ # generic object (usually a Hash), return directly
408
+ value
409
+ when /\AArray<(?<inner_type>.+)>\z/
410
+ inner_type = Regexp.last_match[:inner_type]
411
+ value.map { |v| _deserialize(inner_type, v) }
412
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
413
+ k_type = Regexp.last_match[:k_type]
414
+ v_type = Regexp.last_match[:v_type]
415
+ {}.tap do |hash|
416
+ value.each do |k, v|
417
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
418
+ end
419
+ end
420
+ else # model
421
+ # models (e.g. Pet) or oneOf
422
+ klass = AvalaraSdk::A1099::V2.const_get(type)
423
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
424
+ end
425
+ end
426
+
427
+ # Returns the string representation of the object
428
+ # @return [String] String presentation of the object
429
+ def to_s
430
+ to_hash.to_s
431
+ end
432
+
433
+ # to_body is an alias to to_hash (backward compatibility)
434
+ # @return [Hash] Returns the object in the form of hash
435
+ def to_body
436
+ to_hash
437
+ end
438
+
439
+ # Returns the object in the form of hash
440
+ # @return [Hash] Returns the object in the form of hash
441
+ def to_hash
442
+ hash = {}
443
+ self.class.attribute_map.each_pair do |attr, param|
444
+ value = self.send(attr)
445
+ if value.nil?
446
+ is_nullable = self.class.openapi_nullable.include?(attr)
447
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
448
+ end
449
+
450
+ hash[param] = _to_hash(value)
451
+ end
452
+ hash
453
+ end
454
+
455
+ # Outputs non-array value in the form of hash
456
+ # For object, use to_hash. Otherwise, just return the value
457
+ # @param [Object] value Any valid value
458
+ # @return [Hash] Returns the value in the form of hash
459
+ def _to_hash(value)
460
+ if value.is_a?(Array)
461
+ value.compact.map { |v| _to_hash(v) }
462
+ elsif value.is_a?(Hash)
463
+ {}.tap do |hash|
464
+ value.each { |k, v| hash[k] = _to_hash(v) }
465
+ end
466
+ elsif value.respond_to? :to_hash
467
+ value.to_hash
468
+ else
469
+ value
470
+ end
471
+ end
472
+
473
+ end
474
+
475
+ end