passageidentity 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +18 -61
  4. data/docs/custom/AuthApi.md +141 -0
  5. data/docs/custom/ClientApi.md +107 -0
  6. data/docs/custom/UserApi.md +419 -0
  7. data/docs/generated/AppInfo.md +94 -0
  8. data/docs/generated/AppResponse.md +18 -0
  9. data/docs/generated/AppsApi.md +77 -0
  10. data/docs/generated/AuthMethods.md +22 -0
  11. data/docs/generated/CreateMagicLinkRequest.md +36 -0
  12. data/docs/generated/CreateUserRequest.md +22 -0
  13. data/docs/generated/ElementCustomization.md +56 -0
  14. data/docs/generated/FontFamily.md +15 -0
  15. data/docs/generated/LayoutConfig.md +26 -0
  16. data/docs/generated/Layouts.md +20 -0
  17. data/docs/generated/ListDevicesResponse.md +18 -0
  18. data/docs/generated/MagicLink.md +36 -0
  19. data/docs/generated/MagicLinkAuthMethod.md +22 -0
  20. data/docs/generated/MagicLinkChannel.md +15 -0
  21. data/docs/generated/MagicLinkResponse.md +18 -0
  22. data/docs/generated/MagicLinkType.md +15 -0
  23. data/docs/generated/MagicLinksApi.md +79 -0
  24. data/docs/generated/Model400Error.md +20 -0
  25. data/docs/generated/Model401Error.md +20 -0
  26. data/docs/generated/Model404Error.md +20 -0
  27. data/docs/generated/Model500Error.md +20 -0
  28. data/docs/generated/OtpAuthMethod.md +22 -0
  29. data/docs/generated/PasskeysAuthMethod.md +18 -0
  30. data/docs/generated/Technologies.md +15 -0
  31. data/docs/generated/TokensApi.md +78 -0
  32. data/docs/generated/TtlDisplayUnit.md +15 -0
  33. data/docs/generated/UpdateMagicLinkAuthMethod.md +22 -0
  34. data/docs/generated/UpdateOtpAuthMethod.md +22 -0
  35. data/docs/generated/UpdatePasskeysAuthMethod.md +18 -0
  36. data/docs/generated/UpdateUserRequest.md +22 -0
  37. data/docs/generated/UserDevicesApi.md +152 -0
  38. data/docs/generated/UserEventInfo.md +26 -0
  39. data/docs/generated/UserInfo.md +46 -0
  40. data/docs/generated/UserMetadataField.md +28 -0
  41. data/docs/generated/UserMetadataFieldType.md +15 -0
  42. data/docs/generated/UserResponse.md +18 -0
  43. data/docs/generated/UserStatus.md +15 -0
  44. data/docs/generated/UsersApi.md +440 -0
  45. data/docs/generated/WebAuthnDevices.md +34 -0
  46. data/docs/generated/WebAuthnIcons.md +20 -0
  47. data/docs/generated/WebAuthnType.md +15 -0
  48. data/generate.sh +31 -0
  49. data/lib/openapi_client/api/apps_api.rb +85 -0
  50. data/lib/openapi_client/api/magic_links_api.rb +96 -0
  51. data/lib/openapi_client/api/tokens_api.rb +91 -0
  52. data/lib/openapi_client/api/user_devices_api.rb +166 -0
  53. data/lib/openapi_client/api/users_api.rb +452 -0
  54. data/lib/openapi_client/api_client.rb +431 -0
  55. data/lib/openapi_client/api_error.rb +58 -0
  56. data/lib/openapi_client/configuration.rb +383 -0
  57. data/lib/openapi_client/models/app_info.rb +853 -0
  58. data/lib/openapi_client/models/app_response.rb +221 -0
  59. data/lib/openapi_client/models/auth_methods.rb +254 -0
  60. data/lib/openapi_client/models/create_magic_link_request.rb +374 -0
  61. data/lib/openapi_client/models/create_user_request.rb +234 -0
  62. data/lib/openapi_client/models/element_customization.rb +457 -0
  63. data/lib/openapi_client/models/font_family.rb +58 -0
  64. data/lib/openapi_client/models/layout_config.rb +285 -0
  65. data/lib/openapi_client/models/layouts.rb +241 -0
  66. data/lib/openapi_client/models/list_devices_response.rb +223 -0
  67. data/lib/openapi_client/models/magic_link.rb +387 -0
  68. data/lib/openapi_client/models/magic_link_auth_method.rb +302 -0
  69. data/lib/openapi_client/models/magic_link_channel.rb +40 -0
  70. data/lib/openapi_client/models/magic_link_response.rb +221 -0
  71. data/lib/openapi_client/models/magic_link_type.rb +40 -0
  72. data/lib/openapi_client/models/model400_error.rb +271 -0
  73. data/lib/openapi_client/models/model401_error.rb +271 -0
  74. data/lib/openapi_client/models/model404_error.rb +271 -0
  75. data/lib/openapi_client/models/model500_error.rb +271 -0
  76. data/lib/openapi_client/models/otp_auth_method.rb +302 -0
  77. data/lib/openapi_client/models/passkeys_auth_method.rb +228 -0
  78. data/lib/openapi_client/models/technologies.rb +46 -0
  79. data/lib/openapi_client/models/ttl_display_unit.rb +42 -0
  80. data/lib/openapi_client/models/update_magic_link_auth_method.rb +276 -0
  81. data/lib/openapi_client/models/update_otp_auth_method.rb +276 -0
  82. data/lib/openapi_client/models/update_passkeys_auth_method.rb +216 -0
  83. data/lib/openapi_client/models/update_user_request.rb +232 -0
  84. data/lib/openapi_client/models/user_event_info.rb +285 -0
  85. data/lib/openapi_client/models/user_info.rb +470 -0
  86. data/lib/openapi_client/models/user_metadata_field.rb +323 -0
  87. data/lib/openapi_client/models/user_metadata_field_type.rb +44 -0
  88. data/lib/openapi_client/models/user_response.rb +221 -0
  89. data/lib/openapi_client/models/user_status.rb +41 -0
  90. data/lib/openapi_client/models/web_authn_devices.rb +378 -0
  91. data/lib/openapi_client/models/web_authn_icons.rb +230 -0
  92. data/lib/openapi_client/models/web_authn_type.rb +41 -0
  93. data/lib/openapi_client/version.rb +15 -0
  94. data/lib/openapi_client.rb +74 -0
  95. data/lib/passageidentity/auth.rb +32 -5
  96. data/lib/passageidentity/client.rb +17 -121
  97. data/lib/passageidentity/user_api.rb +29 -131
  98. data/lib/passageidentity/version.rb +5 -0
  99. data/openapitools.json +7 -0
  100. data/passageidentity.gemspec +3 -1
  101. data/tests/auth_test.rb +6 -1
  102. data/tests/magic_link_test.rb +5 -4
  103. data/tests/user_api_test.rb +2 -2
  104. metadata +96 -2
