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,194 @@
|
|
|
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
|
+
class ProblemDetail < ApiModelBase
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
attr_accessor :title
|
|
21
|
+
|
|
22
|
+
attr_accessor :status
|
|
23
|
+
|
|
24
|
+
attr_accessor :detail
|
|
25
|
+
|
|
26
|
+
attr_accessor :instance
|
|
27
|
+
|
|
28
|
+
attr_accessor :properties
|
|
29
|
+
|
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
31
|
+
def self.attribute_map
|
|
32
|
+
{
|
|
33
|
+
:'type' => :'type',
|
|
34
|
+
:'title' => :'title',
|
|
35
|
+
:'status' => :'status',
|
|
36
|
+
:'detail' => :'detail',
|
|
37
|
+
:'instance' => :'instance',
|
|
38
|
+
:'properties' => :'properties'
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Returns attribute mapping this model knows about
|
|
43
|
+
def self.acceptable_attribute_map
|
|
44
|
+
attribute_map
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Returns all the JSON keys this model knows about
|
|
48
|
+
def self.acceptable_attributes
|
|
49
|
+
acceptable_attribute_map.values
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Attribute type mapping.
|
|
53
|
+
def self.openapi_types
|
|
54
|
+
{
|
|
55
|
+
:'type' => :'String',
|
|
56
|
+
:'title' => :'String',
|
|
57
|
+
:'status' => :'Integer',
|
|
58
|
+
:'detail' => :'String',
|
|
59
|
+
:'instance' => :'String',
|
|
60
|
+
:'properties' => :'Hash<String, Object>'
|
|
61
|
+
}
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# List of attributes with nullable: true
|
|
65
|
+
def self.openapi_nullable
|
|
66
|
+
Set.new([
|
|
67
|
+
])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Initializes the object
|
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
72
|
+
def initialize(attributes = {})
|
|
73
|
+
if (!attributes.is_a?(Hash))
|
|
74
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::ProblemDetail` initialize method"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
78
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
80
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::ProblemDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
82
|
+
end
|
|
83
|
+
h[k.to_sym] = v
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'type')
|
|
87
|
+
self.type = attributes[:'type']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'title')
|
|
91
|
+
self.title = attributes[:'title']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'status')
|
|
95
|
+
self.status = attributes[:'status']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'detail')
|
|
99
|
+
self.detail = attributes[:'detail']
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'instance')
|
|
103
|
+
self.instance = attributes[:'instance']
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'properties')
|
|
107
|
+
if (value = attributes[:'properties']).is_a?(Hash)
|
|
108
|
+
self.properties = value
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
114
|
+
# @return Array for valid properties with the reasons
|
|
115
|
+
def list_invalid_properties
|
|
116
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
117
|
+
invalid_properties = Array.new
|
|
118
|
+
invalid_properties
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Check to see if the all the properties in the model are valid
|
|
122
|
+
# @return true if the model is valid
|
|
123
|
+
def valid?
|
|
124
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
125
|
+
true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Checks equality by comparing each attribute.
|
|
129
|
+
# @param [Object] Object to be compared
|
|
130
|
+
def ==(o)
|
|
131
|
+
return true if self.equal?(o)
|
|
132
|
+
self.class == o.class &&
|
|
133
|
+
type == o.type &&
|
|
134
|
+
title == o.title &&
|
|
135
|
+
status == o.status &&
|
|
136
|
+
detail == o.detail &&
|
|
137
|
+
instance == o.instance &&
|
|
138
|
+
properties == o.properties
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# @see the `==` method
|
|
142
|
+
# @param [Object] Object to be compared
|
|
143
|
+
def eql?(o)
|
|
144
|
+
self == o
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Calculates hash code according to all attributes.
|
|
148
|
+
# @return [Integer] Hash code
|
|
149
|
+
def hash
|
|
150
|
+
[type, title, status, detail, instance, properties].hash
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Builds the object from hash
|
|
154
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
155
|
+
# @return [Object] Returns the model itself
|
|
156
|
+
def self.build_from_hash(attributes)
|
|
157
|
+
return nil unless attributes.is_a?(Hash)
|
|
158
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
159
|
+
transformed_hash = {}
|
|
160
|
+
openapi_types.each_pair do |key, type|
|
|
161
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
162
|
+
transformed_hash["#{key}"] = nil
|
|
163
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
164
|
+
# check to ensure the input is an array given that the attribute
|
|
165
|
+
# is documented as an array but the input is not
|
|
166
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
167
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
168
|
+
end
|
|
169
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
170
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
new(transformed_hash)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Returns the object in the form of hash
|
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
|
178
|
+
def to_hash
|
|
179
|
+
hash = {}
|
|
180
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
181
|
+
value = self.send(attr)
|
|
182
|
+
if value.nil?
|
|
183
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
184
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
hash[param] = _to_hash(value)
|
|
188
|
+
end
|
|
189
|
+
hash
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
end
|
data/src/torii/backend/generated/lib/torii-backend-generated/models/server_user_search_request.rb
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
# Optional filter body for `POST /users/search`. Every field is tri-state: omit to skip that filter, send a value to require it. Fields whose inner type is nullable (currently `name`, `email`) additionally accept JSON null to filter for users where that column is null; the non-nullable `statuses` field rejects null.
|
|
18
|
+
class ServerUserSearchRequest < ApiModelBase
|
|
19
|
+
# Filter by name (case-insensitive substring match). Send null to require users with no name.
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
# Filter by primary email (case-insensitive substring match). Send null to require users with no email.
|
|
23
|
+
attr_accessor :email
|
|
24
|
+
|
|
25
|
+
# Filter by user status. Returns users matching any of the supplied statuses.
|
|
26
|
+
attr_accessor :statuses
|
|
27
|
+
|
|
28
|
+
# Only return users created at or after this instant (ISO-8601 UTC).
|
|
29
|
+
attr_accessor :created_after
|
|
30
|
+
|
|
31
|
+
# Only return users created at or before this instant (ISO-8601 UTC).
|
|
32
|
+
attr_accessor :created_before
|
|
33
|
+
|
|
34
|
+
class EnumAttributeValidator
|
|
35
|
+
attr_reader :datatype
|
|
36
|
+
attr_reader :allowable_values
|
|
37
|
+
|
|
38
|
+
def initialize(datatype, allowable_values)
|
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
|
40
|
+
case datatype.to_s
|
|
41
|
+
when /Integer/i
|
|
42
|
+
value.to_i
|
|
43
|
+
when /Float/i
|
|
44
|
+
value.to_f
|
|
45
|
+
else
|
|
46
|
+
value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def valid?(value)
|
|
52
|
+
!value || allowable_values.include?(value)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
57
|
+
def self.attribute_map
|
|
58
|
+
{
|
|
59
|
+
:'name' => :'name',
|
|
60
|
+
:'email' => :'email',
|
|
61
|
+
:'statuses' => :'statuses',
|
|
62
|
+
:'created_after' => :'createdAfter',
|
|
63
|
+
:'created_before' => :'createdBefore'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns attribute mapping this model knows about
|
|
68
|
+
def self.acceptable_attribute_map
|
|
69
|
+
attribute_map
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns all the JSON keys this model knows about
|
|
73
|
+
def self.acceptable_attributes
|
|
74
|
+
acceptable_attribute_map.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Attribute type mapping.
|
|
78
|
+
def self.openapi_types
|
|
79
|
+
{
|
|
80
|
+
:'name' => :'String',
|
|
81
|
+
:'email' => :'String',
|
|
82
|
+
:'statuses' => :'Array<String>',
|
|
83
|
+
:'created_after' => :'Time',
|
|
84
|
+
:'created_before' => :'Time'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# List of attributes with nullable: true
|
|
89
|
+
def self.openapi_nullable
|
|
90
|
+
Set.new([
|
|
91
|
+
:'name',
|
|
92
|
+
:'email',
|
|
93
|
+
:'created_after',
|
|
94
|
+
:'created_before'
|
|
95
|
+
])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Initializes the object
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
def initialize(attributes = {})
|
|
101
|
+
if (!attributes.is_a?(Hash))
|
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::ServerUserSearchRequest` initialize method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
106
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
108
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::ServerUserSearchRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
110
|
+
end
|
|
111
|
+
h[k.to_sym] = v
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'name')
|
|
115
|
+
self.name = attributes[:'name']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'email')
|
|
119
|
+
self.email = attributes[:'email']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'statuses')
|
|
123
|
+
if (value = attributes[:'statuses']).is_a?(Array)
|
|
124
|
+
self.statuses = value
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'created_after')
|
|
129
|
+
self.created_after = attributes[:'created_after']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'created_before')
|
|
133
|
+
self.created_before = attributes[:'created_before']
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
138
|
+
# @return Array for valid properties with the reasons
|
|
139
|
+
def list_invalid_properties
|
|
140
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
141
|
+
invalid_properties = Array.new
|
|
142
|
+
invalid_properties
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Check to see if the all the properties in the model are valid
|
|
146
|
+
# @return true if the model is valid
|
|
147
|
+
def valid?
|
|
148
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
149
|
+
true
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Checks equality by comparing each attribute.
|
|
153
|
+
# @param [Object] Object to be compared
|
|
154
|
+
def ==(o)
|
|
155
|
+
return true if self.equal?(o)
|
|
156
|
+
self.class == o.class &&
|
|
157
|
+
name == o.name &&
|
|
158
|
+
email == o.email &&
|
|
159
|
+
statuses == o.statuses &&
|
|
160
|
+
created_after == o.created_after &&
|
|
161
|
+
created_before == o.created_before
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# @see the `==` method
|
|
165
|
+
# @param [Object] Object to be compared
|
|
166
|
+
def eql?(o)
|
|
167
|
+
self == o
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Calculates hash code according to all attributes.
|
|
171
|
+
# @return [Integer] Hash code
|
|
172
|
+
def hash
|
|
173
|
+
[name, email, statuses, created_after, created_before].hash
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Builds the object from hash
|
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
178
|
+
# @return [Object] Returns the model itself
|
|
179
|
+
def self.build_from_hash(attributes)
|
|
180
|
+
return nil unless attributes.is_a?(Hash)
|
|
181
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
182
|
+
transformed_hash = {}
|
|
183
|
+
openapi_types.each_pair do |key, type|
|
|
184
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
185
|
+
transformed_hash["#{key}"] = nil
|
|
186
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
187
|
+
# check to ensure the input is an array given that the attribute
|
|
188
|
+
# is documented as an array but the input is not
|
|
189
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
190
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
191
|
+
end
|
|
192
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
193
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
new(transformed_hash)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Returns the object in the form of hash
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_hash
|
|
202
|
+
hash = {}
|
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
204
|
+
value = self.send(attr)
|
|
205
|
+
if value.nil?
|
|
206
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
207
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
hash[param] = _to_hash(value)
|
|
211
|
+
end
|
|
212
|
+
hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
end
|
|
@@ -0,0 +1,228 @@
|
|
|
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
|
+
# PATCH body for updating an end-user. Every field is tri-state: omit the key entirely to leave the field unchanged, send a non-null value to set it, or send JSON null to clear it.
|
|
18
|
+
class UpdateUserRequest < ApiModelBase
|
|
19
|
+
# New display name. Send null to clear; omit to leave unchanged.
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
# New phone number. Send null to clear; omit to leave unchanged.
|
|
23
|
+
attr_accessor :phone
|
|
24
|
+
|
|
25
|
+
# New preferred locale. Send null to clear; omit to leave unchanged.
|
|
26
|
+
attr_accessor :locale
|
|
27
|
+
|
|
28
|
+
# New postal address. Send null to clear; omit to leave unchanged.
|
|
29
|
+
attr_accessor :address
|
|
30
|
+
|
|
31
|
+
# New date of birth (YYYY-MM-DD). Send null to clear; omit to leave unchanged.
|
|
32
|
+
attr_accessor :date_of_birth
|
|
33
|
+
|
|
34
|
+
class EnumAttributeValidator
|
|
35
|
+
attr_reader :datatype
|
|
36
|
+
attr_reader :allowable_values
|
|
37
|
+
|
|
38
|
+
def initialize(datatype, allowable_values)
|
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
|
40
|
+
case datatype.to_s
|
|
41
|
+
when /Integer/i
|
|
42
|
+
value.to_i
|
|
43
|
+
when /Float/i
|
|
44
|
+
value.to_f
|
|
45
|
+
else
|
|
46
|
+
value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def valid?(value)
|
|
52
|
+
!value || allowable_values.include?(value)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
57
|
+
def self.attribute_map
|
|
58
|
+
{
|
|
59
|
+
:'name' => :'name',
|
|
60
|
+
:'phone' => :'phone',
|
|
61
|
+
:'locale' => :'locale',
|
|
62
|
+
:'address' => :'address',
|
|
63
|
+
:'date_of_birth' => :'dateOfBirth'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns attribute mapping this model knows about
|
|
68
|
+
def self.acceptable_attribute_map
|
|
69
|
+
attribute_map
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns all the JSON keys this model knows about
|
|
73
|
+
def self.acceptable_attributes
|
|
74
|
+
acceptable_attribute_map.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Attribute type mapping.
|
|
78
|
+
def self.openapi_types
|
|
79
|
+
{
|
|
80
|
+
:'name' => :'String',
|
|
81
|
+
:'phone' => :'String',
|
|
82
|
+
:'locale' => :'String',
|
|
83
|
+
:'address' => :'String',
|
|
84
|
+
:'date_of_birth' => :'Date'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# List of attributes with nullable: true
|
|
89
|
+
def self.openapi_nullable
|
|
90
|
+
Set.new([
|
|
91
|
+
:'name',
|
|
92
|
+
:'phone',
|
|
93
|
+
:'locale',
|
|
94
|
+
:'address',
|
|
95
|
+
:'date_of_birth'
|
|
96
|
+
])
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Initializes the object
|
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
101
|
+
def initialize(attributes = {})
|
|
102
|
+
if (!attributes.is_a?(Hash))
|
|
103
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::UpdateUserRequest` initialize method"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
107
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
108
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
109
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
110
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::UpdateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
111
|
+
end
|
|
112
|
+
h[k.to_sym] = v
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'name')
|
|
116
|
+
self.name = attributes[:'name']
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'phone')
|
|
120
|
+
self.phone = attributes[:'phone']
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'locale')
|
|
124
|
+
self.locale = attributes[:'locale']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'address')
|
|
128
|
+
self.address = attributes[:'address']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'date_of_birth')
|
|
132
|
+
self.date_of_birth = attributes[:'date_of_birth']
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
137
|
+
# @return Array for valid properties with the reasons
|
|
138
|
+
def list_invalid_properties
|
|
139
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
140
|
+
invalid_properties = Array.new
|
|
141
|
+
invalid_properties
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Check to see if the all the properties in the model are valid
|
|
145
|
+
# @return true if the model is valid
|
|
146
|
+
def valid?
|
|
147
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
148
|
+
locale_validator = EnumAttributeValidator.new('String', ["en", "da"])
|
|
149
|
+
return false unless locale_validator.valid?(@locale)
|
|
150
|
+
true
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
154
|
+
# @param [Object] locale Object to be assigned
|
|
155
|
+
def locale=(locale)
|
|
156
|
+
validator = EnumAttributeValidator.new('String', ["en", "da"])
|
|
157
|
+
unless validator.valid?(locale)
|
|
158
|
+
fail ArgumentError, "invalid value for \"locale\", must be one of #{validator.allowable_values}."
|
|
159
|
+
end
|
|
160
|
+
@locale = locale
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Checks equality by comparing each attribute.
|
|
164
|
+
# @param [Object] Object to be compared
|
|
165
|
+
def ==(o)
|
|
166
|
+
return true if self.equal?(o)
|
|
167
|
+
self.class == o.class &&
|
|
168
|
+
name == o.name &&
|
|
169
|
+
phone == o.phone &&
|
|
170
|
+
locale == o.locale &&
|
|
171
|
+
address == o.address &&
|
|
172
|
+
date_of_birth == o.date_of_birth
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# @see the `==` method
|
|
176
|
+
# @param [Object] Object to be compared
|
|
177
|
+
def eql?(o)
|
|
178
|
+
self == o
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Calculates hash code according to all attributes.
|
|
182
|
+
# @return [Integer] Hash code
|
|
183
|
+
def hash
|
|
184
|
+
[name, phone, locale, address, date_of_birth].hash
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Builds the object from hash
|
|
188
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
189
|
+
# @return [Object] Returns the model itself
|
|
190
|
+
def self.build_from_hash(attributes)
|
|
191
|
+
return nil unless attributes.is_a?(Hash)
|
|
192
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
193
|
+
transformed_hash = {}
|
|
194
|
+
openapi_types.each_pair do |key, type|
|
|
195
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
196
|
+
transformed_hash["#{key}"] = nil
|
|
197
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
198
|
+
# check to ensure the input is an array given that the attribute
|
|
199
|
+
# is documented as an array but the input is not
|
|
200
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
201
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
202
|
+
end
|
|
203
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
204
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
new(transformed_hash)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Returns the object in the form of hash
|
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
|
212
|
+
def to_hash
|
|
213
|
+
hash = {}
|
|
214
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
215
|
+
value = self.send(attr)
|
|
216
|
+
if value.nil?
|
|
217
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
218
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
hash[param] = _to_hash(value)
|
|
222
|
+
end
|
|
223
|
+
hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|