imgwire 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 465414c80dd7d88016d6e156b188ed81c5c074836000087e4e47d11baed5a8ae
4
- data.tar.gz: 8de6fcd2da02b947376eb73d9021eeb35bb62109133acecee8ad8f361c992ab8
3
+ metadata.gz: 6b912ed96b11a03a1ed5017b4dacb98af41a3bffebd7b34254a11fbc18d398b5
4
+ data.tar.gz: 57f6e83b710c3884283da8e6a772d0ad3e8e4da1cdb5696180aea496709f91ac
5
5
  SHA512:
6
- metadata.gz: 6ee90396ef5802259a36e17740a2c5b7e7e103b029b3f7eae3bb5966d613dc1a546a00ba2cfe1c0ea564bcab0e43938d7643be9387727a6d2b296d194a26a209
7
- data.tar.gz: 169a27d84d24340b998692974e8d4ec9f1c8248def2c14d0bcee3475cebc7e321c4cff6f8583090dd2eaabf90dd7160e6ea0c2c16024b586eecf0bad0316e9bd
6
+ metadata.gz: 97686c66dfad3d7bba07244ad8b0040bab9b29c8bb3a01a9e69e953e26eb20dc9c29401950624bb8ec61981c43169fce44dbea8eda8d87c8d7cde496a3344f9d
7
+ data.tar.gz: 2f268dd8db5e7479d7bde706427d533a3918f72cfe3f32d8c0f7b318c70ab6e17ab19e07a3c6dbc54cbb8d85286ee0c3df5b5ea1bea4b0f7540b925e7339824b
data/CODEGEN_VERSION CHANGED
@@ -1 +1 @@
1
- 213554905f77b6ffb7a29c020c632196bf0d7567b10d10f40a0a59839008d248
1
+ ff2563481f5f13c58b28b6ed0a20ff40145415791abd150cfbe89fc4b71ed7df
@@ -15,6 +15,8 @@ require 'time'
15
15
 
16
16
  module ImgwireGenerated
17
17
  class ImageSchema
18
+ attr_accessor :can_upload
19
+
18
20
  attr_accessor :cdn_url
19
21
 
20
22
  attr_accessor :created_at
@@ -37,6 +39,8 @@ module ImgwireGenerated
37
39
 
38
40
  attr_accessor :idempotency_key
39
41
 
42
+ attr_accessor :is_directly_deliverable
43
+
40
44
  attr_accessor :mime_type
41
45
 
42
46
  attr_accessor :original_filename
@@ -80,6 +84,7 @@ module ImgwireGenerated
80
84
  # Attribute mapping from ruby-style variable name to JSON key.
81
85
  def self.attribute_map
