crx_packmgr_api_client 0.1.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.
@@ -0,0 +1,493 @@
1
+ =begin
2
+ #CRX Package Manager API
3
+
4
+ #API for interacting with the CRX Package Manager in AEM.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module CrxPackageManager
27
+
28
+ class Package
29
+ attr_accessor :pid
30
+
31
+ attr_accessor :path
32
+
33
+ attr_accessor :name
34
+
35
+ attr_accessor :download_name
36
+
37
+ attr_accessor :group
38
+
39
+ attr_accessor :group_title
40
+
41
+ attr_accessor :version
42
+
43
+ attr_accessor :description
44
+
45
+ attr_accessor :thumbnail
46
+
47
+ attr_accessor :build_count
48
+
49
+ attr_accessor :last_modified
50
+
51
+ attr_accessor :last_modified_by
52
+
53
+ attr_accessor :created
54
+
55
+ attr_accessor :create_by
56
+
57
+ attr_accessor :last_unpacked
58
+
59
+ attr_accessor :last_unpacked_by
60
+
61
+ attr_accessor :last_wrapped
62
+
63
+ attr_accessor :last_wrapped_by
64
+
65
+ attr_accessor :last_unwrapped
66
+
67
+ attr_accessor :last_unwrapped_by
68
+
69
+ attr_accessor :size
70
+
71
+ attr_accessor :has_snapshot
72
+
73
+ attr_accessor :needs_rewrap
74
+
75
+ attr_accessor :built_with
76
+
77
+ attr_accessor :tested_with
78
+
79
+ attr_accessor :fixed_bugs
80
+
81
+ attr_accessor :requires_root
82
+
83
+ attr_accessor :requires_restart
84
+
85
+ attr_accessor :ac_handling
86
+
87
+ attr_accessor :dependencies
88
+
89
+ attr_accessor :resolved
90
+
91
+ attr_accessor :filter
92
+
93
+ attr_accessor :screenshots
94
+
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ :'pid' => :'pid',
100
+ :'path' => :'path',
101
+ :'name' => :'name',
102
+ :'download_name' => :'downloadName',
103
+ :'group' => :'group',
104
+ :'group_title' => :'groupTitle',
105
+ :'version' => :'version',
106
+ :'description' => :'description',
107
+ :'thumbnail' => :'thumbnail',
108
+ :'build_count' => :'buildCount',
109
+ :'last_modified' => :'lastModified',
110
+ :'last_modified_by' => :'lastModifiedBy',
111
+ :'created' => :'created',
112
+ :'create_by' => :'createBy',
113
+ :'last_unpacked' => :'lastUnpacked',
114
+ :'last_unpacked_by' => :'lastUnpackedBy',
115
+ :'last_wrapped' => :'lastWrapped',
116
+ :'last_wrapped_by' => :'lastWrappedBy',
117
+ :'last_unwrapped' => :'lastUnwrapped',
118
+ :'last_unwrapped_by' => :'lastUnwrappedBy',
119
+ :'size' => :'size',
120
+ :'has_snapshot' => :'hasSnapshot',
121
+ :'needs_rewrap' => :'needsRewrap',
122
+ :'built_with' => :'builtWith',
123
+ :'tested_with' => :'testedWith',
124
+ :'fixed_bugs' => :'fixedBugs',
125
+ :'requires_root' => :'requiresRoot',
126
+ :'requires_restart' => :'requiresRestart',
127
+ :'ac_handling' => :'acHandling',
128
+ :'dependencies' => :'dependencies',
129
+ :'resolved' => :'resolved',
130
+ :'filter' => :'filter',
131
+ :'screenshots' => :'screenshots'
132
+ }
133
+ end
134
+
135
+ # Attribute type mapping.
136
+ def self.swagger_types
137
+ {
138
+ :'pid' => :'String',
139
+ :'path' => :'String',
140
+ :'name' => :'String',
141
+ :'download_name' => :'String',
142
+ :'group' => :'String',
143
+ :'group_title' => :'String',
144
+ :'version' => :'String',
145
+ :'description' => :'String',
146
+ :'thumbnail' => :'String',
147
+ :'build_count' => :'Integer',
148
+ :'last_modified' => :'Integer',
149
+ :'last_modified_by' => :'String',
150
+ :'created' => :'Integer',
151
+ :'create_by' => :'String',
152
+ :'last_unpacked' => :'Integer',
153
+ :'last_unpacked_by' => :'String',
154
+ :'last_wrapped' => :'Integer',
155
+ :'last_wrapped_by' => :'String',
156
+ :'last_unwrapped' => :'Integer',
157
+ :'last_unwrapped_by' => :'String',
158
+ :'size' => :'Integer',
159
+ :'has_snapshot' => :'BOOLEAN',
160
+ :'needs_rewrap' => :'BOOLEAN',
161
+ :'built_with' => :'String',
162
+ :'tested_with' => :'String',
163
+ :'fixed_bugs' => :'String',
164
+ :'requires_root' => :'BOOLEAN',
165
+ :'requires_restart' => :'BOOLEAN',
166
+ :'ac_handling' => :'String',
167
+ :'dependencies' => :'Array<String>',
168
+ :'resolved' => :'BOOLEAN',
169
+ :'filter' => :'Array<PackageFilter>',
170
+ :'screenshots' => :'Array<String>'
171
+ }
172
+ end
173
+
174
+ # Initializes the object
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ def initialize(attributes = {})
177
+ return unless attributes.is_a?(Hash)
178
+
179
+ # convert string to symbol for hash key
180
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
181
+
182
+ if attributes.has_key?(:'pid')
183
+ self.pid = attributes[:'pid']
184
+ end
185
+
186
+ if attributes.has_key?(:'path')
187
+ self.path = attributes[:'path']
188
+ end
189
+
190
+ if attributes.has_key?(:'name')
191
+ self.name = attributes[:'name']
192
+ end
193
+
194
+ if attributes.has_key?(:'downloadName')
195
+ self.download_name = attributes[:'downloadName']
196
+ end
197
+
198
+ if attributes.has_key?(:'group')
199
+ self.group = attributes[:'group']
200
+ end
201
+
202
+ if attributes.has_key?(:'groupTitle')
203
+ self.group_title = attributes[:'groupTitle']
204
+ end
205
+
206
+ if attributes.has_key?(:'version')
207
+ self.version = attributes[:'version']
208
+ end
209
+
210
+ if attributes.has_key?(:'description')
211
+ self.description = attributes[:'description']
212
+ end
213
+
214
+ if attributes.has_key?(:'thumbnail')
215
+ self.thumbnail = attributes[:'thumbnail']
216
+ end
217
+
218
+ if attributes.has_key?(:'buildCount')
219
+ self.build_count = attributes[:'buildCount']
220
+ end
221
+
222
+ if attributes.has_key?(:'lastModified')
223
+ self.last_modified = attributes[:'lastModified']
224
+ end
225
+
226
+ if attributes.has_key?(:'lastModifiedBy')
227
+ self.last_modified_by = attributes[:'lastModifiedBy']
228
+ end
229
+
230
+ if attributes.has_key?(:'created')
231
+ self.created = attributes[:'created']
232
+ end
233
+
234
+ if attributes.has_key?(:'createBy')
235
+ self.create_by = attributes[:'createBy']
236
+ end
237
+
238
+ if attributes.has_key?(:'lastUnpacked')
239
+ self.last_unpacked = attributes[:'lastUnpacked']
240
+ end
241
+
242
+ if attributes.has_key?(:'lastUnpackedBy')
243
+ self.last_unpacked_by = attributes[:'lastUnpackedBy']
244
+ end
245
+
246
+ if attributes.has_key?(:'lastWrapped')
247
+ self.last_wrapped = attributes[:'lastWrapped']
248
+ end
249
+
250
+ if attributes.has_key?(:'lastWrappedBy')
251
+ self.last_wrapped_by = attributes[:'lastWrappedBy']
252
+ end
253
+
254
+ if attributes.has_key?(:'lastUnwrapped')
255
+ self.last_unwrapped = attributes[:'lastUnwrapped']
256
+ end
257
+
258
+ if attributes.has_key?(:'lastUnwrappedBy')
259
+ self.last_unwrapped_by = attributes[:'lastUnwrappedBy']
260
+ end
261
+
262
+ if attributes.has_key?(:'size')
263
+ self.size = attributes[:'size']
264
+ end
265
+
266
+ if attributes.has_key?(:'hasSnapshot')
267
+ self.has_snapshot = attributes[:'hasSnapshot']
268
+ end
269
+
270
+ if attributes.has_key?(:'needsRewrap')
271
+ self.needs_rewrap = attributes[:'needsRewrap']
272
+ end
273
+
274
+ if attributes.has_key?(:'builtWith')
275
+ self.built_with = attributes[:'builtWith']
276
+ end
277
+
278
+ if attributes.has_key?(:'testedWith')
279
+ self.tested_with = attributes[:'testedWith']
280
+ end
281
+
282
+ if attributes.has_key?(:'fixedBugs')
283
+ self.fixed_bugs = attributes[:'fixedBugs']
284
+ end
285
+
286
+ if attributes.has_key?(:'requiresRoot')
287
+ self.requires_root = attributes[:'requiresRoot']
288
+ end
289
+
290
+ if attributes.has_key?(:'requiresRestart')
291
+ self.requires_restart = attributes[:'requiresRestart']
292
+ end
293
+
294
+ if attributes.has_key?(:'acHandling')
295
+ self.ac_handling = attributes[:'acHandling']
296
+ end
297
+
298
+ if attributes.has_key?(:'dependencies')
299
+ if (value = attributes[:'dependencies']).is_a?(Array)
300
+ self.dependencies = value
301
+ end
302
+ end
303
+
304
+ if attributes.has_key?(:'resolved')
305
+ self.resolved = attributes[:'resolved']
306
+ end
307
+
308
+ if attributes.has_key?(:'filter')
309
+ if (value = attributes[:'filter']).is_a?(Array)
310
+ self.filter = value
311
+ end
312
+ end
313
+
314
+ if attributes.has_key?(:'screenshots')
315
+ if (value = attributes[:'screenshots']).is_a?(Array)
316
+ self.screenshots = value
317
+ end
318
+ end
319
+
320
+ end
321
+
322
+ # Show invalid properties with the reasons. Usually used together with valid?
323
+ # @return Array for valid properies with the reasons
324
+ def list_invalid_properties
325
+ invalid_properties = Array.new
326
+ return invalid_properties
327
+ end
328
+
329
+ # Check to see if the all the properties in the model are valid
330
+ # @return true if the model is valid
331
+ def valid?
332
+ return true
333
+ end
334
+
335
+ # Checks equality by comparing each attribute.
336
+ # @param [Object] Object to be compared
337
+ def ==(o)
338
+ return true if self.equal?(o)
339
+ self.class == o.class &&
340
+ pid == o.pid &&
341
+ path == o.path &&
342
+ name == o.name &&
343
+ download_name == o.download_name &&
344
+ group == o.group &&
345
+ group_title == o.group_title &&
346
+ version == o.version &&
347
+ description == o.description &&
348
+ thumbnail == o.thumbnail &&
349
+ build_count == o.build_count &&
350
+ last_modified == o.last_modified &&
351
+ last_modified_by == o.last_modified_by &&
352
+ created == o.created &&
353
+ create_by == o.create_by &&
354
+ last_unpacked == o.last_unpacked &&
355
+ last_unpacked_by == o.last_unpacked_by &&
356
+ last_wrapped == o.last_wrapped &&
357
+ last_wrapped_by == o.last_wrapped_by &&
358
+ last_unwrapped == o.last_unwrapped &&
359
+ last_unwrapped_by == o.last_unwrapped_by &&
360
+ size == o.size &&
361
+ has_snapshot == o.has_snapshot &&
362
+ needs_rewrap == o.needs_rewrap &&
363
+ built_with == o.built_with &&
364
+ tested_with == o.tested_with &&
365
+ fixed_bugs == o.fixed_bugs &&
366
+ requires_root == o.requires_root &&
367
+ requires_restart == o.requires_restart &&
368
+ ac_handling == o.ac_handling &&
369
+ dependencies == o.dependencies &&
370
+ resolved == o.resolved &&
371
+ filter == o.filter &&
372
+ screenshots == o.screenshots
373
+ end
374
+
375
+ # @see the `==` method
376
+ # @param [Object] Object to be compared
377
+ def eql?(o)
378
+ self == o
379
+ end
380
+
381
+ # Calculates hash code according to all attributes.
382
+ # @return [Fixnum] Hash code
383
+ def hash
384
+ [pid, path, name, download_name, group, group_title, version, description, thumbnail, build_count, last_modified, last_modified_by, created, create_by, last_unpacked, last_unpacked_by, last_wrapped, last_wrapped_by, last_unwrapped, last_unwrapped_by, size, has_snapshot, needs_rewrap, built_with, tested_with, fixed_bugs, requires_root, requires_restart, ac_handling, dependencies, resolved, filter, screenshots].hash
385
+ end
386
+
387
+ # Builds the object from hash
388
+ # @param [Hash] attributes Model attributes in the form of hash
389
+ # @return [Object] Returns the model itself
390
+ def build_from_hash(attributes)
391
+ return nil unless attributes.is_a?(Hash)
392
+ self.class.swagger_types.each_pair do |key, type|
393
+ if type =~ /^Array<(.*)>/i
394
+ # check to ensure the input is an array given that the the attribute
395
+ # is documented as an array but the input is not
396
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
397
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
398
+ end
399
+ elsif !attributes[self.class.attribute_map[key]].nil?
400
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
401
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
402
+ end
403
+
404
+ self
405
+ end
406
+
407
+ # Deserializes the data based on type
408
+ # @param string type Data type
409
+ # @param string value Value to be deserialized
410
+ # @return [Object] Deserialized data
411
+ def _deserialize(type, value)
412
+ case type.to_sym
413
+ when :DateTime
414
+ DateTime.parse(value)
415
+ when :Date
416
+ Date.parse(value)
417
+ when :String
418
+ value.to_s
419
+ when :Integer
420
+ value.to_i
421
+ when :Float
422
+ value.to_f
423
+ when :BOOLEAN
424
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
425
+ true
426
+ else
427
+ false
428
+ end
429
+ when :Object
430
+ # generic object (usually a Hash), return directly
431
+ value
432
+ when /\AArray<(?<inner_type>.+)>\z/
433
+ inner_type = Regexp.last_match[:inner_type]
434
+ value.map { |v| _deserialize(inner_type, v) }
435
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
436
+ k_type = Regexp.last_match[:k_type]
437
+ v_type = Regexp.last_match[:v_type]
438
+ {}.tap do |hash|
439
+ value.each do |k, v|
440
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
441
+ end
442
+ end
443
+ else # model
444
+ temp_model = CrxPackageManager.const_get(type).new
445
+ temp_model.build_from_hash(value)
446
+ end
447
+ end
448
+
449
+ # Returns the string representation of the object
450
+ # @return [String] String presentation of the object
451
+ def to_s
452
+ to_hash.to_s
453
+ end
454
+
455
+ # to_body is an alias to to_hash (backward compatibility)
456
+ # @return [Hash] Returns the object in the form of hash
457
+ def to_body
458
+ to_hash
459
+ end
460
+
461
+ # Returns the object in the form of hash
462
+ # @return [Hash] Returns the object in the form of hash
463
+ def to_hash
464
+ hash = {}
465
+ self.class.attribute_map.each_pair do |attr, param|
466
+ value = self.send(attr)
467
+ next if value.nil?
468
+ hash[param] = _to_hash(value)
469
+ end
470
+ hash
471
+ end
472
+
473
+ # Outputs non-array value in the form of hash
474
+ # For object, use to_hash. Otherwise, just return the value
475
+ # @param [Object] value Any valid value
476
+ # @return [Hash] Returns the value in the form of hash
477
+ def _to_hash(value)
478
+ if value.is_a?(Array)
479
+ value.compact.map{ |v| _to_hash(v) }
480
+ elsif value.is_a?(Hash)
481
+ {}.tap do |hash|
482
+ value.each { |k, v| hash[k] = _to_hash(v) }
483
+ end
484
+ elsif value.respond_to? :to_hash
485
+ value.to_hash
486
+ else
487
+ value
488
+ end
489
+ end
490
+
491
+ end
492
+
493
+ end