onfido 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/onfido/api_client.rb +1 -1
- data/lib/onfido/models/watchlist_enhanced_properties.rb +1 -1
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner.rb +311 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_address_inner.rb +281 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_alias_inner.rb +223 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_associate_inner.rb +232 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_attribute_inner.rb +223 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner.rb +250 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner_source.rb +241 -0
- data/lib/onfido/models/watchlist_enhanced_properties_records_inner_source_inner.rb +241 -0
- data/lib/onfido/version.rb +1 -1
- data/lib/onfido.rb +8 -0
- metadata +24 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a6064074cd1701caabe2b1a709b23c64b38063a8b74a857021fe4c924b8f3e
|
4
|
+
data.tar.gz: b0d29ec09c5009095de47d40159af85a00d774e2ee94ffbfe5eb70a7914800e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bfd5c166e29f1e4a417f667308fae843736d8cc237ad205d265ff7127c39fe500f02aefd60ed4ec071230dfde6427ea931ce5e97fd914c680b8c7a5c7e22ae8
|
7
|
+
data.tar.gz: 8cad9cd387ff988a6a8aaf23c67f6a5119d224d036d0de37494a895320c9ae7584510a4ffeaba69d5ae73e2b0273c6ba2dc7eda2a354a0bca795fcffc402be26
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v3.3.1 22nd August 2024
|
4
|
+
|
5
|
+
- Release based on Onfido OpenAPI spec version [v3.3.1](https://github.com/onfido/onfido-openapi-spec/releases/tag/v3.3.1):
|
6
|
+
- Including `faraday-follow_redirects` as a runtime dependency in ruby
|
7
|
+
|
3
8
|
## v3.3.0 24th July 2024
|
4
9
|
|
5
10
|
- Release based on Onfido OpenAPI spec version [v3.3.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v3.3.0):
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ This version uses Onfido API v3.6. Refer to our [API versioning guide](https://d
|
|
14
14
|
### Installation
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem onfido, '~> 3.
|
17
|
+
gem onfido, '~> 3.4.0'
|
18
18
|
```
|
19
19
|
|
20
20
|
Configure with your API token, region and optional timeout (default value is 30):
|
data/lib/onfido/api_client.rb
CHANGED
@@ -34,7 +34,7 @@ module Onfido
|
|
34
34
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
35
35
|
def initialize(config = Configuration.default)
|
36
36
|
@config = config
|
37
|
-
@user_agent = "onfido-ruby/3.
|
37
|
+
@user_agent = "onfido-ruby/3.4.0"
|
38
38
|
@default_headers = {
|
39
39
|
'Content-Type' => 'application/json',
|
40
40
|
'User-Agent' => @user_agent
|
@@ -0,0 +1,311 @@
|
|
1
|
+
=begin
|
2
|
+
#Onfido API v3.6
|
3
|
+
|
4
|
+
#The Onfido API (v3.6)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3.6
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Onfido
|
17
|
+
class WatchlistEnhancedPropertiesRecordsInner
|
18
|
+
# All addresses on file.
|
19
|
+
attr_accessor :address
|
20
|
+
|
21
|
+
# Any names that the person is also known as.
|
22
|
+
attr_accessor :_alias
|
23
|
+
|
24
|
+
# Any linked persons, for example family relatives or business partners.
|
25
|
+
attr_accessor :associate
|
26
|
+
|
27
|
+
# Information about the person, for example hair color or nationality.
|
28
|
+
attr_accessor :attribute
|
29
|
+
|
30
|
+
# All the date of births on file.
|
31
|
+
attr_accessor :date_of_birth
|
32
|
+
|
33
|
+
# Information about events that have occurred to the person, for example deportation or arrest.
|
34
|
+
attr_accessor :event
|
35
|
+
|
36
|
+
# The name on file
|
37
|
+
attr_accessor :full_name
|
38
|
+
|
39
|
+
# The role, country and date of each position.
|
40
|
+
attr_accessor :position
|
41
|
+
|
42
|
+
# Details about where the information was obtained.
|
43
|
+
attr_accessor :source
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'address' => :'address',
|
49
|
+
:'_alias' => :'alias',
|
50
|
+
:'associate' => :'associate',
|
51
|
+
:'attribute' => :'attribute',
|
52
|
+
:'date_of_birth' => :'date_of_birth',
|
53
|
+
:'event' => :'event',
|
54
|
+
:'full_name' => :'full_name',
|
55
|
+
:'position' => :'position',
|
56
|
+
:'source' => :'source'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns all the JSON keys this model knows about
|
61
|
+
def self.acceptable_attributes
|
62
|
+
attribute_map.values
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.openapi_types
|
67
|
+
{
|
68
|
+
:'address' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAddressInner>',
|
69
|
+
:'_alias' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAliasInner>',
|
70
|
+
:'associate' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAssociateInner>',
|
71
|
+
:'attribute' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAttributeInner>',
|
72
|
+
:'date_of_birth' => :'Array<String>',
|
73
|
+
:'event' => :'Array<WatchlistEnhancedPropertiesRecordsInnerEventInner>',
|
74
|
+
:'full_name' => :'String',
|
75
|
+
:'position' => :'Array<String>',
|
76
|
+
:'source' => :'Array<WatchlistEnhancedPropertiesRecordsInnerSourceInner>'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([
|
83
|
+
])
|
84
|
+
end
|
85
|
+
|
86
|
+
# Initializes the object
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
def initialize(attributes = {})
|
89
|
+
if (!attributes.is_a?(Hash))
|
90
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistEnhancedPropertiesRecordsInner` initialize method"
|
91
|
+
end
|
92
|
+
|
93
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
94
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
95
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
96
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistEnhancedPropertiesRecordsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
97
|
+
end
|
98
|
+
h[k.to_sym] = v
|
99
|
+
}
|
100
|
+
|
101
|
+
if attributes.key?(:'address')
|
102
|
+
if (value = attributes[:'address']).is_a?(Array)
|
103
|
+
self.address = value
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'_alias')
|
108
|
+
if (value = attributes[:'_alias']).is_a?(Array)
|
109
|
+
self._alias = value
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'associate')
|
114
|
+
if (value = attributes[:'associate']).is_a?(Array)
|
115
|
+
self.associate = value
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'attribute')
|
120
|
+
if (value = attributes[:'attribute']).is_a?(Array)
|
121
|
+
self.attribute = value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'date_of_birth')
|
126
|
+
if (value = attributes[:'date_of_birth']).is_a?(Array)
|
127
|
+
self.date_of_birth = value
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'event')
|
132
|
+
if (value = attributes[:'event']).is_a?(Array)
|
133
|
+
self.event = value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'full_name')
|
138
|
+
self.full_name = attributes[:'full_name']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'position')
|
142
|
+
if (value = attributes[:'position']).is_a?(Array)
|
143
|
+
self.position = value
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'source')
|
148
|
+
if (value = attributes[:'source']).is_a?(Array)
|
149
|
+
self.source = value
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
155
|
+
# @return Array for valid properties with the reasons
|
156
|
+
def list_invalid_properties
|
157
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
158
|
+
invalid_properties = Array.new
|
159
|
+
invalid_properties
|
160
|
+
end
|
161
|
+
|
162
|
+
# Check to see if the all the properties in the model are valid
|
163
|
+
# @return true if the model is valid
|
164
|
+
def valid?
|
165
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
166
|
+
true
|
167
|
+
end
|
168
|
+
|
169
|
+
# Checks equality by comparing each attribute.
|
170
|
+
# @param [Object] Object to be compared
|
171
|
+
def ==(o)
|
172
|
+
return true if self.equal?(o)
|
173
|
+
self.class == o.class &&
|
174
|
+
address == o.address &&
|
175
|
+
_alias == o._alias &&
|
176
|
+
associate == o.associate &&
|
177
|
+
attribute == o.attribute &&
|
178
|
+
date_of_birth == o.date_of_birth &&
|
179
|
+
event == o.event &&
|
180
|
+
full_name == o.full_name &&
|
181
|
+
position == o.position &&
|
182
|
+
source == o.source
|
183
|
+
end
|
184
|
+
|
185
|
+
# @see the `==` method
|
186
|
+
# @param [Object] Object to be compared
|
187
|
+
def eql?(o)
|
188
|
+
self == o
|
189
|
+
end
|
190
|
+
|
191
|
+
# Calculates hash code according to all attributes.
|
192
|
+
# @return [Integer] Hash code
|
193
|
+
def hash
|
194
|
+
[address, _alias, associate, attribute, date_of_birth, event, full_name, position, source].hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Builds the object from hash
|
198
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
199
|
+
# @return [Object] Returns the model itself
|
200
|
+
def self.build_from_hash(attributes)
|
201
|
+
return nil unless attributes.is_a?(Hash)
|
202
|
+
attributes = attributes.transform_keys(&:to_sym)
|
203
|
+
transformed_hash = {}
|
204
|
+
openapi_types.each_pair do |key, type|
|
205
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
206
|
+
transformed_hash["#{key}"] = nil
|
207
|
+
elsif type =~ /\AArray<(.*)>/i
|
208
|
+
# check to ensure the input is an array given that the attribute
|
209
|
+
# is documented as an array but the input is not
|
210
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
211
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
212
|
+
end
|
213
|
+
elsif !attributes[attribute_map[key]].nil?
|
214
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
215
|
+
end
|
216
|
+
end
|
217
|
+
new(transformed_hash)
|
218
|
+
end
|
219
|
+
|
220
|
+
# Deserializes the data based on type
|
221
|
+
# @param string type Data type
|
222
|
+
# @param string value Value to be deserialized
|
223
|
+
# @return [Object] Deserialized data
|
224
|
+
def self._deserialize(type, value)
|
225
|
+
case type.to_sym
|
226
|
+
when :Time
|
227
|
+
Time.parse(value)
|
228
|
+
when :Date
|
229
|
+
Date.parse(value)
|
230
|
+
when :String
|
231
|
+
value.to_s
|
232
|
+
when :Integer
|
233
|
+
value.to_i
|
234
|
+
when :Float
|
235
|
+
value.to_f
|
236
|
+
when :Boolean
|
237
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
238
|
+
true
|
239
|
+
else
|
240
|
+
false
|
241
|
+
end
|
242
|
+
when :Object
|
243
|
+
# generic object (usually a Hash), return directly
|
244
|
+
value
|
245
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
246
|
+
inner_type = Regexp.last_match[:inner_type]
|
247
|
+
value.map { |v| _deserialize(inner_type, v) }
|
248
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
249
|
+
k_type = Regexp.last_match[:k_type]
|
250
|
+
v_type = Regexp.last_match[:v_type]
|
251
|
+
{}.tap do |hash|
|
252
|
+
value.each do |k, v|
|
253
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
else # model
|
257
|
+
# models (e.g. Pet) or oneOf
|
258
|
+
klass = Onfido.const_get(type)
|
259
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns the string representation of the object
|
264
|
+
# @return [String] String presentation of the object
|
265
|
+
def to_s
|
266
|
+
to_hash.to_s
|
267
|
+
end
|
268
|
+
|
269
|
+
# to_body is an alias to to_hash (backward compatibility)
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
271
|
+
def to_body
|
272
|
+
to_hash
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns the object in the form of hash
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
277
|
+
def to_hash
|
278
|
+
hash = {}
|
279
|
+
self.class.attribute_map.each_pair do |attr, param|
|
280
|
+
value = self.send(attr)
|
281
|
+
if value.nil?
|
282
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
283
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
284
|
+
end
|
285
|
+
|
286
|
+
hash[param] = _to_hash(value)
|
287
|
+
end
|
288
|
+
hash
|
289
|
+
end
|
290
|
+
|
291
|
+
# Outputs non-array value in the form of hash
|
292
|
+
# For object, use to_hash. Otherwise, just return the value
|
293
|
+
# @param [Object] value Any valid value
|
294
|
+
# @return [Hash] Returns the value in the form of hash
|
295
|
+
def _to_hash(value)
|
296
|
+
if value.is_a?(Array)
|
297
|
+
value.compact.map { |v| _to_hash(v) }
|
298
|
+
elsif value.is_a?(Hash)
|
299
|
+
{}.tap do |hash|
|
300
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
301
|
+
end
|
302
|
+
elsif value.respond_to? :to_hash
|
303
|
+
value.to_hash
|
304
|
+
else
|
305
|
+
value
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
@@ -0,0 +1,281 @@
|
|
1
|
+
=begin
|
2
|
+
#Onfido API v3.6
|
3
|
+
|
4
|
+
#The Onfido API (v3.6)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3.6
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Onfido
|
17
|
+
class WatchlistEnhancedPropertiesRecordsInnerAddressInner
|
18
|
+
attr_accessor :address_line1
|
19
|
+
|
20
|
+
attr_accessor :country
|
21
|
+
|
22
|
+
attr_accessor :postal_code
|
23
|
+
|
24
|
+
attr_accessor :state_province
|
25
|
+
|
26
|
+
attr_accessor :town
|
27
|
+
|
28
|
+
attr_accessor :locator_type
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'address_line1' => :'address_line1',
|
56
|
+
:'country' => :'country',
|
57
|
+
:'postal_code' => :'postal_code',
|
58
|
+
:'state_province' => :'state_province',
|
59
|
+
:'town' => :'town',
|
60
|
+
:'locator_type' => :'locator_type'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns all the JSON keys this model knows about
|
65
|
+
def self.acceptable_attributes
|
66
|
+
attribute_map.values
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.openapi_types
|
71
|
+
{
|
72
|
+
:'address_line1' => :'String',
|
73
|
+
:'country' => :'CountryCodes',
|
74
|
+
:'postal_code' => :'String',
|
75
|
+
:'state_province' => :'String',
|
76
|
+
:'town' => :'String',
|
77
|
+
:'locator_type' => :'String'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# List of attributes with nullable: true
|
82
|
+
def self.openapi_nullable
|
83
|
+
Set.new([
|
84
|
+
])
|
85
|
+
end
|
86
|
+
|
87
|
+
# Initializes the object
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
def initialize(attributes = {})
|
90
|
+
if (!attributes.is_a?(Hash))
|
91
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistEnhancedPropertiesRecordsInnerAddressInner` initialize method"
|
92
|
+
end
|
93
|
+
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
95
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
96
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
97
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistEnhancedPropertiesRecordsInnerAddressInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
98
|
+
end
|
99
|
+
h[k.to_sym] = v
|
100
|
+
}
|
101
|
+
|
102
|
+
if attributes.key?(:'address_line1')
|
103
|
+
self.address_line1 = attributes[:'address_line1']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'country')
|
107
|
+
self.country = attributes[:'country']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'postal_code')
|
111
|
+
self.postal_code = attributes[:'postal_code']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'state_province')
|
115
|
+
self.state_province = attributes[:'state_province']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'town')
|
119
|
+
self.town = attributes[:'town']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'locator_type')
|
123
|
+
self.locator_type = attributes[:'locator_type']
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
128
|
+
# @return Array for valid properties with the reasons
|
129
|
+
def list_invalid_properties
|
130
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
131
|
+
invalid_properties = Array.new
|
132
|
+
invalid_properties
|
133
|
+
end
|
134
|
+
|
135
|
+
# Check to see if the all the properties in the model are valid
|
136
|
+
# @return true if the model is valid
|
137
|
+
def valid?
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
139
|
+
true
|
140
|
+
end
|
141
|
+
|
142
|
+
# Checks equality by comparing each attribute.
|
143
|
+
# @param [Object] Object to be compared
|
144
|
+
def ==(o)
|
145
|
+
return true if self.equal?(o)
|
146
|
+
self.class == o.class &&
|
147
|
+
address_line1 == o.address_line1 &&
|
148
|
+
country == o.country &&
|
149
|
+
postal_code == o.postal_code &&
|
150
|
+
state_province == o.state_province &&
|
151
|
+
town == o.town &&
|
152
|
+
locator_type == o.locator_type
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def eql?(o)
|
158
|
+
self == o
|
159
|
+
end
|
160
|
+
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Integer] Hash code
|
163
|
+
def hash
|
164
|
+
[address_line1, country, postal_code, state_province, town, locator_type].hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Builds the object from hash
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
+
# @return [Object] Returns the model itself
|
170
|
+
def self.build_from_hash(attributes)
|
171
|
+
return nil unless attributes.is_a?(Hash)
|
172
|
+
attributes = attributes.transform_keys(&:to_sym)
|
173
|
+
transformed_hash = {}
|
174
|
+
openapi_types.each_pair do |key, type|
|
175
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
176
|
+
transformed_hash["#{key}"] = nil
|
177
|
+
elsif type =~ /\AArray<(.*)>/i
|
178
|
+
# check to ensure the input is an array given that the attribute
|
179
|
+
# is documented as an array but the input is not
|
180
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
181
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
182
|
+
end
|
183
|
+
elsif !attributes[attribute_map[key]].nil?
|
184
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
185
|
+
end
|
186
|
+
end
|
187
|
+
new(transformed_hash)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Deserializes the data based on type
|
191
|
+
# @param string type Data type
|
192
|
+
# @param string value Value to be deserialized
|
193
|
+
# @return [Object] Deserialized data
|
194
|
+
def self._deserialize(type, value)
|
195
|
+
case type.to_sym
|
196
|
+
when :Time
|
197
|
+
Time.parse(value)
|
198
|
+
when :Date
|
199
|
+
Date.parse(value)
|
200
|
+
when :String
|
201
|
+
value.to_s
|
202
|
+
when :Integer
|
203
|
+
value.to_i
|
204
|
+
when :Float
|
205
|
+
value.to_f
|
206
|
+
when :Boolean
|
207
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
208
|
+
true
|
209
|
+
else
|
210
|
+
false
|
211
|
+
end
|
212
|
+
when :Object
|
213
|
+
# generic object (usually a Hash), return directly
|
214
|
+
value
|
215
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
216
|
+
inner_type = Regexp.last_match[:inner_type]
|
217
|
+
value.map { |v| _deserialize(inner_type, v) }
|
218
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
219
|
+
k_type = Regexp.last_match[:k_type]
|
220
|
+
v_type = Regexp.last_match[:v_type]
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each do |k, v|
|
223
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
else # model
|
227
|
+
# models (e.g. Pet) or oneOf
|
228
|
+
klass = Onfido.const_get(type)
|
229
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the string representation of the object
|
234
|
+
# @return [String] String presentation of the object
|
235
|
+
def to_s
|
236
|
+
to_hash.to_s
|
237
|
+
end
|
238
|
+
|
239
|
+
# to_body is an alias to to_hash (backward compatibility)
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
241
|
+
def to_body
|
242
|
+
to_hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the object in the form of hash
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
247
|
+
def to_hash
|
248
|
+
hash = {}
|
249
|
+
self.class.attribute_map.each_pair do |attr, param|
|
250
|
+
value = self.send(attr)
|
251
|
+
if value.nil?
|
252
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
253
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
254
|
+
end
|
255
|
+
|
256
|
+
hash[param] = _to_hash(value)
|
257
|
+
end
|
258
|
+
hash
|
259
|
+
end
|
260
|
+
|
261
|
+
# Outputs non-array value in the form of hash
|
262
|
+
# For object, use to_hash. Otherwise, just return the value
|
263
|
+
# @param [Object] value Any valid value
|
264
|
+
# @return [Hash] Returns the value in the form of hash
|
265
|
+
def _to_hash(value)
|
266
|
+
if value.is_a?(Array)
|
267
|
+
value.compact.map { |v| _to_hash(v) }
|
268
|
+
elsif value.is_a?(Hash)
|
269
|
+
{}.tap do |hash|
|
270
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
271
|
+
end
|
272
|
+
elsif value.respond_to? :to_hash
|
273
|
+
value.to_hash
|
274
|
+
else
|
275
|
+
value
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
end
|