passageidentity 0.5.0 → 0.6.1

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -2
  3. data/Gemfile +1 -1
  4. data/README.md +39 -21
  5. data/docs/generated/Link.md +18 -0
  6. data/docs/generated/ListPaginatedUsersItem.md +38 -0
  7. data/docs/generated/ListPaginatedUsersResponse.md +28 -0
  8. data/docs/generated/Model403Error.md +20 -0
  9. data/docs/generated/Nonce.md +18 -0
  10. data/docs/generated/PaginatedLinks.md +26 -0
  11. data/docs/generated/README.md +8 -3
  12. data/docs/generated/UserEventStatus.md +15 -0
  13. data/docs/generated/UserRecentEvent.md +4 -0
  14. data/docs/generated/UsersApi.md +94 -0
  15. data/lib/openapi_client/api/users_api.rb +96 -0
  16. data/lib/openapi_client/models/link.rb +221 -0
  17. data/lib/openapi_client/models/list_paginated_users_item.rb +399 -0
  18. data/lib/openapi_client/models/list_paginated_users_response.rb +305 -0
  19. data/lib/openapi_client/models/magic_link_auth_method.rb +0 -7
  20. data/lib/openapi_client/models/model401_error.rb +2 -2
  21. data/lib/openapi_client/models/model403_error.rb +271 -0
  22. data/lib/openapi_client/models/nonce.rb +222 -0
  23. data/lib/openapi_client/models/otp_auth_method.rb +0 -7
  24. data/lib/openapi_client/models/paginated_links.rb +285 -0
  25. data/lib/openapi_client/models/passkeys_auth_method.rb +0 -7
  26. data/lib/openapi_client/models/user_event_status.rb +40 -0
  27. data/lib/openapi_client/models/user_recent_event.rb +51 -1
  28. data/lib/openapi_client.rb +10 -3
  29. data/lib/passageidentity/user_api.rb +40 -0
  30. data/lib/passageidentity/version.rb +1 -1
  31. data/tests/user_api_test.rb +41 -0
  32. metadata +20 -9
  33. data/docs/generated/UpdateMagicLinkAuthMethod.md +0 -22
  34. data/docs/generated/UpdateOtpAuthMethod.md +0 -22
  35. data/docs/generated/UpdatePasskeysAuthMethod.md +0 -18
  36. /data/.github/workflows/{on_pr.yml → on-pull-request.yml} +0 -0
  37. /data/lib/{openapi_client/models → models}/update_magic_link_auth_method.rb +0 -0
  38. /data/lib/{openapi_client/models → models}/update_otp_auth_method.rb +0 -0
  39. /data/lib/{openapi_client/models → models}/update_passkeys_auth_method.rb +0 -0
@@ -0,0 +1,221 @@
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 Link
18
+ attr_accessor :href
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'href' => :'href'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'href' => :'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 `OpenapiClient::Link` 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 `OpenapiClient::Link`. 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?(:'href')
61
+ self.href = attributes[:'href']
62
+ else
63
+ self.href = nil
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
+ invalid_properties = Array.new
72
+ if @href.nil?
73
+ invalid_properties.push('invalid value for "href", href cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ return false if @href.nil?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ href == o.href
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [href].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = OpenapiClient.const_get(type)
169
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end
@@ -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