avalara_sdk 2.4.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Avalara.SDK.gemspec +38 -0
  3. data/Gemfile +9 -0
  4. data/README.md +129 -0
  5. data/Rakefile +10 -0
  6. data/TAGS +441 -0
  7. data/avalara_sdk.gemspec +36 -0
  8. data/docs/AgeVerificationApi.md +87 -0
  9. data/docs/AgeVerifyFailureCode.md +15 -0
  10. data/docs/AgeVerifyRequest.md +24 -0
  11. data/docs/AgeVerifyRequestAddress.md +26 -0
  12. data/docs/AgeVerifyResult.md +20 -0
  13. data/docs/ErrorDetails.md +18 -0
  14. data/docs/ErrorDetailsError.md +22 -0
  15. data/docs/ErrorDetailsErrorDetails.md +30 -0
  16. data/docs/ShippingVerificationApi.md +327 -0
  17. data/docs/ShippingVerifyResult.md +30 -0
  18. data/docs/ShippingVerifyResultLines.md +28 -0
  19. data/example/test.rb +25 -0
  20. data/git_push.sh +57 -0
  21. data/lib/avalara_sdk/api/age_verification_api.rb +95 -0
  22. data/lib/avalara_sdk/api/shipping_verification_api.rb +322 -0
  23. data/lib/avalara_sdk/api_client.rb +411 -0
  24. data/lib/avalara_sdk/api_error.rb +57 -0
  25. data/lib/avalara_sdk/configuration.rb +231 -0
  26. data/lib/avalara_sdk/models/age_verify_failure_code.rb +39 -0
  27. data/lib/avalara_sdk/models/age_verify_request.rb +245 -0
  28. data/lib/avalara_sdk/models/age_verify_request_address.rb +288 -0
  29. data/lib/avalara_sdk/models/age_verify_result.rb +230 -0
  30. data/lib/avalara_sdk/models/error_details.rb +217 -0
  31. data/lib/avalara_sdk/models/error_details_error.rb +271 -0
  32. data/lib/avalara_sdk/models/error_details_error_details.rb +324 -0
  33. data/lib/avalara_sdk/models/shipping_verify_result.rb +306 -0
  34. data/lib/avalara_sdk/models/shipping_verify_result_lines.rb +303 -0
  35. data/lib/avalara_sdk/version.rb +13 -0
  36. data/lib/avalara_sdk.rb +48 -0
  37. data/spec/api/age_verification_api_spec.rb +48 -0
  38. data/spec/api/shipping_verification_api_spec.rb +88 -0
  39. data/spec/api_client_spec.rb +224 -0
  40. data/spec/configuration_spec.rb +40 -0
  41. data/spec/models/age_verify_failure_code_spec.rb +28 -0
  42. data/spec/models/age_verify_request_address_spec.rb +62 -0
  43. data/spec/models/age_verify_request_spec.rb +52 -0
  44. data/spec/models/age_verify_result_spec.rb +40 -0
  45. data/spec/models/error_details_error_details_spec.rb +78 -0
  46. data/spec/models/error_details_error_spec.rb +50 -0
  47. data/spec/models/error_details_spec.rb +34 -0
  48. data/spec/models/shipping_verify_result_lines_spec.rb +72 -0
  49. data/spec/models/shipping_verify_result_spec.rb +78 -0
  50. data/spec/spec_helper.rb +108 -0
  51. metadata +147 -0