@@ -0,0 +1,470 @@
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 UserInfo
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 :recent_events
35
+
36
+ attr_accessor :status
37
+
38
+ attr_accessor :updated_at
39
+
40
+ attr_accessor :user_metadata
41
+
42
+ attr_accessor :webauthn
43
+
44
+ attr_accessor :webauthn_devices
45
+
46
+ # List of credential types that have been used for authentication
47
+ attr_accessor :webauthn_types
48
+
49
+ class EnumAttributeValidator
50
+ attr_reader :datatype
51
+ attr_reader :allowable_values
52
+
53
+ def initialize(datatype, allowable_values)
54
+ @allowable_values = allowable_values.map do |value|
55
+ case datatype.to_s
56
+ when /Integer/i
57
+ value.to_i
58
+ when /Float/i
59
+ value.to_f
60
+ else
61
+ value
62
+ end
63
+ end
64
+ end
65
+
66
+ def valid?(value)
67
+ !value || allowable_values.include?(value)
68
+ end
69
+ end
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'created_at' => :'created_at',
75
+ :'email' => :'email',
76
+ :'email_verified' => :'email_verified',
77
+ :'id' => :'id',
78
+ :'last_login_at' => :'last_login_at',
79
+ :'login_count' => :'login_count',
80
+ :'phone' => :'phone',
81
+ :'phone_verified' => :'phone_verified',
82
+ :'recent_events' => :'recent_events',
83
+ :'status' => :'status',
84
+ :'updated_at' => :'updated_at',
85
+ :'user_metadata' => :'user_metadata',
86
+ :'webauthn' => :'webauthn',
87
+ :'webauthn_devices' => :'webauthn_devices',
88
+ :'webauthn_types' => :'webauthn_types'
89
+ }
90
+ end
91
+
92
+ # Returns all the JSON keys this model knows about
93
+ def self.acceptable_attributes
94
+ attribute_map.values
95
+ end
96
+
97
+ # Attribute type mapping.
98
+ def self.openapi_types
99
+ {
100
+ :'created_at' => :'Time',
101
+ :'email' => :'String',
102
+ :'email_verified' => :'Boolean',
103
+ :'id' => :'String',
104
+ :'last_login_at' => :'Time',
105
+ :'login_count' => :'Integer',
106
+ :'phone' => :'String',
107
+ :'phone_verified' => :'Boolean',
108
+ :'recent_events' => :'Array<UserEventInfo>',
109
+ :'status' => :'UserStatus',
110
+ :'updated_at' => :'Time',
111
+ :'user_metadata' => :'Object',
112
+ :'webauthn' => :'Boolean',
113
+ :'webauthn_devices' => :'Array<WebAuthnDevices>',
114
+ :'webauthn_types' => :'Array<WebAuthnType>'
115
+ }
116
+ end
117
+
118
+ # List of attributes with nullable: true
119
+ def self.openapi_nullable
120
+ Set.new([
121
+ :'user_metadata',
122
+ ])
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UserInfo` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ attributes = attributes.each_with_object({}) { |(k, v), h|
134
+ if (!self.class.attribute_map.key?(k.to_sym))
135
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UserInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
136
+ end
137
+ h[k.to_sym] = v
138
+ }
139
+
140
+ if attributes.key?(:'created_at')
141
+ self.created_at = attributes[:'created_at']
142
+ else
143
+ self.created_at = nil
144
+ end
145
+
146
+ if attributes.key?(:'email')
147
+ self.email = attributes[:'email']
148
+ else
149
+ self.email = nil
150
+ end
151
+
152
+ if attributes.key?(:'email_verified')
153
+ self.email_verified = attributes[:'email_verified']
154
+ else
155
+ self.email_verified = nil
156
+ end
157
+
158
+ if attributes.key?(:'id')
159
+ self.id = attributes[:'id']
160
+ else
161
+ self.id = nil
162
+ end
163
+
164
+ if attributes.key?(:'last_login_at')
165
+ self.last_login_at = attributes[:'last_login_at']
166
+ else
167
+ self.last_login_at = nil
168
+ end
169
+
170
+ if attributes.key?(:'login_count')
171
+ self.login_count = attributes[:'login_count']
172
+ else
173
+ self.login_count = nil
174
+ end
175
+
176
+ if attributes.key?(:'phone')
177
+ self.phone = attributes[:'phone']
178
+ else
179
+ self.phone = nil
180
+ end
181
+
182
+ if attributes.key?(:'phone_verified')
183
+ self.phone_verified = attributes[:'phone_verified']
184
+ else
185
+ self.phone_verified = nil
186
+ end
187
+
188
+ if attributes.key?(:'recent_events')
189
+ if (value = attributes[:'recent_events']).is_a?(Array)
190
+ self.recent_events = value
191
+ end
192
+ else
193
+ self.recent_events = nil
194
+ end
195
+
196
+ if attributes.key?(:'status')
197
+ self.status = attributes[:'status']
198
+ else
199
+ self.status = nil
200
+ end
201
+
202
+ if attributes.key?(:'updated_at')
203
+ self.updated_at = attributes[:'updated_at']
204
+ else
205
+ self.updated_at = nil
206
+ end
207
+
208
+ if attributes.key?(:'user_metadata')
209
+ self.user_metadata = attributes[:'user_metadata']
210
+ else
211
+ self.user_metadata = nil
212
+ end
213
+
214
+ if attributes.key?(:'webauthn')
215
+ self.webauthn = attributes[:'webauthn']
216
+ else
217
+ self.webauthn = nil
218
+ end
219
+
220
+ if attributes.key?(:'webauthn_devices')
221
+ if (value = attributes[:'webauthn_devices']).is_a?(Array)
222
+ self.webauthn_devices = value
223
+ end
224
+ else
225
+ self.webauthn_devices = nil
226
+ end
227
+
228
+ if attributes.key?(:'webauthn_types')
229
+ if (value = attributes[:'webauthn_types']).is_a?(Array)
230
+ self.webauthn_types = value
231
+ end
232
+ else
233
+ self.webauthn_types = nil
234
+ end
235
+ end
236
+
237
+ # Show invalid properties with the reasons. Usually used together with valid?
238
+ # @return Array for valid properties with the reasons
239
+ def list_invalid_properties
240
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
241
+ invalid_properties = Array.new
242
+ if @created_at.nil?
243
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
244
+ end
245
+
246
+ if @email.nil?
247
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
248
+ end
249
+
250
+ if @email_verified.nil?
251
+ invalid_properties.push('invalid value for "email_verified", email_verified cannot be nil.')
252
+ end
253
+
254
+ if @id.nil?
255
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
256
+ end
257
+
258
+ if @last_login_at.nil?
259
+ invalid_properties.push('invalid value for "last_login_at", last_login_at cannot be nil.')
260
+ end
261
+
262
+ if @login_count.nil?
263
+ invalid_properties.push('invalid value for "login_count", login_count cannot be nil.')
264
+ end
265
+
266
+ if @phone.nil?
267
+ invalid_properties.push('invalid value for "phone", phone cannot be nil.')
268
+ end
269
+
270
+ if @phone_verified.nil?
271
+ invalid_properties.push('invalid value for "phone_verified", phone_verified cannot be nil.')
272
+ end
273
+
274
+ if @recent_events.nil?
275
+ invalid_properties.push('invalid value for "recent_events", recent_events cannot be nil.')
276
+ end
277
+
278
+ if @status.nil?
279
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
280
+ end
281
+
282
+ if @updated_at.nil?
283
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
284
+ end
285
+
286
+ if @webauthn.nil?
287
+ invalid_properties.push('invalid value for "webauthn", webauthn cannot be nil.')
288
+ end
289
+
290
+ if @webauthn_devices.nil?
291
+ invalid_properties.push('invalid value for "webauthn_devices", webauthn_devices cannot be nil.')
292
+ end
293
+
294
+ if @webauthn_types.nil?
295
+ invalid_properties.push('invalid value for "webauthn_types", webauthn_types cannot be nil.')
296
+ end
297
+
298
+ invalid_properties
299
+ end
300
+
301
+ # Check to see if the all the properties in the model are valid
302
+ # @return true if the model is valid
303
+ def valid?
304
+ warn '[DEPRECATED] the `valid?` method is obsolete'
305
+ return false if @created_at.nil?
306
+ return false if @email.nil?
307
+ return false if @email_verified.nil?
308
+ return false if @id.nil?
309
+ return false if @last_login_at.nil?
310
+ return false if @login_count.nil?
311
+ return false if @phone.nil?
312
+ return false if @phone_verified.nil?
313
+ return false if @recent_events.nil?
314
+ return false if @status.nil?
315
+ return false if @updated_at.nil?
316
+ return false if @webauthn.nil?
317
+ return false if @webauthn_devices.nil?
318
+ return false if @webauthn_types.nil?
319
+ true
320
+ end
321
+
322
+ # Checks equality by comparing each attribute.
323
+ # @param [Object] Object to be compared
324
+ def ==(o)
325
+ return true if self.equal?(o)
326
+ self.class == o.class &&
327
+ created_at == o.created_at &&
328
+ email == o.email &&
329
+ email_verified == o.email_verified &&
330
+ id == o.id &&
331
+ last_login_at == o.last_login_at &&
332
+ login_count == o.login_count &&
333
+ phone == o.phone &&
334
+ phone_verified == o.phone_verified &&
335
+ recent_events == o.recent_events &&
336
+ status == o.status &&
337
+ updated_at == o.updated_at &&
338
+ user_metadata == o.user_metadata &&
339
+ webauthn == o.webauthn &&
340
+ webauthn_devices == o.webauthn_devices &&
341
+ webauthn_types == o.webauthn_types
342
+ end
343
+
344
+ # @see the `==` method
345
+ # @param [Object] Object to be compared
346
+ def eql?(o)
347
+ self == o
348
+ end
349
+
350
+ # Calculates hash code according to all attributes.
351
+ # @return [Integer] Hash code
352
+ def hash
353
+ [created_at, email, email_verified, id, last_login_at, login_count, phone, phone_verified, recent_events, status, updated_at, user_metadata, webauthn, webauthn_devices, webauthn_types].hash
354
+ end
355
+
356
+ # Builds the object from hash
357
+ # @param [Hash] attributes Model attributes in the form of hash
358
+ # @return [Object] Returns the model itself
359
+ def self.build_from_hash(attributes)
360
+ return nil unless attributes.is_a?(Hash)
361
+ attributes = attributes.transform_keys(&:to_sym)
362
+ transformed_hash = {}
363
+ openapi_types.each_pair do |key, type|
364
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
365
+ transformed_hash["#{key}"] = nil
366
+ elsif type =~ /\AArray<(.*)>/i
367
+ # check to ensure the input is an array given that the attribute
368
+ # is documented as an array but the input is not
369
+ if attributes[attribute_map[key]].is_a?(Array)
370
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
371
+ end
372
+ elsif !attributes[attribute_map[key]].nil?
373
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
374
+ end
375
+ end
376
+ new(transformed_hash)
377
+ end
378
+
379
+ # Deserializes the data based on type
380
+ # @param string type Data type
381
+ # @param string value Value to be deserialized
382
+ # @return [Object] Deserialized data
383
+ def self._deserialize(type, value)
384
+ case type.to_sym
385
+ when :Time
386
+ Time.parse(value)
387
+ when :Date
388
+ Date.parse(value)
389
+ when :String
390
+ value.to_s
391
+ when :Integer
392
+ value.to_i
393
+ when :Float
394
+ value.to_f
395
+ when :Boolean
396
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
397
+ true
398
+ else
399
+ false
400
+ end
401
+ when :Object
402
+ # generic object (usually a Hash), return directly
403
+ value
404
+ when /\AArray<(?<inner_type>.+)>\z/
405
+ inner_type = Regexp.last_match[:inner_type]
406
+ value.map { |v| _deserialize(inner_type, v) }
407
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
408
+ k_type = Regexp.last_match[:k_type]
409
+ v_type = Regexp.last_match[:v_type]
410
+ {}.tap do |hash|
411
+ value.each do |k, v|
412
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
413
+ end
414
+ end
415
+ else # model
416
+ # models (e.g. Pet) or oneOf
417
+ klass = OpenapiClient.const_get(type)
418
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
419
+ end
420
+ end
421
+
422
+ # Returns the string representation of the object
423
+ # @return [String] String presentation of the object
424
+ def to_s
425
+ to_hash.to_s
426
+ end
427
+
428
+ # to_body is an alias to to_hash (backward compatibility)
429
+ # @return [Hash] Returns the object in the form of hash
430
+ def to_body
431
+ to_hash
432
+ end
433
+
434
+ # Returns the object in the form of hash
435
+ # @return [Hash] Returns the object in the form of hash
436
+ def to_hash
437
+ hash = {}
438
+ self.class.attribute_map.each_pair do |attr, param|
439
+ value = self.send(attr)
440
+ if value.nil?
441
+ is_nullable = self.class.openapi_nullable.include?(attr)
442
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
443
+ end
444
+
445
+ hash[param] = _to_hash(value)
446
+ end
447
+ hash
448
+ end
449
+
450
+ # Outputs non-array value in the form of hash
451
+ # For object, use to_hash. Otherwise, just return the value
452
+ # @param [Object] value Any valid value
453
+ # @return [Hash] Returns the value in the form of hash
454
+ def _to_hash(value)
455
+ if value.is_a?(Array)
456
+ value.compact.map { |v| _to_hash(v) }
457
+ elsif value.is_a?(Hash)
458
+ {}.tap do |hash|
459
+ value.each { |k, v| hash[k] = _to_hash(v) }
460
+ end
461
+ elsif value.respond_to? :to_hash
462
+ value.to_hash
463
+ else
464
+ value
465
+ end
466
+ end
467
+
468
+ end
469
+
470
+ end