kleister 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +121 -0
- data/DCO +34 -0
- data/LICENSE +202 -0
- data/README.md +67 -0
- data/lib/kleister/api/auth_api.rb +331 -0
- data/lib/kleister/api/fabric_api.rb +367 -0
- data/lib/kleister/api/forge_api.rb +367 -0
- data/lib/kleister/api/minecraft_api.rb +367 -0
- data/lib/kleister/api/mod_api.rb +1603 -0
- data/lib/kleister/api/neoforge_api.rb +367 -0
- data/lib/kleister/api/pack_api.rb +1603 -0
- data/lib/kleister/api/profile_api.rb +198 -0
- data/lib/kleister/api/quilt_api.rb +367 -0
- data/lib/kleister/api/team_api.rb +1283 -0
- data/lib/kleister/api/user_api.rb +1283 -0
- data/lib/kleister/api_client.rb +429 -0
- data/lib/kleister/api_error.rb +56 -0
- data/lib/kleister/configuration.rb +397 -0
- data/lib/kleister/models/auth_login.rb +231 -0
- data/lib/kleister/models/auth_token.rb +227 -0
- data/lib/kleister/models/auth_verify.rb +227 -0
- data/lib/kleister/models/build.rb +365 -0
- data/lib/kleister/models/build_version.rb +261 -0
- data/lib/kleister/models/build_version_params.rb +233 -0
- data/lib/kleister/models/build_versions.rb +235 -0
- data/lib/kleister/models/builds.rb +227 -0
- data/lib/kleister/models/fabric.rb +235 -0
- data/lib/kleister/models/fabric_build_params.rb +233 -0
- data/lib/kleister/models/fabric_builds.rb +228 -0
- data/lib/kleister/models/fabrics.rb +220 -0
- data/lib/kleister/models/forge.rb +243 -0
- data/lib/kleister/models/forge_build_params.rb +233 -0
- data/lib/kleister/models/forge_builds.rb +227 -0
- data/lib/kleister/models/forges.rb +220 -0
- data/lib/kleister/models/minecraft.rb +243 -0
- data/lib/kleister/models/minecraft_build_params.rb +233 -0
- data/lib/kleister/models/minecraft_builds.rb +228 -0
- data/lib/kleister/models/minecrafts.rb +220 -0
- data/lib/kleister/models/mod.rb +350 -0
- data/lib/kleister/models/mod_team_params.rb +265 -0
- data/lib/kleister/models/mod_teams.rb +227 -0
- data/lib/kleister/models/mod_user_params.rb +265 -0
- data/lib/kleister/models/mod_users.rb +227 -0
- data/lib/kleister/models/mods.rb +220 -0
- data/lib/kleister/models/neoforge.rb +243 -0
- data/lib/kleister/models/neoforge_build_params.rb +233 -0
- data/lib/kleister/models/neoforge_builds.rb +228 -0
- data/lib/kleister/models/neoforges.rb +220 -0
- data/lib/kleister/models/notification.rb +228 -0
- data/lib/kleister/models/pack.rb +334 -0
- data/lib/kleister/models/pack_back.rb +289 -0
- data/lib/kleister/models/pack_icon.rb +289 -0
- data/lib/kleister/models/pack_logo.rb +289 -0
- data/lib/kleister/models/pack_team_params.rb +265 -0
- data/lib/kleister/models/pack_teams.rb +227 -0
- data/lib/kleister/models/pack_user_params.rb +265 -0
- data/lib/kleister/models/pack_users.rb +227 -0
- data/lib/kleister/models/packs.rb +220 -0
- data/lib/kleister/models/profile.rb +313 -0
- data/lib/kleister/models/quilt.rb +235 -0
- data/lib/kleister/models/quilt_build_params.rb +233 -0
- data/lib/kleister/models/quilt_builds.rb +227 -0
- data/lib/kleister/models/quilts.rb +220 -0
- data/lib/kleister/models/team.rb +267 -0
- data/lib/kleister/models/team_mod.rb +304 -0
- data/lib/kleister/models/team_mod_params.rb +265 -0
- data/lib/kleister/models/team_mods.rb +227 -0
- data/lib/kleister/models/team_pack.rb +304 -0
- data/lib/kleister/models/team_pack_params.rb +265 -0
- data/lib/kleister/models/team_packs.rb +227 -0
- data/lib/kleister/models/team_user_params.rb +265 -0
- data/lib/kleister/models/team_users.rb +227 -0
- data/lib/kleister/models/teams.rb +220 -0
- data/lib/kleister/models/user.rb +315 -0
- data/lib/kleister/models/user_auth.rb +234 -0
- data/lib/kleister/models/user_mod.rb +304 -0
- data/lib/kleister/models/user_mod_params.rb +265 -0
- data/lib/kleister/models/user_mods.rb +227 -0
- data/lib/kleister/models/user_pack.rb +304 -0
- data/lib/kleister/models/user_pack_params.rb +265 -0
- data/lib/kleister/models/user_packs.rb +227 -0
- data/lib/kleister/models/user_team.rb +304 -0
- data/lib/kleister/models/user_team_params.rb +265 -0
- data/lib/kleister/models/user_teams.rb +227 -0
- data/lib/kleister/models/users.rb +220 -0
- data/lib/kleister/models/validation.rb +220 -0
- data/lib/kleister/models/version.rb +280 -0
- data/lib/kleister/models/version_build_params.rb +233 -0
- data/lib/kleister/models/version_builds.rb +235 -0
- data/lib/kleister/models/version_file.rb +289 -0
- data/lib/kleister/models/versions.rb +227 -0
- data/lib/kleister/version.rb +13 -0
- data/lib/kleister.rb +121 -0
- metadata +180 -0
@@ -0,0 +1,267 @@
|
|
1
|
+
# Kleister OpenAPI
|
2
|
+
#
|
3
|
+
# API definition for Kleister, manage mod packs for Minecraft
|
4
|
+
#
|
5
|
+
# The version of the OpenAPI document: 1.0.0-alpha1
|
6
|
+
# Contact: kleister@webhippie.de
|
7
|
+
# Generated by: https://openapi-generator.tech
|
8
|
+
# Generator version: 7.6.0
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module Kleister
|
15
|
+
# Model to represent team
|
16
|
+
class Team
|
17
|
+
attr_accessor :id, :slug, :name, :created_at, :updated_at, :users, :packs, :mods
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
id: :id,
|
23
|
+
slug: :slug,
|
24
|
+
name: :name,
|
25
|
+
created_at: :created_at,
|
26
|
+
updated_at: :updated_at,
|
27
|
+
users: :users,
|
28
|
+
packs: :packs,
|
29
|
+
mods: :mods
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
id: :String,
|
42
|
+
slug: :String,
|
43
|
+
name: :String,
|
44
|
+
created_at: :Time,
|
45
|
+
updated_at: :Time,
|
46
|
+
users: :'Array<UserTeam>',
|
47
|
+
packs: :'Array<TeamPack>',
|
48
|
+
mods: :'Array<TeamMod>'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# List of attributes with nullable: true
|
53
|
+
def self.openapi_nullable
|
54
|
+
Set.new(%i[
|
55
|
+
slug
|
56
|
+
name
|
57
|
+
users
|
58
|
+
packs
|
59
|
+
mods
|
60
|
+
])
|
61
|
+
end
|
62
|
+
|
63
|
+
# Initializes the object
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
+
def initialize(attributes = {})
|
66
|
+
unless attributes.is_a?(Hash)
|
67
|
+
raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::Team` initialize method'
|
68
|
+
end
|
69
|
+
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
71
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
72
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
73
|
+
raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::Team`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
74
|
+
end
|
75
|
+
|
76
|
+
h[k.to_sym] = v
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:id)
|
80
|
+
self.id = attributes[:id]
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:slug)
|
84
|
+
self.slug = attributes[:slug]
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:name)
|
88
|
+
self.name = attributes[:name]
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:created_at)
|
92
|
+
self.created_at = attributes[:created_at]
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:updated_at)
|
96
|
+
self.updated_at = attributes[:updated_at]
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:users) && (value = attributes[:users]).is_a?(Array)
|
100
|
+
self.users = value
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:packs) && (value = attributes[:packs]).is_a?(Array)
|
104
|
+
self.packs = value
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:mods) && (value = attributes[:mods]).is_a?(Array)
|
108
|
+
self.mods = value
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
113
|
+
# @return Array for valid properties with the reasons
|
114
|
+
def list_invalid_properties
|
115
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
116
|
+
[]
|
117
|
+
end
|
118
|
+
|
119
|
+
# Check to see if the all the properties in the model are valid
|
120
|
+
# @return true if the model is valid
|
121
|
+
def valid?
|
122
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
123
|
+
true
|
124
|
+
end
|
125
|
+
|
126
|
+
# Checks equality by comparing each attribute.
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def ==(other)
|
129
|
+
return true if equal?(other)
|
130
|
+
|
131
|
+
self.class == other.class &&
|
132
|
+
id == other.id &&
|
133
|
+
slug == other.slug &&
|
134
|
+
name == other.name &&
|
135
|
+
created_at == other.created_at &&
|
136
|
+
updated_at == other.updated_at &&
|
137
|
+
users == other.users &&
|
138
|
+
packs == other.packs &&
|
139
|
+
mods == other.mods
|
140
|
+
end
|
141
|
+
|
142
|
+
# @see the `==` method
|
143
|
+
# @param [Object] Object to be compared
|
144
|
+
def eql?(other)
|
145
|
+
self == other
|
146
|
+
end
|
147
|
+
|
148
|
+
# Calculates hash code according to all attributes.
|
149
|
+
# @return [Integer] Hash code
|
150
|
+
def hash
|
151
|
+
[id, slug, name, created_at, updated_at, users, packs, mods].hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def self.build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
|
160
|
+
attributes = attributes.transform_keys(&:to_sym)
|
161
|
+
transformed_hash = {}
|
162
|
+
openapi_types.each_pair do |key, type|
|
163
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
164
|
+
transformed_hash[key.to_s] = nil
|
165
|
+
elsif type =~ /\AArray<(.*)>/i
|
166
|
+
# check to ensure the input is an array given that the attribute
|
167
|
+
# is documented as an array but the input is not
|
168
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
169
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
170
|
+
end
|
171
|
+
elsif !attributes[attribute_map[key]].nil?
|
172
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
173
|
+
end
|
174
|
+
end
|
175
|
+
new(transformed_hash)
|
176
|
+
end
|
177
|
+
|
178
|
+
# Deserializes the data based on type
|
179
|
+
# @param string type Data type
|
180
|
+
# @param string value Value to be deserialized
|
181
|
+
# @return [Object] Deserialized data
|
182
|
+
def self._deserialize(type, value)
|
183
|
+
case type.to_sym
|
184
|
+
when :Time
|
185
|
+
Time.parse(value)
|
186
|
+
when :Date
|
187
|
+
Date.parse(value)
|
188
|
+
when :String
|
189
|
+
value.to_s
|
190
|
+
when :Integer
|
191
|
+
value.to_i
|
192
|
+
when :Float
|
193
|
+
value.to_f
|
194
|
+
when :Boolean
|
195
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
196
|
+
true
|
197
|
+
else
|
198
|
+
false
|
199
|
+
end
|
200
|
+
when :Object
|
201
|
+
# generic object (usually a Hash), return directly
|
202
|
+
value
|
203
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
204
|
+
inner_type = Regexp.last_match[:inner_type]
|
205
|
+
value.map { |v| _deserialize(inner_type, v) }
|
206
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
207
|
+
k_type = Regexp.last_match[:k_type]
|
208
|
+
v_type = Regexp.last_match[:v_type]
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each do |k, v|
|
211
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
else # model
|
215
|
+
# models (e.g. Pet) or oneOf
|
216
|
+
klass = Kleister.const_get(type)
|
217
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the string representation of the object
|
222
|
+
# @return [String] String presentation of the object
|
223
|
+
def to_s
|
224
|
+
to_hash.to_s
|
225
|
+
end
|
226
|
+
|
227
|
+
# to_body is an alias to to_hash (backward compatibility)
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_body
|
230
|
+
to_hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the object in the form of hash
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_hash
|
236
|
+
hash = {}
|
237
|
+
self.class.attribute_map.each_pair do |attr, param|
|
238
|
+
value = send(attr)
|
239
|
+
if value.nil?
|
240
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
241
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
242
|
+
end
|
243
|
+
|
244
|
+
hash[param] = _to_hash(value)
|
245
|
+
end
|
246
|
+
hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to? :to_hash
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
@@ -0,0 +1,304 @@
|
|
1
|
+
# Kleister OpenAPI
|
2
|
+
#
|
3
|
+
# API definition for Kleister, manage mod packs for Minecraft
|
4
|
+
#
|
5
|
+
# The version of the OpenAPI document: 1.0.0-alpha1
|
6
|
+
# Contact: kleister@webhippie.de
|
7
|
+
# Generated by: https://openapi-generator.tech
|
8
|
+
# Generator version: 7.6.0
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module Kleister
|
15
|
+
# Model to represent team mod
|
16
|
+
class TeamMod
|
17
|
+
attr_accessor :team_id, :team, :mod_id, :mod, :perm, :created_at, :updated_at
|
18
|
+
|
19
|
+
class EnumAttributeValidator
|
20
|
+
attr_reader :datatype, :allowable_values
|
21
|
+
|
22
|
+
def initialize(datatype, allowable_values)
|
23
|
+
@allowable_values = allowable_values.map do |value|
|
24
|
+
case datatype.to_s
|
25
|
+
when /Integer/i
|
26
|
+
value.to_i
|
27
|
+
when /Float/i
|
28
|
+
value.to_f
|
29
|
+
else
|
30
|
+
value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def valid?(value)
|
36
|
+
!value || allowable_values.include?(value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
team_id: :team_id,
|
44
|
+
team: :team,
|
45
|
+
mod_id: :mod_id,
|
46
|
+
mod: :mod,
|
47
|
+
perm: :perm,
|
48
|
+
created_at: :created_at,
|
49
|
+
updated_at: :updated_at
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns all the JSON keys this model knows about
|
54
|
+
def self.acceptable_attributes
|
55
|
+
attribute_map.values
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
team_id: :String,
|
62
|
+
team: :Team,
|
63
|
+
mod_id: :String,
|
64
|
+
mod: :Mod,
|
65
|
+
perm: :String,
|
66
|
+
created_at: :Time,
|
67
|
+
updated_at: :Time
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of attributes with nullable: true
|
72
|
+
def self.openapi_nullable
|
73
|
+
Set.new([
|
74
|
+
])
|
75
|
+
end
|
76
|
+
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
|
+
def initialize(attributes = {})
|
80
|
+
unless attributes.is_a?(Hash)
|
81
|
+
raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::TeamMod` initialize method'
|
82
|
+
end
|
83
|
+
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
86
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
87
|
+
raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::TeamMod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
88
|
+
end
|
89
|
+
|
90
|
+
h[k.to_sym] = v
|
91
|
+
end
|
92
|
+
|
93
|
+
self.team_id = if attributes.key?(:team_id)
|
94
|
+
attributes[:team_id]
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:team)
|
98
|
+
self.team = attributes[:team]
|
99
|
+
end
|
100
|
+
|
101
|
+
self.mod_id = if attributes.key?(:mod_id)
|
102
|
+
attributes[:mod_id]
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:mod)
|
106
|
+
self.mod = attributes[:mod]
|
107
|
+
end
|
108
|
+
|
109
|
+
self.perm = if attributes.key?(:perm)
|
110
|
+
attributes[:perm]
|
111
|
+
else
|
112
|
+
'team'
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:created_at)
|
116
|
+
self.created_at = attributes[:created_at]
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:updated_at)
|
120
|
+
self.updated_at = attributes[:updated_at]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
128
|
+
invalid_properties = []
|
129
|
+
if @team_id.nil?
|
130
|
+
invalid_properties.push('invalid value for "team_id", team_id cannot be nil.')
|
131
|
+
end
|
132
|
+
|
133
|
+
if @mod_id.nil?
|
134
|
+
invalid_properties.push('invalid value for "mod_id", mod_id cannot be nil.')
|
135
|
+
end
|
136
|
+
|
137
|
+
invalid_properties
|
138
|
+
end
|
139
|
+
|
140
|
+
# Check to see if the all the properties in the model are valid
|
141
|
+
# @return true if the model is valid
|
142
|
+
def valid?
|
143
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
144
|
+
return false if @team_id.nil?
|
145
|
+
return false if @mod_id.nil?
|
146
|
+
|
147
|
+
perm_validator = EnumAttributeValidator.new('String', %w[team admin owner])
|
148
|
+
return false unless perm_validator.valid?(@perm)
|
149
|
+
|
150
|
+
true
|
151
|
+
end
|
152
|
+
|
153
|
+
# Custom attribute writer method checking allowed values (enum).
|
154
|
+
# @param [Object] perm Object to be assigned
|
155
|
+
def perm=(perm)
|
156
|
+
validator = EnumAttributeValidator.new('String', %w[team admin owner])
|
157
|
+
unless validator.valid?(perm)
|
158
|
+
raise ArgumentError, "invalid value for \"perm\", must be one of #{validator.allowable_values}."
|
159
|
+
end
|
160
|
+
|
161
|
+
@perm = perm
|
162
|
+
end
|
163
|
+
|
164
|
+
# Checks equality by comparing each attribute.
|
165
|
+
# @param [Object] Object to be compared
|
166
|
+
def ==(other)
|
167
|
+
return true if equal?(other)
|
168
|
+
|
169
|
+
self.class == other.class &&
|
170
|
+
team_id == other.team_id &&
|
171
|
+
team == other.team &&
|
172
|
+
mod_id == other.mod_id &&
|
173
|
+
mod == other.mod &&
|
174
|
+
perm == other.perm &&
|
175
|
+
created_at == other.created_at &&
|
176
|
+
updated_at == other.updated_at
|
177
|
+
end
|
178
|
+
|
179
|
+
# @see the `==` method
|
180
|
+
# @param [Object] Object to be compared
|
181
|
+
def eql?(other)
|
182
|
+
self == other
|
183
|
+
end
|
184
|
+
|
185
|
+
# Calculates hash code according to all attributes.
|
186
|
+
# @return [Integer] Hash code
|
187
|
+
def hash
|
188
|
+
[team_id, team, mod_id, mod, perm, created_at, updated_at].hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Builds the object from hash
|
192
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
193
|
+
# @return [Object] Returns the model itself
|
194
|
+
def self.build_from_hash(attributes)
|
195
|
+
return nil unless attributes.is_a?(Hash)
|
196
|
+
|
197
|
+
attributes = attributes.transform_keys(&:to_sym)
|
198
|
+
transformed_hash = {}
|
199
|
+
openapi_types.each_pair do |key, type|
|
200
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
201
|
+
transformed_hash[key.to_s] = nil
|
202
|
+
elsif type =~ /\AArray<(.*)>/i
|
203
|
+
# check to ensure the input is an array given that the attribute
|
204
|
+
# is documented as an array but the input is not
|
205
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
206
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
207
|
+
end
|
208
|
+
elsif !attributes[attribute_map[key]].nil?
|
209
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
210
|
+
end
|
211
|
+
end
|
212
|
+
new(transformed_hash)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Deserializes the data based on type
|
216
|
+
# @param string type Data type
|
217
|
+
# @param string value Value to be deserialized
|
218
|
+
# @return [Object] Deserialized data
|
219
|
+
def self._deserialize(type, value)
|
220
|
+
case type.to_sym
|
221
|
+
when :Time
|
222
|
+
Time.parse(value)
|
223
|
+
when :Date
|
224
|
+
Date.parse(value)
|
225
|
+
when :String
|
226
|
+
value.to_s
|
227
|
+
when :Integer
|
228
|
+
value.to_i
|
229
|
+
when :Float
|
230
|
+
value.to_f
|
231
|
+
when :Boolean
|
232
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
233
|
+
true
|
234
|
+
else
|
235
|
+
false
|
236
|
+
end
|
237
|
+
when :Object
|
238
|
+
# generic object (usually a Hash), return directly
|
239
|
+
value
|
240
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
241
|
+
inner_type = Regexp.last_match[:inner_type]
|
242
|
+
value.map { |v| _deserialize(inner_type, v) }
|
243
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
244
|
+
k_type = Regexp.last_match[:k_type]
|
245
|
+
v_type = Regexp.last_match[:v_type]
|
246
|
+
{}.tap do |hash|
|
247
|
+
value.each do |k, v|
|
248
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
else # model
|
252
|
+
# models (e.g. Pet) or oneOf
|
253
|
+
klass = Kleister.const_get(type)
|
254
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# Returns the string representation of the object
|
259
|
+
# @return [String] String presentation of the object
|
260
|
+
def to_s
|
261
|
+
to_hash.to_s
|
262
|
+
end
|
263
|
+
|
264
|
+
# to_body is an alias to to_hash (backward compatibility)
|
265
|
+
# @return [Hash] Returns the object in the form of hash
|
266
|
+
def to_body
|
267
|
+
to_hash
|
268
|
+
end
|
269
|
+
|
270
|
+
# Returns the object in the form of hash
|
271
|
+
# @return [Hash] Returns the object in the form of hash
|
272
|
+
def to_hash
|
273
|
+
hash = {}
|
274
|
+
self.class.attribute_map.each_pair do |attr, param|
|
275
|
+
value = send(attr)
|
276
|
+
if value.nil?
|
277
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
278
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
279
|
+
end
|
280
|
+
|
281
|
+
hash[param] = _to_hash(value)
|
282
|
+
end
|
283
|
+
hash
|
284
|
+
end
|
285
|
+
|
286
|
+
# Outputs non-array value in the form of hash
|
287
|
+
# For object, use to_hash. Otherwise, just return the value
|
288
|
+
# @param [Object] value Any valid value
|
289
|
+
# @return [Hash] Returns the value in the form of hash
|
290
|
+
def _to_hash(value)
|
291
|
+
if value.is_a?(Array)
|
292
|
+
value.compact.map { |v| _to_hash(v) }
|
293
|
+
elsif value.is_a?(Hash)
|
294
|
+
{}.tap do |hash|
|
295
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
296
|
+
end
|
297
|
+
elsif value.respond_to? :to_hash
|
298
|
+
value.to_hash
|
299
|
+
else
|
300
|
+
value
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|