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