minecraft_versions 0.10.0

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.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +72 -0
  4. data/README.md +98 -0
  5. data/Rakefile +10 -0
  6. data/bin/bundle +109 -0
  7. data/bin/byebug +27 -0
  8. data/bin/coderay +27 -0
  9. data/bin/htmldiff +27 -0
  10. data/bin/ldiff +27 -0
  11. data/bin/pry +27 -0
  12. data/bin/racc +27 -0
  13. data/bin/rake +27 -0
  14. data/bin/rspec +27 -0
  15. data/bin/rubocop +27 -0
  16. data/bin/ruby-parse +27 -0
  17. data/bin/ruby-rewrite +27 -0
  18. data/docs/DefaultApi.md +132 -0
  19. data/docs/Download.md +22 -0
  20. data/docs/Version.md +26 -0
  21. data/docs/VersionManifest.md +20 -0
  22. data/docs/VersionManifestLatest.md +20 -0
  23. data/docs/VersionPackageInfo.md +40 -0
  24. data/docs/VersionPackageInfoAssetIndex.md +26 -0
  25. data/docs/VersionPackageInfoDownloads.md +24 -0
  26. data/docs/VersionPackageInfoJavaVersion.md +20 -0
  27. data/git_push.sh +57 -0
  28. data/lib/minecraft_versions/api/default_api.rb +142 -0
  29. data/lib/minecraft_versions/api_client.rb +391 -0
  30. data/lib/minecraft_versions/api_error.rb +56 -0
  31. data/lib/minecraft_versions/configuration.rb +293 -0
  32. data/lib/minecraft_versions/models/download.rb +230 -0
  33. data/lib/minecraft_versions/models/version.rb +248 -0
  34. data/lib/minecraft_versions/models/version_manifest.rb +223 -0
  35. data/lib/minecraft_versions/models/version_manifest_latest.rb +221 -0
  36. data/lib/minecraft_versions/models/version_package_info.rb +311 -0
  37. data/lib/minecraft_versions/models/version_package_info_asset_index.rb +248 -0
  38. data/lib/minecraft_versions/models/version_package_info_downloads.rb +239 -0
  39. data/lib/minecraft_versions/models/version_package_info_java_version.rb +221 -0
  40. data/lib/minecraft_versions/version.rb +13 -0
  41. data/lib/minecraft_versions.rb +46 -0
  42. data/minecraft_versions.gemspec +37 -0
  43. data/spec/api/default_api_spec.rb +55 -0
  44. data/spec/models/download_spec.rb +46 -0
  45. data/spec/models/version_manifest_latest_spec.rb +40 -0
  46. data/spec/models/version_manifest_spec.rb +40 -0
  47. data/spec/models/version_package_info_asset_index_spec.rb +58 -0
  48. data/spec/models/version_package_info_downloads_spec.rb +52 -0
  49. data/spec/models/version_package_info_java_version_spec.rb +40 -0
  50. data/spec/models/version_package_info_spec.rb +100 -0
  51. data/spec/models/version_spec.rb +58 -0
  52. data/spec/spec_helper.rb +109 -0
  53. metadata +144 -0