@@ -0,0 +1,39 @@
1
+ =begin
2
+ #Avalara Shipping Verification only
3
+
4
+ #API for evaluating transactions against direct-to-consumer Beverage Alcohol shipping regulations. This API is currently in beta.
5
+
6
+ SDK Version : 2.4.5.6
7
+
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module AvalaraSdk
15
+ class AgeVerifyFailureCode
16
+ NOT_FOUND = "not_found".freeze
17
+ DOB_UNVERIFIABLE = "dob_unverifiable".freeze
18
+ UNDER_AGE = "under_age".freeze
19
+ SUSPECTED_FRAUD = "suspected_fraud".freeze
20
+ DECEASED = "deceased".freeze
21
+ UNKNOWN_ERROR = "unknown_error".freeze
22
+
23
+ # Builds the enum from string
24
+ # @param [String] The enum value in the form of the string
25
+ # @return [String] The enum value
26
+ def self.build_from_hash(value)
27
+ new.build_from_hash(value)
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ constantValues = AgeVerifyFailureCode.constants.select { |c| AgeVerifyFailureCode::const_get(c) == value }
35
+ raise "Invalid ENUM value #{value} for class #AgeVerifyFailureCode" if constantValues.empty?
36
+ value
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,245 @@
1
+ =begin
2
+ #Avalara Shipping Verification only
3
+
4
+ #API for evaluating transactions against direct-to-consumer Beverage Alcohol shipping regulations. This API is currently in beta.
5
+
6
+ SDK Version : 2.4.5.6
7
+
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module AvalaraSdk
15
+ # The Request for the /ageVerification/verify endpoint. Describes information about the person whose age is being verified.
16
+ class AgeVerifyRequest
17
+ attr_accessor :first_name
18
+
19
+ attr_accessor :last_name
20
+
21
+ attr_accessor :address
22
+
23
+ # The value should be ISO-8601 compliant (e.g. 2020-07-21).
24
+ attr_accessor :dob
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'first_name' => :'firstName',
30
+ :'last_name' => :'lastName',
31
+ :'address' => :'address',
32
+ :'dob' => :'DOB'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'first_name' => :'String',
45
+ :'last_name' => :'String',
46
+ :'address' => :'AgeVerifyRequestAddress',
47
+ :'dob' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AvalaraSdk::AgeVerifyRequest` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AvalaraSdk::AgeVerifyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'first_name')
73
+ self.first_name = attributes[:'first_name']
74
+ end
75
+
76
+ if attributes.key?(:'last_name')
77
+ self.last_name = attributes[:'last_name']
78
+ end
79
+
80
+ if attributes.key?(:'address')
81
+ self.address = attributes[:'address']
82
+ end
83
+
84
+ if attributes.key?(:'dob')
85
+ self.dob = attributes[:'dob']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ first_name == o.first_name &&
108
+ last_name == o.last_name &&
109
+ address == o.address &&
110
+ dob == o.dob
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [first_name, last_name, address, dob].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
+ self.send("#{key}=", nil)
140
+ elsif type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :Time
161
+ Time.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ # models (e.g. Pet) or oneOf
192
+ klass = AvalaraSdk.const_get(type)
193
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ if value.nil?
216
+ is_nullable = self.class.openapi_nullable.include?(attr)
217
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
218
+ end
219
+
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map { |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+
243
+ end
244
+
245
+ end
@@ -0,0 +1,288 @@
1
+ =begin
2
+ #Avalara Shipping Verification only
3
+
4
+ #API for evaluating transactions against direct-to-consumer Beverage Alcohol shipping regulations. This API is currently in beta.
5
+
6
+ SDK Version : 2.4.5.6
7
+
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module AvalaraSdk
15
+ class AgeVerifyRequestAddress
16
+ attr_accessor :line1
17
+
18
+ attr_accessor :city
19
+
20
+ # The state code of the address.
21
+ attr_accessor :region
22
+
23
+ # The country code of the address.
24
+ attr_accessor :country
25
+
26
+ attr_accessor :postal_code
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'line1' => :'line1',
54
+ :'city' => :'city',
55
+ :'region' => :'region',
56
+ :'country' => :'country',
57
+ :'postal_code' => :'postalCode'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'line1' => :'String',
70
+ :'city' => :'String',
71
+ :'region' => :'String',
72
+ :'country' => :'String',
73
+ :'postal_code' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AvalaraSdk::AgeVerifyRequestAddress` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AvalaraSdk::AgeVerifyRequestAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'line1')
99
+ self.line1 = attributes[:'line1']
100
+ end
101
+
102
+ if attributes.key?(:'city')
103
+ self.city = attributes[:'city']
104
+ end
105
+
106
+ if attributes.key?(:'region')
107
+ self.region = attributes[:'region']
108
+ end
109
+
110
+ if attributes.key?(:'country')
111
+ self.country = attributes[:'country']
112
+ end
113
+
114
+ if attributes.key?(:'postal_code')
115
+ self.postal_code = attributes[:'postal_code']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
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
+ country_validator = EnumAttributeValidator.new('String', ["US", "USA"])
130
+ return false unless country_validator.valid?(@country)
131
+ true
132
+ end
133
+
134
+ # Custom attribute writer method checking allowed values (enum).
135
+ # @param [Object] country Object to be assigned
136
+ def country=(country)
137
+ validator = EnumAttributeValidator.new('String', ["US", "USA"])
138
+ unless validator.valid?(country)
139
+ fail ArgumentError, "invalid value for \"country\", must be one of #{validator.allowable_values}."
140
+ end
141
+ @country = country
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ line1 == o.line1 &&
150
+ city == o.city &&
151
+ region == o.region &&
152
+ country == o.country &&
153
+ postal_code == o.postal_code
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Integer] Hash code
164
+ def hash
165
+ [line1, city, region, country, postal_code].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def self.build_from_hash(attributes)
172
+ new.build_from_hash(attributes)
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ self.class.openapi_types.each_pair do |key, type|
181
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
182
+ self.send("#{key}=", nil)
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
187
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
188
+ end
189
+ elsif !attributes[self.class.attribute_map[key]].nil?
190
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
191
+ end
192
+ end
193
+
194
+ self
195
+ end
196
+
197
+ # Deserializes the data based on type
198
+ # @param string type Data type
199
+ # @param string value Value to be deserialized
200
+ # @return [Object] Deserialized data
201
+ def _deserialize(type, value)
202
+ case type.to_sym
203
+ when :Time
204
+ Time.parse(value)
205
+ when :Date
206
+ Date.parse(value)
207
+ when :String
208
+ value.to_s
209
+ when :Integer
210
+ value.to_i
211
+ when :Float
212
+ value.to_f
213
+ when :Boolean
214
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
215
+ true
216
+ else
217
+ false
218
+ end
219
+ when :Object
220
+ # generic object (usually a Hash), return directly
221
+ value
222
+ when /\AArray<(?<inner_type>.+)>\z/
223
+ inner_type = Regexp.last_match[:inner_type]
224
+ value.map { |v| _deserialize(inner_type, v) }
225
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
226
+ k_type = Regexp.last_match[:k_type]
227
+ v_type = Regexp.last_match[:v_type]
228
+ {}.tap do |hash|
229
+ value.each do |k, v|
230
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
+ end
232
+ end
233
+ else # model
234
+ # models (e.g. Pet) or oneOf
235
+ klass = AvalaraSdk.const_get(type)
236
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+
286
+ end
287
+
288
+ end