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,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 = {})
@@ -117,7 +117,7 @@ module OpenapiClient
117
117
  def valid?
118
118
  warn '[DEPRECATED] the `valid?` method is obsolete'
119
119
  return false if @code.nil?
120
- code_validator = EnumAttributeValidator.new('String', ["invalid_access_token"])
120
+ code_validator = EnumAttributeValidator.new('String', ["invalid_access_token", "invalid_nonce"])
121
121
  return false unless code_validator.valid?(@code)
122
122
  return false if @error.nil?
123
123
  true
@@ -126,7 +126,7 @@ module OpenapiClient
126
126
  # Custom attribute writer method checking allowed values (enum).
127
127
  # @param [Object] code Object to be assigned
128
128
  def code=(code)
129
- validator = EnumAttributeValidator.new('String', ["invalid_access_token"])
129
+ validator = EnumAttributeValidator.new('String', ["invalid_access_token", "invalid_nonce"])
130
130
  unless validator.valid?(code)
131
131
  fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
132
132
  end
@@ -0,0 +1,271 @@
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 Model403Error
18
+ attr_accessor :code
19
+
20
+ attr_accessor :error
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'code' => :'code',
48
+ :'error' => :'error'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'code' => :'String',
61
+ :'error' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Model403Error` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Model403Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'code')
87
+ self.code = attributes[:'code']
88
+ else
89
+ self.code = nil
90
+ end
91
+
92
+ if attributes.key?(:'error')
93
+ self.error = attributes[:'error']
94
+ else
95
+ self.error = nil
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @code.nil?
105
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
106
+ end
107
+
108
+ if @error.nil?
109
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ warn '[DEPRECATED] the `valid?` method is obsolete'
119
+ return false if @code.nil?
120
+ code_validator = EnumAttributeValidator.new('String', ["cannot_create_organization_billing_portal_session", "cannot_create_transaction", "cannot_delete_admin", "cannot_delete_organization_member", "cannot_self_update_organization_member", "operation_not_allowed"])
121
+ return false unless code_validator.valid?(@code)
122
+ return false if @error.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] code Object to be assigned
128
+ def code=(code)
129
+ validator = EnumAttributeValidator.new('String', ["cannot_create_organization_billing_portal_session", "cannot_create_transaction", "cannot_delete_admin", "cannot_delete_organization_member", "cannot_self_update_organization_member", "operation_not_allowed"])
130
+ unless validator.valid?(code)
131
+ fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
132
+ end
133
+ @code = code
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ code == o.code &&
142
+ error == o.error
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [code, error].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def self._deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = OpenapiClient.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end