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