passageidentity 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +21 -0
  4. data/docs/generated/{GithubSocialConnection.md → AppleUserSocialConnection.md} +2 -2
  5. data/docs/generated/{GoogleSocialConnection.md → GithubUserSocialConnection.md} +2 -2
  6. data/docs/generated/GoogleUserSocialConnection.md +24 -0
  7. data/docs/generated/Link.md +18 -0
  8. data/docs/generated/ListPaginatedUsersItem.md +38 -0
  9. data/docs/generated/ListPaginatedUsersResponse.md +28 -0
  10. data/docs/generated/Model403Error.md +20 -0
  11. data/docs/generated/Nonce.md +18 -0
  12. data/docs/generated/PaginatedLinks.md +26 -0
  13. data/docs/generated/README.md +12 -6
  14. data/docs/generated/UserEventStatus.md +15 -0
  15. data/docs/generated/UserInfo.md +1 -1
  16. data/docs/generated/{UserEventInfo.md → UserRecentEvent.md} +6 -2
  17. data/docs/generated/UserSocialConnections.md +6 -4
  18. data/docs/generated/UsersApi.md +94 -0
  19. data/lib/openapi_client/api/users_api.rb +96 -0
  20. data/lib/openapi_client/models/{github_social_connection.rb → apple_user_social_connection.rb} +3 -3
  21. data/lib/openapi_client/models/{google_social_connection.rb → github_user_social_connection.rb} +3 -3
  22. data/lib/openapi_client/models/google_user_social_connection.rb +271 -0
  23. data/lib/openapi_client/models/link.rb +221 -0
  24. data/lib/openapi_client/models/list_paginated_users_item.rb +399 -0
  25. data/lib/openapi_client/models/list_paginated_users_response.rb +305 -0
  26. data/lib/openapi_client/models/magic_link_auth_method.rb +0 -7
  27. data/lib/openapi_client/models/model401_error.rb +2 -2
  28. data/lib/openapi_client/models/model403_error.rb +271 -0
  29. data/lib/openapi_client/models/nonce.rb +222 -0
  30. data/lib/openapi_client/models/otp_auth_method.rb +3 -10
  31. data/lib/openapi_client/models/paginated_links.rb +285 -0
  32. data/lib/openapi_client/models/passkeys_auth_method.rb +0 -7
  33. data/lib/openapi_client/models/ttl_display_unit.rb +1 -1
  34. data/lib/openapi_client/models/user_event_status.rb +40 -0
  35. data/lib/openapi_client/models/user_info.rb +1 -1
  36. data/lib/openapi_client/models/{user_event_info.rb → user_recent_event.rb} +54 -4
  37. data/lib/openapi_client/models/user_social_connections.rb +19 -10
  38. data/lib/openapi_client.rb +14 -6
  39. data/lib/passageidentity/user_api.rb +40 -0
  40. data/lib/passageidentity/version.rb +1 -1
  41. data/tests/user_api_test.rb +41 -0
  42. metadata +27 -14
  43. data/docs/generated/UpdateMagicLinkAuthMethod.md +0 -22
  44. data/docs/generated/UpdateOtpAuthMethod.md +0 -22
  45. data/docs/generated/UpdatePasskeysAuthMethod.md +0 -18
  46. /data/lib/{openapi_client/models → models}/update_magic_link_auth_method.rb +0 -0
  47. /data/lib/{openapi_client/models → models}/update_otp_auth_method.rb +0 -0
  48. /data/lib/{openapi_client/models → models}/update_passkeys_auth_method.rb +0 -0
