diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e99ab82..aa5d164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: github.repository == 'stainless-sdks/imagekit-ruby' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- @@ -39,7 +39,7 @@ jobs: github.repository == 'stainless-sdks/imagekit-ruby' && !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc - uses: actions/github-script@v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: core.setOutput('github_token', await core.getIDToken()); @@ -60,9 +60,9 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- @@ -76,9 +76,9 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/imagekit-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml index 642e1eb..dc4f30c 100644 --- a/.github/workflows/publish-gem.yml +++ b/.github/workflows/publish-gem.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 26014cc..bd2fe0e 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'imagekit-developer/imagekit-ruby' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Check release environment run: | diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 396d9f0..3d5f4e3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.4.1" + ".": "4.5.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a1b609a..278a536 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-c7f578172392bde58bbb72be2a25b9e917529cd07550358c645ce155debf2418.yml -openapi_spec_hash: f0d797a17b1e8e81707517700cd44b13 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-ad6dd3b4acf289708568a12574b997503059a47c4a4ca5ffefe64f40f3d3dbf3.yml +openapi_spec_hash: 7c103e2dff0edcbeea82057e62f58d4d config_hash: 94f48fd13b7d41b8b6a203a3a8cee9ed diff --git a/CHANGELOG.md b/CHANGELOG.md index 63354d3..8ccadc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 4.5.0 (2026-05-13) + +Full Changelog: [v4.4.1...v4.5.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.4.1...v4.5.0) + +### Features + +* **api:** add no-enlarge crop modes and colorize transformation ([1b56303](https://github.com/imagekit-developer/imagekit-ruby/commit/1b56303ef5c67cb1a4b36d4a1c06b147f22c5987)) +* support setting headers via env ([cd32783](https://github.com/imagekit-developer/imagekit-ruby/commit/cd32783efe49d795b8a5de49eb44039cda375d2e)) +* **transformation:** add colorize transformation support in URL generation ([3454064](https://github.com/imagekit-developer/imagekit-ruby/commit/34540646f7ee8a1deabeea629f366d28bc71f734)) + + +### Chores + +* **internal:** codegen related update ([7e0543d](https://github.com/imagekit-developer/imagekit-ruby/commit/7e0543d8714ff251de1a32f471dc7bd8bfa17dab)) + ## 4.4.1 (2026-04-24) Full Changelog: [v4.4.0...v4.4.1](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.4.0...v4.4.1) diff --git a/Gemfile.lock b/Gemfile.lock index d8e6b57..088e705 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - imagekitio (4.4.1) + imagekitio (4.5.0) cgi connection_pool standardwebhooks @@ -144,7 +144,7 @@ GEM rexml (>= 3.2.6) sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) - standardwebhooks (1.0.1) + standardwebhooks (1.1.0) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) diff --git a/README.md b/README.md index 8c8e0ba..7a03c78 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "imagekitio", "~> 4.4.1" +gem "imagekitio", "~> 4.5.0" ``` diff --git a/lib/imagekitio/client.rb b/lib/imagekitio/client.rb index dc6d989..b4bfd22 100644 --- a/lib/imagekitio/client.rb +++ b/lib/imagekitio/client.rb @@ -120,6 +120,19 @@ def initialize( raise ArgumentError.new("private_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_KEY\"") end + headers = {} + custom_headers_env = ENV["IMAGE_KIT_CUSTOM_HEADERS"] + unless custom_headers_env.nil? + parsed = {} + custom_headers_env.split("\n").each do |line| + colon = line.index(":") + unless colon.nil? + parsed[line[0...colon].strip] = line[(colon + 1)..].strip + end + end + headers = parsed.merge(headers) + end + @private_key = private_key.to_s @password = password.to_s @webhook_secret = webhook_secret&.to_s @@ -129,7 +142,8 @@ def initialize( timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, - max_retry_delay: max_retry_delay + max_retry_delay: max_retry_delay, + headers: headers ) @custom_metadata_fields = Imagekitio::Resources::CustomMetadataFields.new(client: self) diff --git a/lib/imagekitio/helpers/transformation_utils.rb b/lib/imagekitio/helpers/transformation_utils.rb index 45c02a0..03a385b 100644 --- a/lib/imagekitio/helpers/transformation_utils.rb +++ b/lib/imagekitio/helpers/transformation_utils.rb @@ -84,6 +84,7 @@ module TransformationUtils "gradient" => "e-gradient", "color_replace" => "cr", "colorReplace" => "cr", + "colorize" => "e-colorize", "distort" => "e-distort", # Other flags & finishing diff --git a/lib/imagekitio/models/transformation.rb b/lib/imagekitio/models/transformation.rb index 160d809..4e41bbd 100644 --- a/lib/imagekitio/models/transformation.rb +++ b/lib/imagekitio/models/transformation.rb @@ -138,6 +138,18 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :border, String + # @!attribute colorize + # Applies a color tint to the image. Accepts color and intensity as optional + # parameters. + # + # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray + # color. + # - `in-intensity` - Intensity of the color (0-100). Default is 35. See + # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize). + # + # @return [String, nil] + optional :colorize, String + # @!attribute color_profile # Indicates whether the output image should retain the original color profile. See # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). @@ -498,7 +510,7 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # @return [Float, nil] optional :zoom, Float - # @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, color_profile: nil, color_replace: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, distort: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil) + # @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, colorize: nil, color_profile: nil, color_replace: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, distort: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil) # Some parameter documentations has been truncated, see # {Imagekitio::Models::Transformation} for more details. # @@ -535,6 +547,8 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # # @param border [String] Adds a border to the output media. Accepts a string in the format `] @@ -780,6 +795,8 @@ module CropMode PAD_RESIZE = :pad_resize EXTRACT = :extract PAD_EXTRACT = :pad_extract + PAD_RESIZE_NO_ENLARGE = :pad_resize_no_enlarge + PAD_EXTRACT_NO_SHRINK = :pad_extract_no_shrink # @!method self.values # @return [Array] diff --git a/lib/imagekitio/version.rb b/lib/imagekitio/version.rb index 4f6f300..fd555c9 100644 --- a/lib/imagekitio/version.rb +++ b/lib/imagekitio/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imagekitio - VERSION = "4.4.1" + VERSION = "4.5.0" end diff --git a/rbi/imagekitio/models/transformation.rbi b/rbi/imagekitio/models/transformation.rbi index 607451a..ffb8de7 100644 --- a/rbi/imagekitio/models/transformation.rbi +++ b/rbi/imagekitio/models/transformation.rbi @@ -198,6 +198,19 @@ module Imagekitio sig { params(border: String).void } attr_writer :border + # Applies a color tint to the image. Accepts color and intensity as optional + # parameters. + # + # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray + # color. + # - `in-intensity` - Intensity of the color (0-100). Default is 35. See + # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize). + sig { returns(T.nilable(String)) } + attr_reader :colorize + + sig { params(colorize: String).void } + attr_writer :colorize + # Indicates whether the output image should retain the original color profile. See # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). sig { returns(T.nilable(T::Boolean)) } @@ -664,6 +677,7 @@ module Imagekitio background: String, blur: Float, border: String, + colorize: String, color_profile: T::Boolean, color_replace: String, contrast_stretch: @@ -785,6 +799,14 @@ module Imagekitio # expression like `ih_div_20_FF00FF`. See # [Border](https://imagekit.io/docs/effects-and-enhancements#border---b). border: nil, + # Applies a color tint to the image. Accepts color and intensity as optional + # parameters. + # + # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray + # color. + # - `in-intensity` - Intensity of the color (0-100). Default is 35. See + # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize). + colorize: nil, # Indicates whether the output image should retain the original color profile. See # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). color_profile: nil, @@ -998,6 +1020,7 @@ module Imagekitio background: String, blur: Float, border: String, + colorize: String, color_profile: T::Boolean, color_replace: String, contrast_stretch: @@ -1285,6 +1308,11 @@ module Imagekitio T.let(:at_least, Imagekitio::Transformation::Crop::TaggedSymbol) MAINTAIN_RATIO = T.let(:maintain_ratio, Imagekitio::Transformation::Crop::TaggedSymbol) + MAINTAIN_RATIO_NO_ENLARGE = + T.let( + :maintain_ratio_no_enlarge, + Imagekitio::Transformation::Crop::TaggedSymbol + ) sig do override.returns( @@ -1313,6 +1341,16 @@ module Imagekitio :pad_extract, Imagekitio::Transformation::CropMode::TaggedSymbol ) + PAD_RESIZE_NO_ENLARGE = + T.let( + :pad_resize_no_enlarge, + Imagekitio::Transformation::CropMode::TaggedSymbol + ) + PAD_EXTRACT_NO_SHRINK = + T.let( + :pad_extract_no_shrink, + Imagekitio::Transformation::CropMode::TaggedSymbol + ) sig do override.returns( diff --git a/sig/imagekitio/models/transformation.rbs b/sig/imagekitio/models/transformation.rbs index 80be008..4124021 100644 --- a/sig/imagekitio/models/transformation.rbs +++ b/sig/imagekitio/models/transformation.rbs @@ -15,6 +15,7 @@ module Imagekitio background: String, blur: Float, border: String, + colorize: String, color_profile: bool, color_replace: String, contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch, @@ -127,6 +128,10 @@ module Imagekitio def border=: (String) -> String + attr_reader colorize: String? + + def colorize=: (String) -> String + attr_reader color_profile: bool? def color_profile=: (bool) -> bool @@ -355,6 +360,7 @@ module Imagekitio ?background: String, ?blur: Float, ?border: String, + ?colorize: String, ?color_profile: bool, ?color_replace: String, ?contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch, @@ -412,6 +418,7 @@ module Imagekitio background: String, blur: Float, border: String, + colorize: String, color_profile: bool, color_replace: String, contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch, @@ -544,7 +551,12 @@ module Imagekitio end type crop = - :force | :at_max | :at_max_enlarge | :at_least | :maintain_ratio + :force + | :at_max + | :at_max_enlarge + | :at_least + | :maintain_ratio + | :maintain_ratio_no_enlarge module Crop extend Imagekitio::Internal::Type::Enum @@ -554,11 +566,17 @@ module Imagekitio AT_MAX_ENLARGE: :at_max_enlarge AT_LEAST: :at_least MAINTAIN_RATIO: :maintain_ratio + MAINTAIN_RATIO_NO_ENLARGE: :maintain_ratio_no_enlarge def self?.values: -> ::Array[Imagekitio::Models::Transformation::crop] end - type crop_mode = :pad_resize | :extract | :pad_extract + type crop_mode = + :pad_resize + | :extract + | :pad_extract + | :pad_resize_no_enlarge + | :pad_extract_no_shrink module CropMode extend Imagekitio::Internal::Type::Enum @@ -566,6 +584,8 @@ module Imagekitio PAD_RESIZE: :pad_resize EXTRACT: :extract PAD_EXTRACT: :pad_extract + PAD_RESIZE_NO_ENLARGE: :pad_resize_no_enlarge + PAD_EXTRACT_NO_SHRINK: :pad_extract_no_shrink def self?.values: -> ::Array[Imagekitio::Models::Transformation::crop_mode] end diff --git a/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb b/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb index aa8298a..2a2d835 100644 --- a/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb +++ b/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb @@ -434,6 +434,7 @@ def test_should_generate_the_correct_url_with_many_transformations_including_vid # New transformations color_replace: "FF0000_50_0000FF", distort: "p-100_50_200_150_300_250_400_350", + colorize: "co-FF0000_in-15", original: true, page: "2_4", raw: "h-200,w-300,l-image,i-logo.png,l-end" @@ -449,7 +450,7 @@ def test_should_generate_the_correct_url_with_many_transformations_including_vid ) ) - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,cr-FF0000_50_0000FF,e-distort-p-100_50_200_150_300_250_400_350,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end" + expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,cr-FF0000_50_0000FF,e-distort-p-100_50_200_150_300_250_400_350,e-colorize-co-FF0000_in-15,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end" assert_equal(expected, url) end