imgwire 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.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/AGENTS.md +8 -0
  3. data/CODEGEN_VERSION +1 -0
  4. data/LICENSE +21 -0
  5. data/README.md +159 -0
  6. data/generated/lib/imgwire-generated/api/cors_origins_api.rb +355 -0
  7. data/generated/lib/imgwire-generated/api/custom_domain_api.rb +253 -0
  8. data/generated/lib/imgwire-generated/api/images_api.rb +534 -0
  9. data/generated/lib/imgwire-generated/api/metrics_api.rb +156 -0
  10. data/generated/lib/imgwire-generated/api_client.rb +392 -0
  11. data/generated/lib/imgwire-generated/api_error.rb +58 -0
  12. data/generated/lib/imgwire-generated/configuration.rb +301 -0
  13. data/generated/lib/imgwire-generated/models/bulk_delete_images_schema.rb +248 -0
  14. data/generated/lib/imgwire-generated/models/cache_hit_ratio_dataset_point_schema.rb +263 -0
  15. data/generated/lib/imgwire-generated/models/cors_origin_create_schema.rb +246 -0
  16. data/generated/lib/imgwire-generated/models/cors_origin_schema.rb +341 -0
  17. data/generated/lib/imgwire-generated/models/cors_origin_update_schema.rb +246 -0
  18. data/generated/lib/imgwire-generated/models/custom_domain_certificate_status.rb +41 -0
  19. data/generated/lib/imgwire-generated/models/custom_domain_create_schema.rb +237 -0
  20. data/generated/lib/imgwire-generated/models/custom_domain_schema.rb +531 -0
  21. data/generated/lib/imgwire-generated/models/custom_domain_status.rb +41 -0
  22. data/generated/lib/imgwire-generated/models/custom_metadata_value.rb +106 -0
  23. data/generated/lib/imgwire-generated/models/http_validation_error.rb +222 -0
  24. data/generated/lib/imgwire-generated/models/image_download_job_create_schema.rb +248 -0
  25. data/generated/lib/imgwire-generated/models/image_download_job_schema.rb +389 -0
  26. data/generated/lib/imgwire-generated/models/image_download_status.rb +42 -0
  27. data/generated/lib/imgwire-generated/models/image_schema.rb +659 -0
  28. data/generated/lib/imgwire-generated/models/image_status.rb +42 -0
  29. data/generated/lib/imgwire-generated/models/location_inner.rb +104 -0
  30. data/generated/lib/imgwire-generated/models/metrics_dataset_interval.rb +42 -0
  31. data/generated/lib/imgwire-generated/models/metrics_datasets_schema.rb +379 -0
  32. data/generated/lib/imgwire-generated/models/metrics_stat_value_schema.rb +275 -0
  33. data/generated/lib/imgwire-generated/models/metrics_stats_schema.rb +367 -0
  34. data/generated/lib/imgwire-generated/models/requests_dataset_point_schema.rb +263 -0
  35. data/generated/lib/imgwire-generated/models/standard_upload_create_schema.rb +415 -0
  36. data/generated/lib/imgwire-generated/models/standard_upload_response_schema.rb +263 -0
  37. data/generated/lib/imgwire-generated/models/storage_bytes_dataset_point_schema.rb +289 -0
  38. data/generated/lib/imgwire-generated/models/supported_mime_type.rb +43 -0
  39. data/generated/lib/imgwire-generated/models/transfer_bytes_dataset_point_schema.rb +263 -0
  40. data/generated/lib/imgwire-generated/models/transformations_dataset_point_schema.rb +263 -0
  41. data/generated/lib/imgwire-generated/models/upload_token_create_response_schema.rb +379 -0
  42. data/generated/lib/imgwire-generated/models/uploads_dataset_point_schema.rb +263 -0
  43. data/generated/lib/imgwire-generated/models/validation_error.rb +291 -0
  44. data/generated/lib/imgwire-generated/version.rb +15 -0
  45. data/generated/lib/imgwire-generated.rb +74 -0
  46. data/lib/imgwire/client.rb +52 -0
  47. data/lib/imgwire/client_options.rb +14 -0
  48. data/lib/imgwire/http/upload_client.rb +53 -0
  49. data/lib/imgwire/image.rb +137 -0
  50. data/lib/imgwire/pagination.rb +82 -0
  51. data/lib/imgwire/resources/base_resource.rb +29 -0
  52. data/lib/imgwire/resources/cors_origins_resource.rb +47 -0
  53. data/lib/imgwire/resources/custom_domain_resource.rb +30 -0
  54. data/lib/imgwire/resources/images_resource.rb +106 -0
  55. data/lib/imgwire/resources/metrics_resource.rb +24 -0
  56. data/lib/imgwire/uploads.rb +78 -0
  57. data/lib/imgwire/version.rb +5 -0
  58. data/lib/imgwire.rb +18 -0
  59. metadata +158 -0
