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