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,104 @@
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
+ module Get1099Form200Response
14
+ class << self
15
+ # List of class defined in oneOf (OpenAPI v3)
16
+ def openapi_one_of
17
+ [
18
+ :'Form1095B',
19
+ :'Form1099K',
20
+ :'Form1099Misc',
21
+ :'Form1099Nec',
22
+ :'Form1099R'
23
+ ]
24
+ end
25
+
26
+ # Builds the object
27
+ # @param [Mixed] Data to be matched against the list of oneOf items
28
+ # @return [Object] Returns the model or the data itself
29
+ def build(data)
30
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
31
+ # Note:
32
+ # - We do not attempt to check whether exactly one item matches.
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_one_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ typed_data = find_and_cast_into_type(klass, data)
41
+ return typed_data if typed_data
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_one_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.parse(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = AvalaraSdk::A1099::V2.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,219 @@
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 IncludedBase
14
+ attr_accessor :id
15
+
16
+ attr_accessor :type
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'id' => :'id',
22
+ :'type' => :'type'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'id' => :'String',
35
+ :'type' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AvalaraSdk::A1099::V2::IncludedBase` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AvalaraSdk::A1099::V2::IncludedBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'id')
61
+ self.id = attributes[:'id']
62
+ end
63
+
64
+ if attributes.key?(:'type')
65
+ self.type = attributes[:'type']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
+ invalid_properties = Array.new
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ warn '[DEPRECATED] the `valid?` method is obsolete'
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ id == o.id &&
90
+ type == o.type
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Integer] Hash code
101
+ def hash
102
+ [id, type].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ transformed_hash = {}
112
+ openapi_types.each_pair do |key, type|
113
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
114
+ transformed_hash["#{key}"] = nil
115
+ elsif type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[attribute_map[key]].is_a?(Array)
119
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
120
+ end
121
+ elsif !attributes[attribute_map[key]].nil?
122
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
123
+ end
124
+ end
125
+ new(transformed_hash)
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def self._deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = AvalaraSdk::A1099::V2.const_get(type)
167
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -63,6 +63,7 @@ module AvalaraSdk::A1099::V2
63
63
  # List of attributes with nullable: true
64
64
  def self.openapi_nullable
65
65
  Set.new([
66
+ :'locality_id_number',
66
67
  ])
67
68
  end
68
69
 
@@ -0,0 +1,274 @@
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 StateAndLocalWithholdingResponse
14
+ attr_accessor :state_tax_withheld
15
+
16
+ attr_accessor :state
17
+
18
+ attr_accessor :state_id_number
19
+
20
+ attr_accessor :state_income
21
+
22
+ attr_accessor :local_tax_withheld
23
+
24
+ attr_accessor :locality
25
+
26
+ attr_accessor :locality_id_number
27
+
28
+ attr_accessor :local_income
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'state_tax_withheld' => :'stateTaxWithheld',
34
+ :'state' => :'state',
35
+ :'state_id_number' => :'stateIdNumber',
36
+ :'state_income' => :'stateIncome',
37
+ :'local_tax_withheld' => :'localTaxWithheld',
38
+ :'locality' => :'locality',
39
+ :'locality_id_number' => :'localityIdNumber',
40
+ :'local_income' => :'localIncome'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'state_tax_withheld' => :'Float',
53
+ :'state' => :'String',
54
+ :'state_id_number' => :'String',
55
+ :'state_income' => :'Float',
56
+ :'local_tax_withheld' => :'Float',
57
+ :'locality' => :'String',
58
+ :'locality_id_number' => :'String',
59
+ :'local_income' => :'Float'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ :'locality_id_number',
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AvalaraSdk::A1099::V2::StateAndLocalWithholdingResponse` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AvalaraSdk::A1099::V2::StateAndLocalWithholdingResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'state_tax_withheld')
86
+ self.state_tax_withheld = attributes[:'state_tax_withheld']
87
+ end
88
+
89
+ if attributes.key?(:'state')
90
+ self.state = attributes[:'state']
91
+ end
92
+
93
+ if attributes.key?(:'state_id_number')
94
+ self.state_id_number = attributes[:'state_id_number']
95
+ end
96
+
97
+ if attributes.key?(:'state_income')
98
+ self.state_income = attributes[:'state_income']
99
+ end
100
+
101
+ if attributes.key?(:'local_tax_withheld')
102
+ self.local_tax_withheld = attributes[:'local_tax_withheld']
103
+ end
104
+
105
+ if attributes.key?(:'locality')
106
+ self.locality = attributes[:'locality']
107
+ end
108
+
109
+ if attributes.key?(:'locality_id_number')
110
+ self.locality_id_number = attributes[:'locality_id_number']
111
+ end
112
+
113
+ if attributes.key?(:'local_income')
114
+ self.local_income = attributes[:'local_income']
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ warn '[DEPRECATED] the `valid?` method is obsolete'
130
+ true
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ state_tax_withheld == o.state_tax_withheld &&
139
+ state == o.state &&
140
+ state_id_number == o.state_id_number &&
141
+ state_income == o.state_income &&
142
+ local_tax_withheld == o.local_tax_withheld &&
143
+ locality == o.locality &&
144
+ locality_id_number == o.locality_id_number &&
145
+ local_income == o.local_income
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [state_tax_withheld, state, state_id_number, state_income, local_tax_withheld, locality, locality_id_number, local_income].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ openapi_types.each_pair do |key, type|
168
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[attribute_map[key]].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def self._deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = AvalaraSdk::A1099::V2.const_get(type)
222
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end