@@ -0,0 +1,659 @@
1
+ =begin
2
+ #imgwire.dev Backend API development
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ImgwireGenerated
17
+ class ImageSchema
18
+ attr_accessor :cdn_url
19
+
20
+ attr_accessor :created_at
21
+
22
+ attr_accessor :custom_metadata
23
+
24
+ attr_accessor :deleted_at
25
+
26
+ attr_accessor :environment_id
27
+
28
+ attr_accessor :exif_data
29
+
30
+ attr_accessor :extension
31
+
32
+ attr_accessor :hash_sha256
33
+
34
+ attr_accessor :height
35
+
36
+ attr_accessor :id
37
+
38
+ attr_accessor :idempotency_key
39
+
40
+ attr_accessor :mime_type
41
+
42
+ attr_accessor :original_filename
43
+
44
+ attr_accessor :processed_metadata_at
45
+
46
+ attr_accessor :purpose
47
+
48
+ attr_accessor :size_bytes
49
+
50
+ attr_accessor :status
51
+
52
+ attr_accessor :updated_at
53
+
54
+ attr_accessor :upload_token_id
55
+
56
+ attr_accessor :width
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'cdn_url' => :'cdn_url',
84
+ :'created_at' => :'created_at',
85
+ :'custom_metadata' => :'custom_metadata',
86
+ :'deleted_at' => :'deleted_at',
87
+ :'environment_id' => :'environment_id',
88
+ :'exif_data' => :'exif_data',
89
+ :'extension' => :'extension',
90
+ :'hash_sha256' => :'hash_sha256',
91
+ :'height' => :'height',
92
+ :'id' => :'id',
93
+ :'idempotency_key' => :'idempotency_key',
94
+ :'mime_type' => :'mime_type',
95
+ :'original_filename' => :'original_filename',
96
+ :'processed_metadata_at' => :'processed_metadata_at',
97
+ :'purpose' => :'purpose',
98
+ :'size_bytes' => :'size_bytes',
99
+ :'status' => :'status',
100
+ :'updated_at' => :'updated_at',
101
+ :'upload_token_id' => :'upload_token_id',
102
+ :'width' => :'width'
103
+ }
104
+ end
105
+
106
+ # Returns attribute mapping this model knows about
107
+ def self.acceptable_attribute_map
108
+ attribute_map
109
+ end
110
+
111
+ # Returns all the JSON keys this model knows about
112
+ def self.acceptable_attributes
113
+ acceptable_attribute_map.values
114
+ end
115
+
116
+ # Attribute type mapping.
117
+ def self.openapi_types
118
+ {
119
+ :'cdn_url' => :'String',
120
+ :'created_at' => :'Time',
121
+ :'custom_metadata' => :'Hash<String, CustomMetadataValue>',
122
+ :'deleted_at' => :'Time',
123
+ :'environment_id' => :'String',
124
+ :'exif_data' => :'Hash<String, Object>',
125
+ :'extension' => :'String',
126
+ :'hash_sha256' => :'String',
127
+ :'height' => :'Integer',
128
+ :'id' => :'String',
129
+ :'idempotency_key' => :'String',
130
+ :'mime_type' => :'SupportedMimeType',
131
+ :'original_filename' => :'String',
132
+ :'processed_metadata_at' => :'Time',
133
+ :'purpose' => :'String',
134
+ :'size_bytes' => :'Integer',
135
+ :'status' => :'ImageStatus',
136
+ :'updated_at' => :'Time',
137
+ :'upload_token_id' => :'String',
138
+ :'width' => :'Integer'
139
+ }
140
+ end
141
+
142
+ # List of attributes with nullable: true
143
+ def self.openapi_nullable
144
+ Set.new([
145
+ :'deleted_at',
146
+ :'environment_id',
147
+ :'hash_sha256',
148
+ :'idempotency_key',
149
+ :'processed_metadata_at',
150
+ :'purpose',
151
+ :'upload_token_id',
152
+ ])
153
+ end
154
+
155
+ # Initializes the object
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ def initialize(attributes = {})
158
+ if (!attributes.is_a?(Hash))
159
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ImgwireGenerated::ImageSchema` initialize method"
160
+ end
161
+
162
+ # check to see if the attribute exists and convert string to symbol for hash key
163
+ acceptable_attribute_map = self.class.acceptable_attribute_map
164
+ attributes = attributes.each_with_object({}) { |(k, v), h|
165
+ if (!acceptable_attribute_map.key?(k.to_sym))
166
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ImgwireGenerated::ImageSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
167
+ end
168
+ h[k.to_sym] = v
169
+ }
170
+
171
+ if attributes.key?(:'cdn_url')
172
+ self.cdn_url = attributes[:'cdn_url']
173
+ else
174
+ self.cdn_url = nil
175
+ end
176
+
177
+ if attributes.key?(:'created_at')
178
+ self.created_at = attributes[:'created_at']
179
+ else
180
+ self.created_at = nil
181
+ end
182
+
183
+ if attributes.key?(:'custom_metadata')
184
+ if (value = attributes[:'custom_metadata']).is_a?(Hash)
185
+ self.custom_metadata = value
186
+ end
187
+ else
188
+ self.custom_metadata = nil
189
+ end
190
+
191
+ if attributes.key?(:'deleted_at')
192
+ self.deleted_at = attributes[:'deleted_at']
193
+ else
194
+ self.deleted_at = nil
195
+ end
196
+
197
+ if attributes.key?(:'environment_id')
198
+ self.environment_id = attributes[:'environment_id']
199
+ else
200
+ self.environment_id = nil
201
+ end
202
+
203
+ if attributes.key?(:'exif_data')
204
+ if (value = attributes[:'exif_data']).is_a?(Hash)
205
+ self.exif_data = value
206
+ end
207
+ else
208
+ self.exif_data = nil
209
+ end
210
+
211
+ if attributes.key?(:'extension')
212
+ self.extension = attributes[:'extension']
213
+ else
214
+ self.extension = nil
215
+ end
216
+
217
+ if attributes.key?(:'hash_sha256')
218
+ self.hash_sha256 = attributes[:'hash_sha256']
219
+ else
220
+ self.hash_sha256 = nil
221
+ end
222
+
223
+ if attributes.key?(:'height')
224
+ self.height = attributes[:'height']
225
+ else
226
+ self.height = nil
227
+ end
228
+
229
+ if attributes.key?(:'id')
230
+ self.id = attributes[:'id']
231
+ else
232
+ self.id = nil
233
+ end
234
+
235
+ if attributes.key?(:'idempotency_key')
236
+ self.idempotency_key = attributes[:'idempotency_key']
237
+ else
238
+ self.idempotency_key = nil
239
+ end
240
+
241
+ if attributes.key?(:'mime_type')
242
+ self.mime_type = attributes[:'mime_type']
243
+ else
244
+ self.mime_type = nil
245
+ end
246
+
247
+ if attributes.key?(:'original_filename')
248
+ self.original_filename = attributes[:'original_filename']
249
+ else
250
+ self.original_filename = nil
251
+ end
252
+
253
+ if attributes.key?(:'processed_metadata_at')
254
+ self.processed_metadata_at = attributes[:'processed_metadata_at']
255
+ else
256
+ self.processed_metadata_at = nil
257
+ end
258
+
259
+ if attributes.key?(:'purpose')
260
+ self.purpose = attributes[:'purpose']
261
+ else
262
+ self.purpose = nil
263
+ end
264
+
265
+ if attributes.key?(:'size_bytes')
266
+ self.size_bytes = attributes[:'size_bytes']
267
+ else
268
+ self.size_bytes = nil
269
+ end
270
+
271
+ if attributes.key?(:'status')
272
+ self.status = attributes[:'status']
273
+ else
274
+ self.status = nil
275
+ end
276
+
277
+ if attributes.key?(:'updated_at')
278
+ self.updated_at = attributes[:'updated_at']
279
+ else
280
+ self.updated_at = nil
281
+ end
282
+
283
+ if attributes.key?(:'upload_token_id')
284
+ self.upload_token_id = attributes[:'upload_token_id']
285
+ else
286
+ self.upload_token_id = nil
287
+ end
288
+
289
+ if attributes.key?(:'width')
290
+ self.width = attributes[:'width']
291
+ else
292
+ self.width = nil
293
+ end
294
+ end
295
+
296
+ # Show invalid properties with the reasons. Usually used together with valid?
297
+ # @return Array for valid properties with the reasons
298
+ def list_invalid_properties
299
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
300
+ invalid_properties = Array.new
301
+ if @cdn_url.nil?
302
+ invalid_properties.push('invalid value for "cdn_url", cdn_url cannot be nil.')
303
+ end
304
+
305
+ if @created_at.nil?
306
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
307
+ end
308
+
309
+ if @custom_metadata.nil?
310
+ invalid_properties.push('invalid value for "custom_metadata", custom_metadata cannot be nil.')
311
+ end
312
+
313
+ if @exif_data.nil?
314
+ invalid_properties.push('invalid value for "exif_data", exif_data cannot be nil.')
315
+ end
316
+
317
+ if @extension.nil?
318
+ invalid_properties.push('invalid value for "extension", extension cannot be nil.')
319
+ end
320
+
321
+ if @height.nil?
322
+ invalid_properties.push('invalid value for "height", height cannot be nil.')
323
+ end
324
+
325
+ if @id.nil?
326
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
327
+ end
328
+
329
+ if @mime_type.nil?
330
+ invalid_properties.push('invalid value for "mime_type", mime_type cannot be nil.')
331
+ end
332
+
333
+ if @original_filename.nil?
334
+ invalid_properties.push('invalid value for "original_filename", original_filename cannot be nil.')
335
+ end
336
+
337
+ if @size_bytes.nil?
338
+ invalid_properties.push('invalid value for "size_bytes", size_bytes cannot be nil.')
339
+ end
340
+
341
+ if @status.nil?
342
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
343
+ end
344
+
345
+ if @updated_at.nil?
346
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
347
+ end
348
+
349
+ if @width.nil?
350
+ invalid_properties.push('invalid value for "width", width cannot be nil.')
351
+ end
352
+
353
+ invalid_properties
354
+ end
355
+
356
+ # Check to see if the all the properties in the model are valid
357
+ # @return true if the model is valid
358
+ def valid?
359
+ warn '[DEPRECATED] the `valid?` method is obsolete'
360
+ return false if @cdn_url.nil?
361
+ return false if @created_at.nil?
362
+ return false if @custom_metadata.nil?
363
+ return false if @exif_data.nil?
364
+ return false if @extension.nil?
365
+ return false if @height.nil?
366
+ return false if @id.nil?
367
+ return false if @mime_type.nil?
368
+ return false if @original_filename.nil?
369
+ return false if @size_bytes.nil?
370
+ return false if @status.nil?
371
+ return false if @updated_at.nil?
372
+ return false if @width.nil?
373
+ true
374
+ end
375
+
376
+ # Custom attribute writer method with validation
377
+ # @param [Object] cdn_url Value to be assigned
378
+ def cdn_url=(cdn_url)
379
+ if cdn_url.nil?
380
+ fail ArgumentError, 'cdn_url cannot be nil'
381
+ end
382
+
383
+ @cdn_url = cdn_url
384
+ end
385
+
386
+ # Custom attribute writer method with validation
387
+ # @param [Object] created_at Value to be assigned
388
+ def created_at=(created_at)
389
+ if created_at.nil?
390
+ fail ArgumentError, 'created_at cannot be nil'
391
+ end
392
+
393
+ @created_at = created_at
394
+ end
395
+
396
+ # Custom attribute writer method with validation
397
+ # @param [Object] custom_metadata Value to be assigned
398
+ def custom_metadata=(custom_metadata)
399
+ if custom_metadata.nil?
400
+ fail ArgumentError, 'custom_metadata cannot be nil'
401
+ end
402
+
403
+ @custom_metadata = custom_metadata
404
+ end
405
+
406
+ # Custom attribute writer method with validation
407
+ # @param [Object] exif_data Value to be assigned
408
+ def exif_data=(exif_data)
409
+ if exif_data.nil?
410
+ fail ArgumentError, 'exif_data cannot be nil'
411
+ end
412
+
413
+ @exif_data = exif_data
414
+ end
415
+
416
+ # Custom attribute writer method with validation
417
+ # @param [Object] extension Value to be assigned
418
+ def extension=(extension)
419
+ if extension.nil?
420
+ fail ArgumentError, 'extension cannot be nil'
421
+ end
422
+
423
+ @extension = extension
424
+ end
425
+
426
+ # Custom attribute writer method with validation
427
+ # @param [Object] height Value to be assigned
428
+ def height=(height)
429
+ if height.nil?
430
+ fail ArgumentError, 'height cannot be nil'
431
+ end
432
+
433
+ @height = height
434
+ end
435
+
436
+ # Custom attribute writer method with validation
437
+ # @param [Object] id Value to be assigned
438
+ def id=(id)
439
+ if id.nil?
440
+ fail ArgumentError, 'id cannot be nil'
441
+ end
442
+
443
+ @id = id
444
+ end
445
+
446
+ # Custom attribute writer method with validation
447
+ # @param [Object] mime_type Value to be assigned
448
+ def mime_type=(mime_type)
449
+ if mime_type.nil?
450
+ fail ArgumentError, 'mime_type cannot be nil'
451
+ end
452
+
453
+ @mime_type = mime_type
454
+ end
455
+
456
+ # Custom attribute writer method with validation
457
+ # @param [Object] original_filename Value to be assigned
458
+ def original_filename=(original_filename)
459
+ if original_filename.nil?
460
+ fail ArgumentError, 'original_filename cannot be nil'
461
+ end
462
+
463
+ @original_filename = original_filename
464
+ end
465
+
466
+ # Custom attribute writer method with validation
467
+ # @param [Object] size_bytes Value to be assigned
468
+ def size_bytes=(size_bytes)
469
+ if size_bytes.nil?
470
+ fail ArgumentError, 'size_bytes cannot be nil'
471
+ end
472
+
473
+ @size_bytes = size_bytes
474
+ end
475
+
476
+ # Custom attribute writer method with validation
477
+ # @param [Object] status Value to be assigned
478
+ def status=(status)
479
+ if status.nil?
480
+ fail ArgumentError, 'status cannot be nil'
481
+ end
482
+
483
+ @status = status
484
+ end
485
+
486
+ # Custom attribute writer method with validation
487
+ # @param [Object] updated_at Value to be assigned
488
+ def updated_at=(updated_at)
489
+ if updated_at.nil?
490
+ fail ArgumentError, 'updated_at cannot be nil'
491
+ end
492
+
493
+ @updated_at = updated_at
494
+ end
495
+
496
+ # Custom attribute writer method with validation
497
+ # @param [Object] width Value to be assigned
498
+ def width=(width)
499
+ if width.nil?
500
+ fail ArgumentError, 'width cannot be nil'
501
+ end
502
+
503
+ @width = width
504
+ end
505
+
506
+ # Checks equality by comparing each attribute.
507
+ # @param [Object] Object to be compared
508
+ def ==(o)
509
+ return true if self.equal?(o)
510
+ self.class == o.class &&
511
+ cdn_url == o.cdn_url &&
512
+ created_at == o.created_at &&
513
+ custom_metadata == o.custom_metadata &&
514
+ deleted_at == o.deleted_at &&
515
+ environment_id == o.environment_id &&
516
+ exif_data == o.exif_data &&
517
+ extension == o.extension &&
518
+ hash_sha256 == o.hash_sha256 &&
519
+ height == o.height &&
520
+ id == o.id &&
521
+ idempotency_key == o.idempotency_key &&
522
+ mime_type == o.mime_type &&
523
+ original_filename == o.original_filename &&
524
+ processed_metadata_at == o.processed_metadata_at &&
525
+ purpose == o.purpose &&
526
+ size_bytes == o.size_bytes &&
527
+ status == o.status &&
528
+ updated_at == o.updated_at &&
529
+ upload_token_id == o.upload_token_id &&
530
+ width == o.width
531
+ end
532
+
533
+ # @see the `==` method
534
+ # @param [Object] Object to be compared
535
+ def eql?(o)
536
+ self == o
537
+ end
538
+
539
+ # Calculates hash code according to all attributes.
540
+ # @return [Integer] Hash code
541
+ def hash
542
+ [cdn_url, created_at, custom_metadata, deleted_at, environment_id, exif_data, extension, hash_sha256, height, id, idempotency_key, mime_type, original_filename, processed_metadata_at, purpose, size_bytes, status, updated_at, upload_token_id, width].hash
543
+ end
544
+
545
+ # Builds the object from hash
546
+ # @param [Hash] attributes Model attributes in the form of hash
547
+ # @return [Object] Returns the model itself
548
+ def self.build_from_hash(attributes)
549
+ return nil unless attributes.is_a?(Hash)
550
+ attributes = attributes.transform_keys(&:to_sym)
551
+ transformed_hash = {}
552
+ openapi_types.each_pair do |key, type|
553
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
554
+ transformed_hash["#{key}"] = nil
555
+ elsif type =~ /\AArray<(.*)>/i
556
+ # check to ensure the input is an array given that the attribute
557
+ # is documented as an array but the input is not
558
+ if attributes[attribute_map[key]].is_a?(Array)
559
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
560
+ end
561
+ elsif !attributes[attribute_map[key]].nil?
562
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
563
+ end
564
+ end
565
+ new(transformed_hash)
566
+ end
567
+
568
+ # Deserializes the data based on type
569
+ # @param string type Data type
570
+ # @param string value Value to be deserialized
571
+ # @return [Object] Deserialized data
572
+ def self._deserialize(type, value)
573
+ case type.to_sym
574
+ when :Time
575
+ Time.parse(value)
576
+ when :Date
577
+ Date.parse(value)
578
+ when :String
579
+ value.to_s
580
+ when :Integer
581
+ value.to_i
582
+ when :Float
583
+ value.to_f
584
+ when :Boolean
585
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
586
+ true
587
+ else
588
+ false
589
+ end
590
+ when :Object
591
+ # generic object (usually a Hash), return directly
592
+ value
593
+ when /\AArray<(?<inner_type>.+)>\z/
594
+ inner_type = Regexp.last_match[:inner_type]
595
+ value.map { |v| _deserialize(inner_type, v) }
596
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
597
+ k_type = Regexp.last_match[:k_type]
598
+ v_type = Regexp.last_match[:v_type]
599
+ {}.tap do |hash|
600
+ value.each do |k, v|
601
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
602
+ end
603
+ end
604
+ else # model
605
+ # models (e.g. Pet) or oneOf
606
+ klass = ImgwireGenerated.const_get(type)
607
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
608
+ end
609
+ end
610
+
611
+ # Returns the string representation of the object
612
+ # @return [String] String presentation of the object
613
+ def to_s
614
+ to_hash.to_s
615
+ end
616
+
617
+ # to_body is an alias to to_hash (backward compatibility)
618
+ # @return [Hash] Returns the object in the form of hash
619
+ def to_body
620
+ to_hash
621
+ end
622
+
623
+ # Returns the object in the form of hash
624
+ # @return [Hash] Returns the object in the form of hash
625
+ def to_hash
626
+ hash = {}
627
+ self.class.attribute_map.each_pair do |attr, param|
628
+ value = self.send(attr)
629
+ if value.nil?
630
+ is_nullable = self.class.openapi_nullable.include?(attr)
631
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
632
+ end
633
+
634
+ hash[param] = _to_hash(value)
635
+ end
636
+ hash
637
+ end
638
+
639
+ # Outputs non-array value in the form of hash
640
+ # For object, use to_hash. Otherwise, just return the value
641
+ # @param [Object] value Any valid value
642
+ # @return [Hash] Returns the value in the form of hash
643
+ def _to_hash(value)
644
+ if value.is_a?(Array)
645
+ value.compact.map { |v| _to_hash(v) }
646
+ elsif value.is_a?(Hash)
647
+ {}.tap do |hash|
648
+ value.each { |k, v| hash[k] = _to_hash(v) }
649
+ end
650
+ elsif value.respond_to? :to_hash
651
+ value.to_hash
652
+ else
653
+ value
654
+ end
655
+ end
656
+
657
+ end
658
+
659
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #imgwire.dev Backend API development
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ImgwireGenerated
17
+ class ImageStatus
18
+ PENDING = "PENDING".freeze
19
+ PROCESSING = "PROCESSING".freeze
20
+ READY = "READY".freeze
21
+ QUARANTINE = "QUARANTINE".freeze
22
+
23
+ def self.all_vars
24
+ @all_vars ||= [PENDING, PROCESSING, READY, QUARANTINE].freeze
25
+ end
26
+
27
+ # Builds the enum from string
28
+ # @param [String] The enum value in the form of the string
29
+ # @return [String] The enum value
30
+ def self.build_from_hash(value)
31
+ new.build_from_hash(value)
32
+ end
33
+
34
+ # Builds the enum from string
35
+ # @param [String] The enum value in the form of the string
36
+ # @return [String] The enum value
37
+ def build_from_hash(value)
38
+ return value if ImageStatus.all_vars.include?(value)
39
+ raise "Invalid ENUM value #{value} for class #ImageStatus"
40
+ end
41
+ end
42
+ end