82
86
  {
87
+ :'can_upload' => :'can_upload',
83
88
  :'cdn_url' => :'cdn_url',
84
89
  :'created_at' => :'created_at',
85
90
  :'custom_metadata' => :'custom_metadata',
@@ -91,6 +96,7 @@ module ImgwireGenerated
91
96
  :'height' => :'height',
92
97
  :'id' => :'id',
93
98
  :'idempotency_key' => :'idempotency_key',
99
+ :'is_directly_deliverable' => :'is_directly_deliverable',
94
100
  :'mime_type' => :'mime_type',
95
101
  :'original_filename' => :'original_filename',
96
102
  :'processed_metadata_at' => :'processed_metadata_at',
@@ -116,6 +122,7 @@ module ImgwireGenerated
116
122
  # Attribute type mapping.
117
123
  def self.openapi_types
118
124
  {
125
+ :'can_upload' => :'Boolean',
119
126
  :'cdn_url' => :'String',
120
127
  :'created_at' => :'Time',
121
128
  :'custom_metadata' => :'Hash<String, CustomMetadataValue>',
@@ -127,6 +134,7 @@ module ImgwireGenerated
127
134
  :'height' => :'Integer',
128
135
  :'id' => :'String',
129
136
  :'idempotency_key' => :'String',
137
+ :'is_directly_deliverable' => :'Boolean',
130
138
  :'mime_type' => :'SupportedMimeType',
131
139
  :'original_filename' => :'String',
132
140
  :'processed_metadata_at' => :'Time',
@@ -168,6 +176,12 @@ module ImgwireGenerated
168
176
  h[k.to_sym] = v
169
177
  }
170
178
 
179
+ if attributes.key?(:'can_upload')
180
+ self.can_upload = attributes[:'can_upload']
181
+ else
182
+ self.can_upload = nil
183
+ end
184
+
171
185
  if attributes.key?(:'cdn_url')
172
186
  self.cdn_url = attributes[:'cdn_url']
173
187
  else
@@ -238,6 +252,12 @@ module ImgwireGenerated
238
252
  self.idempotency_key = nil
239
253
  end
240
254
 
255
+ if attributes.key?(:'is_directly_deliverable')
256
+ self.is_directly_deliverable = attributes[:'is_directly_deliverable']
257
+ else
258
+ self.is_directly_deliverable = nil
259
+ end
260
+
241
261
  if attributes.key?(:'mime_type')
242
262
  self.mime_type = attributes[:'mime_type']
243
263
  else
@@ -298,6 +318,10 @@ module ImgwireGenerated
298
318
  def list_invalid_properties
299
319
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
300
320
  invalid_properties = Array.new
321
+ if @can_upload.nil?
322
+ invalid_properties.push('invalid value for "can_upload", can_upload cannot be nil.')
323
+ end
324
+
301
325
  if @cdn_url.nil?
302
326
  invalid_properties.push('invalid value for "cdn_url", cdn_url cannot be nil.')
303
327
  end
@@ -326,6 +350,10 @@ module ImgwireGenerated
326
350
  invalid_properties.push('invalid value for "id", id cannot be nil.')
327
351
  end
328
352
 
353
+ if @is_directly_deliverable.nil?
354
+ invalid_properties.push('invalid value for "is_directly_deliverable", is_directly_deliverable cannot be nil.')
355
+ end
356
+
329
357
  if @mime_type.nil?
330
358
  invalid_properties.push('invalid value for "mime_type", mime_type cannot be nil.')
331
359
  end
@@ -357,6 +385,7 @@ module ImgwireGenerated
357
385
  # @return true if the model is valid
358
386
  def valid?
359
387
  warn '[DEPRECATED] the `valid?` method is obsolete'
388
+ return false if @can_upload.nil?
360
389
  return false if @cdn_url.nil?
361
390
  return false if @created_at.nil?
362
391
  return false if @custom_metadata.nil?
@@ -364,6 +393,7 @@ module ImgwireGenerated
364
393
  return false if @extension.nil?
365
394
  return false if @height.nil?
366
395
  return false if @id.nil?
396
+ return false if @is_directly_deliverable.nil?
367
397
  return false if @mime_type.nil?
368
398
  return false if @original_filename.nil?
369
399
  return false if @size_bytes.nil?
@@ -373,6 +403,16 @@ module ImgwireGenerated
373
403
  true
374
404
  end
375
405
 
406
+ # Custom attribute writer method with validation
407
+ # @param [Object] can_upload Value to be assigned
408
+ def can_upload=(can_upload)
409
+ if can_upload.nil?
410
+ fail ArgumentError, 'can_upload cannot be nil'
411
+ end
412
+
413
+ @can_upload = can_upload
414
+ end
415
+
376
416
  # Custom attribute writer method with validation
377
417
  # @param [Object] cdn_url Value to be assigned
378
418
  def cdn_url=(cdn_url)
@@ -443,6 +483,16 @@ module ImgwireGenerated
443
483
  @id = id
444
484
  end
445
485
 
486
+ # Custom attribute writer method with validation
487
+ # @param [Object] is_directly_deliverable Value to be assigned
488
+ def is_directly_deliverable=(is_directly_deliverable)
489
+ if is_directly_deliverable.nil?
490
+ fail ArgumentError, 'is_directly_deliverable cannot be nil'
491
+ end
492
+
493
+ @is_directly_deliverable = is_directly_deliverable
494
+ end
495
+
446
496
  # Custom attribute writer method with validation
447
497
  # @param [Object] mime_type Value to be assigned
448
498
  def mime_type=(mime_type)
@@ -508,6 +558,7 @@ module ImgwireGenerated
508
558
  def ==(o)
509
559
  return true if self.equal?(o)
510
560
  self.class == o.class &&
561
+ can_upload == o.can_upload &&
511
562
  cdn_url == o.cdn_url &&
512
563
  created_at == o.created_at &&
513
564
  custom_metadata == o.custom_metadata &&
@@ -519,6 +570,7 @@ module ImgwireGenerated
519
570
  height == o.height &&
520
571
  id == o.id &&
521
572
  idempotency_key == o.idempotency_key &&
573
+ is_directly_deliverable == o.is_directly_deliverable &&
522
574
  mime_type == o.mime_type &&
523
575
  original_filename == o.original_filename &&
524
576
  processed_metadata_at == o.processed_metadata_at &&
@@ -539,7 +591,7 @@ module ImgwireGenerated
539
591
  # Calculates hash code according to all attributes.
540
592
  # @return [Integer] Hash code
541
593
  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
594
+ [can_upload, cdn_url, created_at, custom_metadata, deleted_at, environment_id, exif_data, extension, hash_sha256, height, id, idempotency_key, is_directly_deliverable, mime_type, original_filename, processed_metadata_at, purpose, size_bytes, status, updated_at, upload_token_id, width].hash
543
595
  end
544
596
 
545
597
  # Builds the object from hash
@@ -16,13 +16,18 @@ require 'time'
16
16
  module ImgwireGenerated
17
17
  class SupportedMimeType
18
18
  IMAGE_JPEG = "image/jpeg".freeze
19
+ IMAGE_JXL = "image/jxl".freeze
19
20
  IMAGE_PNG = "image/png".freeze
20
21
  IMAGE_WEBP = "image/webp".freeze
21
22
  IMAGE_AVIF = "image/avif".freeze
22
23
  IMAGE_GIF = "image/gif".freeze
24
+ IMAGE_VND_MICROSOFT_ICON = "image/vnd.microsoft.icon".freeze
25
+ IMAGE_HEIC = "image/heic".freeze
26
+ IMAGE_BMP = "image/bmp".freeze
27
+ IMAGE_TIFF = "image/tiff".freeze
23
28
 
24
29
  def self.all_vars
25
- @all_vars ||= [IMAGE_JPEG, IMAGE_PNG, IMAGE_WEBP, IMAGE_AVIF, IMAGE_GIF].freeze
30
+ @all_vars ||= [IMAGE_JPEG, IMAGE_JXL, IMAGE_PNG, IMAGE_WEBP, IMAGE_AVIF, IMAGE_GIF, IMAGE_VND_MICROSOFT_ICON, IMAGE_HEIC, IMAGE_BMP, IMAGE_TIFF].freeze
26
31
  end
27
32
 
28
33
  # Builds the enum from string
data/lib/imgwire/image.rb CHANGED
@@ -6,7 +6,7 @@ module Imgwire
6
6
  class Image < ImgwireGenerated::ImageSchema
7
7
  PRESETS = %w[thumbnail small medium large].freeze
8
8
  ROTATE_ANGLES = [0, 90, 180, 270, 360].freeze
9
- FORMATS = %w[jpg png avif gif webp].freeze
9
+ FORMATS = %w[jpg png avif gif webp auto].freeze
10
10
 
11
11
  RULES = {
12
12
  'background' => %w[background bg],
@@ -61,13 +61,7 @@ module Imgwire
61
61
  raise ArgumentError, 'Invalid transformation rule value for preset' unless PRESETS.include?(preset)
62
62
 
63
63
  uri = URI.parse(cdn_url)
64
- slash_index = uri.path.rindex('/')
65
- prefix = slash_index ? uri.path[0..slash_index] : ''
66
- file_name = slash_index ? uri.path[(slash_index + 1)..] : uri.path
67
- dot_index = file_name.rindex('.')
68
- raise ArgumentError, 'Cannot apply a preset to a CDN URL without a file extension.' if dot_index.nil?
69
-
70
- "#{prefix}#{file_name}@#{preset}"
64
+ "#{uri.path}@#{preset}"
71
65
  end
72
66
 
73
67
  def build_query(options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Imgwire
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imgwire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blackhawk Software, LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-17 00:00:00.000000000 Z
11
+ date: 2026-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus