torii-backend 0.0.2
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.
- checksums.yaml +7 -0
- data/README.md +120 -0
- data/spec/server-v1.json +1 -0
- data/src/torii/backend/auth.rb +28 -0
- data/src/torii/backend/authenticate_request.rb +56 -0
- data/src/torii/backend/client.rb +232 -0
- data/src/torii/backend/errors.rb +34 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/api/server_sessions_api.rb +217 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/api/server_users_api.rb +486 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/api_client.rb +396 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/api_error.rb +58 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/api_model_base.rb +88 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/configuration.rb +301 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/create_user_request.rb +205 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/cursor_page_response_user_response.rb +206 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/problem_detail.rb +194 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/server_user_search_request.rb +217 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/update_user_request.rb +228 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/user_response.rb +387 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/models/user_session_response.rb +323 -0
- data/src/torii/backend/generated/lib/torii-backend-generated/version.rb +15 -0
- data/src/torii/backend/generated/lib/torii-backend-generated.rb +49 -0
- data/src/torii/backend/patch.rb +23 -0
- data/src/torii/backend/rack.rb +69 -0
- data/src/torii/backend/verify.rb +162 -0
- data/src/torii/backend/version.rb +7 -0
- data/src/torii/backend/webhook.rb +19 -0
- data/src/torii/backend.rb +22 -0
- data/src/torii-backend-generated.rb +26 -0
- metadata +163 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#OpenAPI definition
|
|
3
|
+
|
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module ToriiBackendGenerated
|
|
17
|
+
# An end-user belonging to one of your environments.
|
|
18
|
+
class UserResponse < ApiModelBase
|
|
19
|
+
# Unique identifier for this user.
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# Identifier of the environment this user belongs to.
|
|
23
|
+
attr_accessor :environment_id
|
|
24
|
+
|
|
25
|
+
# Full name on the profile, if any.
|
|
26
|
+
attr_accessor :name
|
|
27
|
+
|
|
28
|
+
# Phone number on the profile, if any. Not guaranteed to be verified.
|
|
29
|
+
attr_accessor :phone
|
|
30
|
+
|
|
31
|
+
# Preferred locale for emails and UI messages.
|
|
32
|
+
attr_accessor :locale
|
|
33
|
+
|
|
34
|
+
# Free-form address string, if provided.
|
|
35
|
+
attr_accessor :address
|
|
36
|
+
|
|
37
|
+
# Date of birth in ISO-8601 (YYYY-MM-DD), if provided.
|
|
38
|
+
attr_accessor :date_of_birth
|
|
39
|
+
|
|
40
|
+
# Lifecycle status of the user (e.g. active, banned).
|
|
41
|
+
attr_accessor :status
|
|
42
|
+
|
|
43
|
+
# When this user was created (ISO-8601 UTC).
|
|
44
|
+
attr_accessor :created_at
|
|
45
|
+
|
|
46
|
+
# When this user was last modified (ISO-8601 UTC).
|
|
47
|
+
attr_accessor :updated_at
|
|
48
|
+
|
|
49
|
+
# Primary email on the profile, if any. Not guaranteed to be verified.
|
|
50
|
+
attr_accessor :email
|
|
51
|
+
|
|
52
|
+
# When this user was deleted, if soft-deleted. Null for active users.
|
|
53
|
+
attr_accessor :deleted_at
|
|
54
|
+
|
|
55
|
+
class EnumAttributeValidator
|
|
56
|
+
attr_reader :datatype
|
|
57
|
+
attr_reader :allowable_values
|
|
58
|
+
|
|
59
|
+
def initialize(datatype, allowable_values)
|
|
60
|
+
@allowable_values = allowable_values.map do |value|
|
|
61
|
+
case datatype.to_s
|
|
62
|
+
when /Integer/i
|
|
63
|
+
value.to_i
|
|
64
|
+
when /Float/i
|
|
65
|
+
value.to_f
|
|
66
|
+
else
|
|
67
|
+
value
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def valid?(value)
|
|
73
|
+
!value || allowable_values.include?(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
78
|
+
def self.attribute_map
|
|
79
|
+
{
|
|
80
|
+
:'id' => :'id',
|
|
81
|
+
:'environment_id' => :'environmentId',
|
|
82
|
+
:'name' => :'name',
|
|
83
|
+
:'phone' => :'phone',
|
|
84
|
+
:'locale' => :'locale',
|
|
85
|
+
:'address' => :'address',
|
|
86
|
+
:'date_of_birth' => :'dateOfBirth',
|
|
87
|
+
:'status' => :'status',
|
|
88
|
+
:'created_at' => :'createdAt',
|
|
89
|
+
:'updated_at' => :'updatedAt',
|
|
90
|
+
:'email' => :'email',
|
|
91
|
+
:'deleted_at' => :'deletedAt'
|
|
92
|
+
}
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Returns attribute mapping this model knows about
|
|
96
|
+
def self.acceptable_attribute_map
|
|
97
|
+
attribute_map
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Returns all the JSON keys this model knows about
|
|
101
|
+
def self.acceptable_attributes
|
|
102
|
+
acceptable_attribute_map.values
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Attribute type mapping.
|
|
106
|
+
def self.openapi_types
|
|
107
|
+
{
|
|
108
|
+
:'id' => :'String',
|
|
109
|
+
:'environment_id' => :'String',
|
|
110
|
+
:'name' => :'String',
|
|
111
|
+
:'phone' => :'String',
|
|
112
|
+
:'locale' => :'String',
|
|
113
|
+
:'address' => :'String',
|
|
114
|
+
:'date_of_birth' => :'Date',
|
|
115
|
+
:'status' => :'String',
|
|
116
|
+
:'created_at' => :'Time',
|
|
117
|
+
:'updated_at' => :'Time',
|
|
118
|
+
:'email' => :'String',
|
|
119
|
+
:'deleted_at' => :'Time'
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# List of attributes with nullable: true
|
|
124
|
+
def self.openapi_nullable
|
|
125
|
+
Set.new([
|
|
126
|
+
:'name',
|
|
127
|
+
:'phone',
|
|
128
|
+
:'locale',
|
|
129
|
+
:'address',
|
|
130
|
+
:'date_of_birth',
|
|
131
|
+
:'email',
|
|
132
|
+
:'deleted_at'
|
|
133
|
+
])
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Initializes the object
|
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
138
|
+
def initialize(attributes = {})
|
|
139
|
+
if (!attributes.is_a?(Hash))
|
|
140
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::UserResponse` initialize method"
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
144
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
145
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
146
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
147
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::UserResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
148
|
+
end
|
|
149
|
+
h[k.to_sym] = v
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if attributes.key?(:'id')
|
|
153
|
+
self.id = attributes[:'id']
|
|
154
|
+
else
|
|
155
|
+
self.id = nil
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'environment_id')
|
|
159
|
+
self.environment_id = attributes[:'environment_id']
|
|
160
|
+
else
|
|
161
|
+
self.environment_id = nil
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if attributes.key?(:'name')
|
|
165
|
+
self.name = attributes[:'name']
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if attributes.key?(:'phone')
|
|
169
|
+
self.phone = attributes[:'phone']
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'locale')
|
|
173
|
+
self.locale = attributes[:'locale']
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if attributes.key?(:'address')
|
|
177
|
+
self.address = attributes[:'address']
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
if attributes.key?(:'date_of_birth')
|
|
181
|
+
self.date_of_birth = attributes[:'date_of_birth']
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if attributes.key?(:'status')
|
|
185
|
+
self.status = attributes[:'status']
|
|
186
|
+
else
|
|
187
|
+
self.status = nil
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if attributes.key?(:'created_at')
|
|
191
|
+
self.created_at = attributes[:'created_at']
|
|
192
|
+
else
|
|
193
|
+
self.created_at = nil
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
if attributes.key?(:'updated_at')
|
|
197
|
+
self.updated_at = attributes[:'updated_at']
|
|
198
|
+
else
|
|
199
|
+
self.updated_at = nil
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if attributes.key?(:'email')
|
|
203
|
+
self.email = attributes[:'email']
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if attributes.key?(:'deleted_at')
|
|
207
|
+
self.deleted_at = attributes[:'deleted_at']
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
212
|
+
# @return Array for valid properties with the reasons
|
|
213
|
+
def list_invalid_properties
|
|
214
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
215
|
+
invalid_properties = Array.new
|
|
216
|
+
if @id.nil?
|
|
217
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if @environment_id.nil?
|
|
221
|
+
invalid_properties.push('invalid value for "environment_id", environment_id cannot be nil.')
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
if @status.nil?
|
|
225
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
if @created_at.nil?
|
|
229
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
if @updated_at.nil?
|
|
233
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
invalid_properties
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Check to see if the all the properties in the model are valid
|
|
240
|
+
# @return true if the model is valid
|
|
241
|
+
def valid?
|
|
242
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
243
|
+
return false if @id.nil?
|
|
244
|
+
return false if @environment_id.nil?
|
|
245
|
+
locale_validator = EnumAttributeValidator.new('String', ["en", "da"])
|
|
246
|
+
return false unless locale_validator.valid?(@locale)
|
|
247
|
+
return false if @status.nil?
|
|
248
|
+
status_validator = EnumAttributeValidator.new('String', ["pending_verification", "active", "banned", "deleted"])
|
|
249
|
+
return false unless status_validator.valid?(@status)
|
|
250
|
+
return false if @created_at.nil?
|
|
251
|
+
return false if @updated_at.nil?
|
|
252
|
+
true
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Custom attribute writer method with validation
|
|
256
|
+
# @param [Object] id Value to be assigned
|
|
257
|
+
def id=(id)
|
|
258
|
+
if id.nil?
|
|
259
|
+
fail ArgumentError, 'id cannot be nil'
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
@id = id
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Custom attribute writer method with validation
|
|
266
|
+
# @param [Object] environment_id Value to be assigned
|
|
267
|
+
def environment_id=(environment_id)
|
|
268
|
+
if environment_id.nil?
|
|
269
|
+
fail ArgumentError, 'environment_id cannot be nil'
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
@environment_id = environment_id
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
276
|
+
# @param [Object] locale Object to be assigned
|
|
277
|
+
def locale=(locale)
|
|
278
|
+
validator = EnumAttributeValidator.new('String', ["en", "da"])
|
|
279
|
+
unless validator.valid?(locale)
|
|
280
|
+
fail ArgumentError, "invalid value for \"locale\", must be one of #{validator.allowable_values}."
|
|
281
|
+
end
|
|
282
|
+
@locale = locale
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
286
|
+
# @param [Object] status Object to be assigned
|
|
287
|
+
def status=(status)
|
|
288
|
+
validator = EnumAttributeValidator.new('String', ["pending_verification", "active", "banned", "deleted"])
|
|
289
|
+
unless validator.valid?(status)
|
|
290
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
291
|
+
end
|
|
292
|
+
@status = status
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
# Custom attribute writer method with validation
|
|
296
|
+
# @param [Object] created_at Value to be assigned
|
|
297
|
+
def created_at=(created_at)
|
|
298
|
+
if created_at.nil?
|
|
299
|
+
fail ArgumentError, 'created_at cannot be nil'
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
@created_at = created_at
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Custom attribute writer method with validation
|
|
306
|
+
# @param [Object] updated_at Value to be assigned
|
|
307
|
+
def updated_at=(updated_at)
|
|
308
|
+
if updated_at.nil?
|
|
309
|
+
fail ArgumentError, 'updated_at cannot be nil'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
@updated_at = updated_at
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Checks equality by comparing each attribute.
|
|
316
|
+
# @param [Object] Object to be compared
|
|
317
|
+
def ==(o)
|
|
318
|
+
return true if self.equal?(o)
|
|
319
|
+
self.class == o.class &&
|
|
320
|
+
id == o.id &&
|
|
321
|
+
environment_id == o.environment_id &&
|
|
322
|
+
name == o.name &&
|
|
323
|
+
phone == o.phone &&
|
|
324
|
+
locale == o.locale &&
|
|
325
|
+
address == o.address &&
|
|
326
|
+
date_of_birth == o.date_of_birth &&
|
|
327
|
+
status == o.status &&
|
|
328
|
+
created_at == o.created_at &&
|
|
329
|
+
updated_at == o.updated_at &&
|
|
330
|
+
email == o.email &&
|
|
331
|
+
deleted_at == o.deleted_at
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# @see the `==` method
|
|
335
|
+
# @param [Object] Object to be compared
|
|
336
|
+
def eql?(o)
|
|
337
|
+
self == o
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Calculates hash code according to all attributes.
|
|
341
|
+
# @return [Integer] Hash code
|
|
342
|
+
def hash
|
|
343
|
+
[id, environment_id, name, phone, locale, address, date_of_birth, status, created_at, updated_at, email, deleted_at].hash
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Builds the object from hash
|
|
347
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
348
|
+
# @return [Object] Returns the model itself
|
|
349
|
+
def self.build_from_hash(attributes)
|
|
350
|
+
return nil unless attributes.is_a?(Hash)
|
|
351
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
352
|
+
transformed_hash = {}
|
|
353
|
+
openapi_types.each_pair do |key, type|
|
|
354
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
355
|
+
transformed_hash["#{key}"] = nil
|
|
356
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
357
|
+
# check to ensure the input is an array given that the attribute
|
|
358
|
+
# is documented as an array but the input is not
|
|
359
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
360
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
361
|
+
end
|
|
362
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
363
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
new(transformed_hash)
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
# Returns the object in the form of hash
|
|
370
|
+
# @return [Hash] Returns the object in the form of hash
|
|
371
|
+
def to_hash
|
|
372
|
+
hash = {}
|
|
373
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
374
|
+
value = self.send(attr)
|
|
375
|
+
if value.nil?
|
|
376
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
377
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
hash[param] = _to_hash(value)
|
|
381
|
+
end
|
|
382
|
+
hash
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
end
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#OpenAPI definition
|
|
3
|
+
|
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module ToriiBackendGenerated
|
|
17
|
+
# An active end-user session in your environment.
|
|
18
|
+
class UserSessionResponse < ApiModelBase
|
|
19
|
+
# Unique identifier for this session.
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# Identifier of the end-user this session belongs to.
|
|
23
|
+
attr_accessor :user_id
|
|
24
|
+
|
|
25
|
+
# Identifier of the environment this session belongs to.
|
|
26
|
+
attr_accessor :environment_id
|
|
27
|
+
|
|
28
|
+
# Raw User-Agent string captured when the session was created.
|
|
29
|
+
attr_accessor :user_agent
|
|
30
|
+
|
|
31
|
+
# IP address captured when the session was created.
|
|
32
|
+
attr_accessor :ip_address
|
|
33
|
+
|
|
34
|
+
# When this session was created (ISO-8601 UTC).
|
|
35
|
+
attr_accessor :created_at
|
|
36
|
+
|
|
37
|
+
# When this session expires (ISO-8601 UTC).
|
|
38
|
+
attr_accessor :expires_at
|
|
39
|
+
|
|
40
|
+
# When this session was last seen by the API (ISO-8601 UTC).
|
|
41
|
+
attr_accessor :last_used_at
|
|
42
|
+
|
|
43
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
44
|
+
def self.attribute_map
|
|
45
|
+
{
|
|
46
|
+
:'id' => :'id',
|
|
47
|
+
:'user_id' => :'userId',
|
|
48
|
+
:'environment_id' => :'environmentId',
|
|
49
|
+
:'user_agent' => :'userAgent',
|
|
50
|
+
:'ip_address' => :'ipAddress',
|
|
51
|
+
:'created_at' => :'createdAt',
|
|
52
|
+
:'expires_at' => :'expiresAt',
|
|
53
|
+
:'last_used_at' => :'lastUsedAt'
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Returns attribute mapping this model knows about
|
|
58
|
+
def self.acceptable_attribute_map
|
|
59
|
+
attribute_map
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Returns all the JSON keys this model knows about
|
|
63
|
+
def self.acceptable_attributes
|
|
64
|
+
acceptable_attribute_map.values
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Attribute type mapping.
|
|
68
|
+
def self.openapi_types
|
|
69
|
+
{
|
|
70
|
+
:'id' => :'String',
|
|
71
|
+
:'user_id' => :'String',
|
|
72
|
+
:'environment_id' => :'String',
|
|
73
|
+
:'user_agent' => :'String',
|
|
74
|
+
:'ip_address' => :'String',
|
|
75
|
+
:'created_at' => :'Time',
|
|
76
|
+
:'expires_at' => :'Time',
|
|
77
|
+
:'last_used_at' => :'Time'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# List of attributes with nullable: true
|
|
82
|
+
def self.openapi_nullable
|
|
83
|
+
Set.new([
|
|
84
|
+
:'user_agent',
|
|
85
|
+
:'ip_address',
|
|
86
|
+
])
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Initializes the object
|
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
91
|
+
def initialize(attributes = {})
|
|
92
|
+
if (!attributes.is_a?(Hash))
|
|
93
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::UserSessionResponse` initialize method"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
97
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
99
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
100
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::UserSessionResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
101
|
+
end
|
|
102
|
+
h[k.to_sym] = v
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'id')
|
|
106
|
+
self.id = attributes[:'id']
|
|
107
|
+
else
|
|
108
|
+
self.id = nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'user_id')
|
|
112
|
+
self.user_id = attributes[:'user_id']
|
|
113
|
+
else
|
|
114
|
+
self.user_id = nil
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'environment_id')
|
|
118
|
+
self.environment_id = attributes[:'environment_id']
|
|
119
|
+
else
|
|
120
|
+
self.environment_id = nil
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'user_agent')
|
|
124
|
+
self.user_agent = attributes[:'user_agent']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'ip_address')
|
|
128
|
+
self.ip_address = attributes[:'ip_address']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'created_at')
|
|
132
|
+
self.created_at = attributes[:'created_at']
|
|
133
|
+
else
|
|
134
|
+
self.created_at = nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'expires_at')
|
|
138
|
+
self.expires_at = attributes[:'expires_at']
|
|
139
|
+
else
|
|
140
|
+
self.expires_at = nil
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'last_used_at')
|
|
144
|
+
self.last_used_at = attributes[:'last_used_at']
|
|
145
|
+
else
|
|
146
|
+
self.last_used_at = nil
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
151
|
+
# @return Array for valid properties with the reasons
|
|
152
|
+
def list_invalid_properties
|
|
153
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
154
|
+
invalid_properties = Array.new
|
|
155
|
+
if @id.nil?
|
|
156
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if @user_id.nil?
|
|
160
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if @environment_id.nil?
|
|
164
|
+
invalid_properties.push('invalid value for "environment_id", environment_id cannot be nil.')
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if @created_at.nil?
|
|
168
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if @expires_at.nil?
|
|
172
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if @last_used_at.nil?
|
|
176
|
+
invalid_properties.push('invalid value for "last_used_at", last_used_at cannot be nil.')
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
invalid_properties
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Check to see if the all the properties in the model are valid
|
|
183
|
+
# @return true if the model is valid
|
|
184
|
+
def valid?
|
|
185
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
186
|
+
return false if @id.nil?
|
|
187
|
+
return false if @user_id.nil?
|
|
188
|
+
return false if @environment_id.nil?
|
|
189
|
+
return false if @created_at.nil?
|
|
190
|
+
return false if @expires_at.nil?
|
|
191
|
+
return false if @last_used_at.nil?
|
|
192
|
+
true
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Custom attribute writer method with validation
|
|
196
|
+
# @param [Object] id Value to be assigned
|
|
197
|
+
def id=(id)
|
|
198
|
+
if id.nil?
|
|
199
|
+
fail ArgumentError, 'id cannot be nil'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
@id = id
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Custom attribute writer method with validation
|
|
206
|
+
# @param [Object] user_id Value to be assigned
|
|
207
|
+
def user_id=(user_id)
|
|
208
|
+
if user_id.nil?
|
|
209
|
+
fail ArgumentError, 'user_id cannot be nil'
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
@user_id = user_id
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Custom attribute writer method with validation
|
|
216
|
+
# @param [Object] environment_id Value to be assigned
|
|
217
|
+
def environment_id=(environment_id)
|
|
218
|
+
if environment_id.nil?
|
|
219
|
+
fail ArgumentError, 'environment_id cannot be nil'
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
@environment_id = environment_id
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Custom attribute writer method with validation
|
|
226
|
+
# @param [Object] created_at Value to be assigned
|
|
227
|
+
def created_at=(created_at)
|
|
228
|
+
if created_at.nil?
|
|
229
|
+
fail ArgumentError, 'created_at cannot be nil'
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
@created_at = created_at
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Custom attribute writer method with validation
|
|
236
|
+
# @param [Object] expires_at Value to be assigned
|
|
237
|
+
def expires_at=(expires_at)
|
|
238
|
+
if expires_at.nil?
|
|
239
|
+
fail ArgumentError, 'expires_at cannot be nil'
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
@expires_at = expires_at
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Custom attribute writer method with validation
|
|
246
|
+
# @param [Object] last_used_at Value to be assigned
|
|
247
|
+
def last_used_at=(last_used_at)
|
|
248
|
+
if last_used_at.nil?
|
|
249
|
+
fail ArgumentError, 'last_used_at cannot be nil'
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
@last_used_at = last_used_at
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Checks equality by comparing each attribute.
|
|
256
|
+
# @param [Object] Object to be compared
|
|
257
|
+
def ==(o)
|
|
258
|
+
return true if self.equal?(o)
|
|
259
|
+
self.class == o.class &&
|
|
260
|
+
id == o.id &&
|
|
261
|
+
user_id == o.user_id &&
|
|
262
|
+
environment_id == o.environment_id &&
|
|
263
|
+
user_agent == o.user_agent &&
|
|
264
|
+
ip_address == o.ip_address &&
|
|
265
|
+
created_at == o.created_at &&
|
|
266
|
+
expires_at == o.expires_at &&
|
|
267
|
+
last_used_at == o.last_used_at
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# @see the `==` method
|
|
271
|
+
# @param [Object] Object to be compared
|
|
272
|
+
def eql?(o)
|
|
273
|
+
self == o
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# Calculates hash code according to all attributes.
|
|
277
|
+
# @return [Integer] Hash code
|
|
278
|
+
def hash
|
|
279
|
+
[id, user_id, environment_id, user_agent, ip_address, created_at, expires_at, last_used_at].hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Builds the object from hash
|
|
283
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
284
|
+
# @return [Object] Returns the model itself
|
|
285
|
+
def self.build_from_hash(attributes)
|
|
286
|
+
return nil unless attributes.is_a?(Hash)
|
|
287
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
288
|
+
transformed_hash = {}
|
|
289
|
+
openapi_types.each_pair do |key, type|
|
|
290
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
291
|
+
transformed_hash["#{key}"] = nil
|
|
292
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
293
|
+
# check to ensure the input is an array given that the attribute
|
|
294
|
+
# is documented as an array but the input is not
|
|
295
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
296
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
297
|
+
end
|
|
298
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
299
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
new(transformed_hash)
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Returns the object in the form of hash
|
|
306
|
+
# @return [Hash] Returns the object in the form of hash
|
|
307
|
+
def to_hash
|
|
308
|
+
hash = {}
|
|
309
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
310
|
+
value = self.send(attr)
|
|
311
|
+
if value.nil?
|
|
312
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
313
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
hash[param] = _to_hash(value)
|
|
317
|
+
end
|
|
318
|
+
hash
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
end
|