@@ -0,0 +1,399 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class ListPaginatedUsersItem
18
+ attr_accessor :created_at
19
+
20
+ attr_accessor :email
21
+
22
+ attr_accessor :email_verified
23
+
24
+ attr_accessor :id
25
+
26
+ attr_accessor :last_login_at
27
+
28
+ attr_accessor :login_count
29
+
30
+ attr_accessor :phone
31
+
32
+ attr_accessor :phone_verified
33
+
34
+ attr_accessor :status
35
+
36
+ attr_accessor :updated_at
37
+
38
+ attr_accessor :user_metadata
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'created_at' => :'created_at',
66
+ :'email' => :'email',
67
+ :'email_verified' => :'email_verified',
68
+ :'id' => :'id',
69
+ :'last_login_at' => :'last_login_at',
70
+ :'login_count' => :'login_count',
71
+ :'phone' => :'phone',
72
+ :'phone_verified' => :'phone_verified',
73
+ :'status' => :'status',
74
+ :'updated_at' => :'updated_at',
75
+ :'user_metadata' => :'user_metadata'
76
+ }
77
+ end
78
+
79
+ # Returns all the JSON keys this model knows about
80
+ def self.acceptable_attributes
81
+ attribute_map.values
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'created_at' => :'Time',
88
+ :'email' => :'String',
89
+ :'email_verified' => :'Boolean',
90
+ :'id' => :'String',
91
+ :'last_login_at' => :'Time',
92
+ :'login_count' => :'Integer',
93
+ :'phone' => :'String',
94
+ :'phone_verified' => :'Boolean',
95
+ :'status' => :'UserStatus',
96
+ :'updated_at' => :'Time',
97
+ :'user_metadata' => :'Object'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ :'user_metadata'
105
+ ])
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ListPaginatedUsersItem` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!self.class.attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ListPaginatedUsersItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'created_at')
124
+ self.created_at = attributes[:'created_at']
125
+ else
126
+ self.created_at = nil
127
+ end
128
+
129
+ if attributes.key?(:'email')
130
+ self.email = attributes[:'email']
131
+ else
132
+ self.email = nil
133
+ end
134
+
135
+ if attributes.key?(:'email_verified')
136
+ self.email_verified = attributes[:'email_verified']
137
+ else
138
+ self.email_verified = nil
139
+ end
140
+
141
+ if attributes.key?(:'id')
142
+ self.id = attributes[:'id']
143
+ else
144
+ self.id = nil
145
+ end
146
+
147
+ if attributes.key?(:'last_login_at')
148
+ self.last_login_at = attributes[:'last_login_at']
149
+ else
150
+ self.last_login_at = nil
151
+ end
152
+
153
+ if attributes.key?(:'login_count')
154
+ self.login_count = attributes[:'login_count']
155
+ else
156
+ self.login_count = nil
157
+ end
158
+
159
+ if attributes.key?(:'phone')
160
+ self.phone = attributes[:'phone']
161
+ else
162
+ self.phone = nil
163
+ end
164
+
165
+ if attributes.key?(:'phone_verified')
166
+ self.phone_verified = attributes[:'phone_verified']
167
+ else
168
+ self.phone_verified = nil
169
+ end
170
+
171
+ if attributes.key?(:'status')
172
+ self.status = attributes[:'status']
173
+ else
174
+ self.status = nil
175
+ end
176
+
177
+ if attributes.key?(:'updated_at')
178
+ self.updated_at = attributes[:'updated_at']
179
+ else
180
+ self.updated_at = nil
181
+ end
182
+
183
+ if attributes.key?(:'user_metadata')
184
+ self.user_metadata = attributes[:'user_metadata']
185
+ else
186
+ self.user_metadata = nil
187
+ end
188
+ end
189
+
190
+ # Show invalid properties with the reasons. Usually used together with valid?
191
+ # @return Array for valid properties with the reasons
192
+ def list_invalid_properties
193
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
194
+ invalid_properties = Array.new
195
+ if @created_at.nil?
196
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
197
+ end
198
+
199
+ if @email.nil?
200
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
201
+ end
202
+
203
+ if @email_verified.nil?
204
+ invalid_properties.push('invalid value for "email_verified", email_verified cannot be nil.')
205
+ end
206
+
207
+ if @id.nil?
208
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
209
+ end
210
+
211
+ if @last_login_at.nil?
212
+ invalid_properties.push('invalid value for "last_login_at", last_login_at cannot be nil.')
213
+ end
214
+
215
+ if @login_count.nil?
216
+ invalid_properties.push('invalid value for "login_count", login_count cannot be nil.')
217
+ end
218
+
219
+ if @phone.nil?
220
+ invalid_properties.push('invalid value for "phone", phone cannot be nil.')
221
+ end
222
+
223
+ if @phone_verified.nil?
224
+ invalid_properties.push('invalid value for "phone_verified", phone_verified cannot be nil.')
225
+ end
226
+
227
+ if @status.nil?
228
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
229
+ end
230
+
231
+ if @updated_at.nil?
232
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
233
+ end
234
+
235
+ invalid_properties
236
+ end
237
+
238
+ # Check to see if the all the properties in the model are valid
239
+ # @return true if the model is valid
240
+ def valid?
241
+ warn '[DEPRECATED] the `valid?` method is obsolete'
242
+ return false if @created_at.nil?
243
+ return false if @email.nil?
244
+ return false if @email_verified.nil?
245
+ return false if @id.nil?
246
+ return false if @last_login_at.nil?
247
+ return false if @login_count.nil?
248
+ return false if @phone.nil?
249
+ return false if @phone_verified.nil?
250
+ return false if @status.nil?
251
+ return false if @updated_at.nil?
252
+ true
253
+ end
254
+
255
+ # Checks equality by comparing each attribute.
256
+ # @param [Object] Object to be compared
257
+ def ==(o)
258
+ return true if self.equal?(o)
259
+ self.class == o.class &&
260
+ created_at == o.created_at &&
261
+ email == o.email &&
262
+ email_verified == o.email_verified &&
263
+ id == o.id &&
264
+ last_login_at == o.last_login_at &&
265
+ login_count == o.login_count &&
266
+ phone == o.phone &&
267
+ phone_verified == o.phone_verified &&
268
+ status == o.status &&
269
+ updated_at == o.updated_at &&
270
+ user_metadata == o.user_metadata
271
+ end
272
+
273
+ # @see the `==` method
274
+ # @param [Object] Object to be compared
275
+ def eql?(o)
276
+ self == o
277
+ end
278
+
279
+ # Calculates hash code according to all attributes.
280
+ # @return [Integer] Hash code
281
+ def hash
282
+ [created_at, email, email_verified, id, last_login_at, login_count, phone, phone_verified, status, updated_at, user_metadata].hash
283
+ end
284
+
285
+ # Builds the object from hash
286
+ # @param [Hash] attributes Model attributes in the form of hash
287
+ # @return [Object] Returns the model itself
288
+ def self.build_from_hash(attributes)
289
+ return nil unless attributes.is_a?(Hash)
290
+ attributes = attributes.transform_keys(&:to_sym)
291
+ transformed_hash = {}
292
+ openapi_types.each_pair do |key, type|
293
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
294
+ transformed_hash["#{key}"] = nil
295
+ elsif type =~ /\AArray<(.*)>/i
296
+ # check to ensure the input is an array given that the attribute
297
+ # is documented as an array but the input is not
298
+ if attributes[attribute_map[key]].is_a?(Array)
299
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
300
+ end
301
+ elsif !attributes[attribute_map[key]].nil?
302
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
303
+ end
304
+ end
305
+ new(transformed_hash)
306
+ end
307
+
308
+ # Deserializes the data based on type
309
+ # @param string type Data type
310
+ # @param string value Value to be deserialized
311
+ # @return [Object] Deserialized data
312
+ def self._deserialize(type, value)
313
+ case type.to_sym
314
+ when :Time
315
+ Time.parse(value)
316
+ when :Date
317
+ Date.parse(value)
318
+ when :String
319
+ value.to_s
320
+ when :Integer
321
+ value.to_i
322
+ when :Float
323
+ value.to_f
324
+ when :Boolean
325
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
326
+ true
327
+ else
328
+ false
329
+ end
330
+ when :Object
331
+ # generic object (usually a Hash), return directly
332
+ value
333
+ when /\AArray<(?<inner_type>.+)>\z/
334
+ inner_type = Regexp.last_match[:inner_type]
335
+ value.map { |v| _deserialize(inner_type, v) }
336
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
337
+ k_type = Regexp.last_match[:k_type]
338
+ v_type = Regexp.last_match[:v_type]
339
+ {}.tap do |hash|
340
+ value.each do |k, v|
341
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
342
+ end
343
+ end
344
+ else # model
345
+ # models (e.g. Pet) or oneOf
346
+ klass = OpenapiClient.const_get(type)
347
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
348
+ end
349
+ end
350
+
351
+ # Returns the string representation of the object
352
+ # @return [String] String presentation of the object
353
+ def to_s
354
+ to_hash.to_s
355
+ end
356
+
357
+ # to_body is an alias to to_hash (backward compatibility)
358
+ # @return [Hash] Returns the object in the form of hash
359
+ def to_body
360
+ to_hash
361
+ end
362
+
363
+ # Returns the object in the form of hash
364
+ # @return [Hash] Returns the object in the form of hash
365
+ def to_hash
366
+ hash = {}
367
+ self.class.attribute_map.each_pair do |attr, param|
368
+ value = self.send(attr)
369
+ if value.nil?
370
+ is_nullable = self.class.openapi_nullable.include?(attr)
371
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
372
+ end
373
+
374
+ hash[param] = _to_hash(value)
375
+ end
376
+ hash
377
+ end
378
+
379
+ # Outputs non-array value in the form of hash
380
+ # For object, use to_hash. Otherwise, just return the value
381
+ # @param [Object] value Any valid value
382
+ # @return [Hash] Returns the value in the form of hash
383
+ def _to_hash(value)
384
+ if value.is_a?(Array)
385
+ value.compact.map { |v| _to_hash(v) }
386
+ elsif value.is_a?(Hash)
387
+ {}.tap do |hash|
388
+ value.each { |k, v| hash[k] = _to_hash(v) }
389
+ end
390
+ elsif value.respond_to? :to_hash
391
+ value.to_hash
392
+ else
393
+ value
394
+ end
395
+ end
396
+
397
+ end
398
+
399
+ end
@@ -0,0 +1,305 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class ListPaginatedUsersResponse
18
+ attr_accessor :_links
19
+
20
+ # time anchor (Unix timestamp) --> all users returned created before this timestamp
21
+ attr_accessor :created_before
22
+
23
+ attr_accessor :limit
24
+
25
+ attr_accessor :page
26
+
27
+ # total number of users for a particular query
28
+ attr_accessor :total_users
29
+
30
+ attr_accessor :users
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'_links' => :'_links',
36
+ :'created_before' => :'created_before',
37
+ :'limit' => :'limit',
38
+ :'page' => :'page',
39
+ :'total_users' => :'total_users',
40
+ :'users' => :'users'
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
+ :'_links' => :'PaginatedLinks',
53
+ :'created_before' => :'Integer',
54
+ :'limit' => :'Integer',
55
+ :'page' => :'Integer',
56
+ :'total_users' => :'Integer',
57
+ :'users' => :'Array<ListPaginatedUsersItem>'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ListPaginatedUsersResponse` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ListPaginatedUsersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'_links')
83
+ self._links = attributes[:'_links']
84
+ else
85
+ self._links = nil
86
+ end
87
+
88
+ if attributes.key?(:'created_before')
89
+ self.created_before = attributes[:'created_before']
90
+ else
91
+ self.created_before = nil
92
+ end
93
+
94
+ if attributes.key?(:'limit')
95
+ self.limit = attributes[:'limit']
96
+ else
97
+ self.limit = nil
98
+ end
99
+
100
+ if attributes.key?(:'page')
101
+ self.page = attributes[:'page']
102
+ else
103
+ self.page = nil
104
+ end
105
+
106
+ if attributes.key?(:'total_users')
107
+ self.total_users = attributes[:'total_users']
108
+ else
109
+ self.total_users = nil
110
+ end
111
+
112
+ if attributes.key?(:'users')
113
+ if (value = attributes[:'users']).is_a?(Array)
114
+ self.users = value
115
+ end
116
+ else
117
+ self.users = nil
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @_links.nil?
127
+ invalid_properties.push('invalid value for "_links", _links cannot be nil.')
128
+ end
129
+
130
+ if @created_before.nil?
131
+ invalid_properties.push('invalid value for "created_before", created_before cannot be nil.')
132
+ end
133
+
134
+ if @limit.nil?
135
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
136
+ end
137
+
138
+ if @page.nil?
139
+ invalid_properties.push('invalid value for "page", page cannot be nil.')
140
+ end
141
+
142
+ if @total_users.nil?
143
+ invalid_properties.push('invalid value for "total_users", total_users cannot be nil.')
144
+ end
145
+
146
+ if @users.nil?
147
+ invalid_properties.push('invalid value for "users", users cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @_links.nil?
158
+ return false if @created_before.nil?
159
+ return false if @limit.nil?
160
+ return false if @page.nil?
161
+ return false if @total_users.nil?
162
+ return false if @users.nil?
163
+ true
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ _links == o._links &&
172
+ created_before == o.created_before &&
173
+ limit == o.limit &&
174
+ page == o.page &&
175
+ total_users == o.total_users &&
176
+ users == o.users
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Integer] Hash code
187
+ def hash
188
+ [_links, created_before, limit, page, total_users, users].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def self.build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ attributes = attributes.transform_keys(&:to_sym)
197
+ transformed_hash = {}
198
+ openapi_types.each_pair do |key, type|
199
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
200
+ transformed_hash["#{key}"] = nil
201
+ elsif type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[attribute_map[key]].is_a?(Array)
205
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
206
+ end
207
+ elsif !attributes[attribute_map[key]].nil?
208
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
209
+ end
210
+ end
211
+ new(transformed_hash)
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def self._deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = OpenapiClient.const_get(type)
253
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+
303
+ end
304
+
305
+ end
@@ -73,13 +73,6 @@ module OpenapiClient
73
73
  ])
74
74
  end
75
75
 
76
- # List of class defined in allOf (OpenAPI v3)
77
- def self.openapi_all_of
78
- [
79
- :'UpdateMagicLinkAuthMethod'
80
- ]
81
- end
82
-
83
76
  # Initializes the object
84
77
  # @param [Hash] attributes Model attributes in the form of hash
85
78
  def initialize(attributes = {})