@@ -0,0 +1,311 @@
1
+ =begin
2
+ #SDK for Minecraft versions info
3
+
4
+ The version of the OpenAPI document: 0.10.0
5
+ Contact: blah+oapicf@cliffano.com
6
+ Generated by: https://openapi-generator.tech
7
+ Generator version: 7.6.0
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module MinecraftVersionsClient
15
+ class VersionPackageInfo
16
+ attr_accessor :version
17
+
18
+ attr_accessor :asset_index
19
+
20
+ attr_accessor :assets
21
+
22
+ attr_accessor :compliance_level
23
+
24
+ attr_accessor :downloads
25
+
26
+ attr_accessor :id
27
+
28
+ attr_accessor :java_version
29
+
30
+ attr_accessor :main_class
31
+
32
+ attr_accessor :minimum_launcher_version
33
+
34
+ attr_accessor :time
35
+
36
+ attr_accessor :release_time
37
+
38
+ attr_accessor :type
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'version' => :'version',
44
+ :'asset_index' => :'assetIndex',
45
+ :'assets' => :'assets',
46
+ :'compliance_level' => :'complianceLevel',
47
+ :'downloads' => :'downloads',
48
+ :'id' => :'id',
49
+ :'java_version' => :'javaVersion',
50
+ :'main_class' => :'mainClass',
51
+ :'minimum_launcher_version' => :'minimumLauncherVersion',
52
+ :'time' => :'time',
53
+ :'release_time' => :'releaseTime',
54
+ :'type' => :'type'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'version' => :'String',
67
+ :'asset_index' => :'VersionPackageInfoAssetIndex',
68
+ :'assets' => :'String',
69
+ :'compliance_level' => :'Integer',
70
+ :'downloads' => :'VersionPackageInfoDownloads',
71
+ :'id' => :'String',
72
+ :'java_version' => :'VersionPackageInfoJavaVersion',
73
+ :'main_class' => :'String',
74
+ :'minimum_launcher_version' => :'Integer',
75
+ :'time' => :'Time',
76
+ :'release_time' => :'Time',
77
+ :'type' => :'String'
78
+ }
79
+ end
80
+
81
+ # List of attributes with nullable: true
82
+ def self.openapi_nullable
83
+ Set.new([
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MinecraftVersionsClient::VersionPackageInfo` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!self.class.attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MinecraftVersionsClient::VersionPackageInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'version')
103
+ self.version = attributes[:'version']
104
+ end
105
+
106
+ if attributes.key?(:'asset_index')
107
+ self.asset_index = attributes[:'asset_index']
108
+ end
109
+
110
+ if attributes.key?(:'assets')
111
+ self.assets = attributes[:'assets']
112
+ end
113
+
114
+ if attributes.key?(:'compliance_level')
115
+ self.compliance_level = attributes[:'compliance_level']
116
+ end
117
+
118
+ if attributes.key?(:'downloads')
119
+ self.downloads = attributes[:'downloads']
120
+ end
121
+
122
+ if attributes.key?(:'id')
123
+ self.id = attributes[:'id']
124
+ end
125
+
126
+ if attributes.key?(:'java_version')
127
+ self.java_version = attributes[:'java_version']
128
+ end
129
+
130
+ if attributes.key?(:'main_class')
131
+ self.main_class = attributes[:'main_class']
132
+ end
133
+
134
+ if attributes.key?(:'minimum_launcher_version')
135
+ self.minimum_launcher_version = attributes[:'minimum_launcher_version']
136
+ end
137
+
138
+ if attributes.key?(:'time')
139
+ self.time = attributes[:'time']
140
+ end
141
+
142
+ if attributes.key?(:'release_time')
143
+ self.release_time = attributes[:'release_time']
144
+ end
145
+
146
+ if attributes.key?(:'type')
147
+ self.type = attributes[:'type']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
155
+ invalid_properties = Array.new
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ true
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
+ version == o.version &&
172
+ asset_index == o.asset_index &&
173
+ assets == o.assets &&
174
+ compliance_level == o.compliance_level &&
175
+ downloads == o.downloads &&
176
+ id == o.id &&
177
+ java_version == o.java_version &&
178
+ main_class == o.main_class &&
179
+ minimum_launcher_version == o.minimum_launcher_version &&
180
+ time == o.time &&
181
+ release_time == o.release_time &&
182
+ type == o.type
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Integer] Hash code
193
+ def hash
194
+ [version, asset_index, assets, compliance_level, downloads, id, java_version, main_class, minimum_launcher_version, time, release_time, type].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ attributes = attributes.transform_keys(&:to_sym)
203
+ transformed_hash = {}
204
+ openapi_types.each_pair do |key, type|
205
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = nil
207
+ elsif type =~ /\AArray<(.*)>/i
208
+ # check to ensure the input is an array given that the attribute
209
+ # is documented as an array but the input is not
210
+ if attributes[attribute_map[key]].is_a?(Array)
211
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
212
+ end
213
+ elsif !attributes[attribute_map[key]].nil?
214
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
215
+ end
216
+ end
217
+ new(transformed_hash)
218
+ end
219
+
220
+ # Deserializes the data based on type
221
+ # @param string type Data type
222
+ # @param string value Value to be deserialized
223
+ # @return [Object] Deserialized data
224
+ def self._deserialize(type, value)
225
+ case type.to_sym
226
+ when :Time
227
+ Time.parse(value)
228
+ when :Date
229
+ Date.parse(value)
230
+ when :String
231
+ value.to_s
232
+ when :Integer
233
+ value.to_i
234
+ when :Float
235
+ value.to_f
236
+ when :Boolean
237
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
+ true
239
+ else
240
+ false
241
+ end
242
+ when :Object
243
+ # generic object (usually a Hash), return directly
244
+ value
245
+ when /\AArray<(?<inner_type>.+)>\z/
246
+ inner_type = Regexp.last_match[:inner_type]
247
+ value.map { |v| _deserialize(inner_type, v) }
248
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
+ k_type = Regexp.last_match[:k_type]
250
+ v_type = Regexp.last_match[:v_type]
251
+ {}.tap do |hash|
252
+ value.each do |k, v|
253
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
+ end
255
+ end
256
+ else # model
257
+ # models (e.g. Pet) or oneOf
258
+ klass = MinecraftVersionsClient.const_get(type)
259
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+
309
+ end
310
+
311
+ end
@@ -0,0 +1,248 @@
1
+ =begin
2
+ #SDK for Minecraft versions info
3
+
4
+ The version of the OpenAPI document: 0.10.0
5
+ Contact: blah+oapicf@cliffano.com
6
+ Generated by: https://openapi-generator.tech
7
+ Generator version: 7.6.0
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module MinecraftVersionsClient
15
+ class VersionPackageInfoAssetIndex
16
+ attr_accessor :id
17
+
18
+ attr_accessor :sha1
19
+
20
+ attr_accessor :size
21
+
22
+ attr_accessor :total_size
23
+
24
+ attr_accessor :url
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'id' => :'id',
30
+ :'sha1' => :'sha1',
31
+ :'size' => :'size',
32
+ :'total_size' => :'totalSize',
33
+ :'url' => :'url'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'sha1' => :'String',
47
+ :'size' => :'Integer',
48
+ :'total_size' => :'Integer',
49
+ :'url' => :'String'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MinecraftVersionsClient::VersionPackageInfoAssetIndex` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MinecraftVersionsClient::VersionPackageInfoAssetIndex`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'id')
75
+ self.id = attributes[:'id']
76
+ end
77
+
78
+ if attributes.key?(:'sha1')
79
+ self.sha1 = attributes[:'sha1']
80
+ end
81
+
82
+ if attributes.key?(:'size')
83
+ self.size = attributes[:'size']
84
+ end
85
+
86
+ if attributes.key?(:'total_size')
87
+ self.total_size = attributes[:'total_size']
88
+ end
89
+
90
+ if attributes.key?(:'url')
91
+ self.url = attributes[:'url']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ id == o.id &&
116
+ sha1 == o.sha1 &&
117
+ size == o.size &&
118
+ total_size == o.total_size &&
119
+ url == o.url
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [id, sha1, size, total_size, url].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ transformed_hash = {}
141
+ openapi_types.each_pair do |key, type|
142
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = nil
144
+ elsif type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[attribute_map[key]].is_a?(Array)
148
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
149
+ end
150
+ elsif !attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
152
+ end
153
+ end
154
+ new(transformed_hash)
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def self._deserialize(type, value)
162
+ case type.to_sym
163
+ when :Time
164
+ Time.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ # models (e.g. Pet) or oneOf
195
+ klass = MinecraftVersionsClient.const_get(type)
196
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+
248
+ end