Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.2.0"
".": "4.3.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 47
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-13fc3d7cafdea492f62eef7c1d63424d6d9d8adbff74b9f6ca6fd3fc12a36840.yml
openapi_spec_hash: a1fe6fa48207791657a1ea2d60a6dfcc
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-e5b5a158784fff63311ceef956e8d5ce9e87c6b557d23ab737270040eb39adcd.yml
openapi_spec_hash: b0293985a8806f367319af573d1b418c
config_hash: 47cb702ee2cb52c58d803ae39ade9b44
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 4.3.0 (2026-02-27)

Full Changelog: [v4.2.0...v4.3.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.2.0...v4.3.0)

### Features

* **api:** dpr type update ([650aa0f](https://github.com/imagekit-developer/imagekit-ruby/commit/650aa0f905b4a586c036ae2f019bd7cfb7775d40))


### Bug Fixes

* **client:** always add content-length to post body, even when empty ([e156b70](https://github.com/imagekit-developer/imagekit-ruby/commit/e156b70c82c9b38de49307218fb3f687f651aa5b))
* **client:** loosen json header parsing ([9fc1fc6](https://github.com/imagekit-developer/imagekit-ruby/commit/9fc1fc60c60173f92f1f99fabe38f9ec826d940d))
* **client:** serialize query parameters properly ([bbfc6e0](https://github.com/imagekit-developer/imagekit-ruby/commit/bbfc6e0d80da5661600a888e8c915d336919fe36))
* properly mock time in ruby ci tests ([8f0a0a9](https://github.com/imagekit-developer/imagekit-ruby/commit/8f0a0a93ebc66d8d56d5e47950607f8d67f37514))


### Chores

* **docs:** remove www prefix ([a4b9610](https://github.com/imagekit-developer/imagekit-ruby/commit/a4b961058ac8967dcfef109421dbca9ee3eedf0b))
* **internal:** remove mock server code ([c8aa3b8](https://github.com/imagekit-developer/imagekit-ruby/commit/c8aa3b8c2320102d8e29941f78f1f1ade06cab00))
* update mock server docs ([1e5ed9e](https://github.com/imagekit-developer/imagekit-ruby/commit/1e5ed9ea31388b76995c292fc22f9ed773ad6f40))

## 4.2.0 (2026-02-02)

Full Changelog: [v4.1.2...v4.2.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.1.2...v4.2.0)
Expand Down
10 changes: 2 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ If you’d like to use the repository from source, you can either install from g
To install via git in your `Gemfile`:

```ruby
gem "imagekitio", git: "https://www.github.com/imagekit-developer/imagekit-ruby"
gem "imagekitio", git: "https://github.com/imagekit-developer/imagekit-ruby"
```

Alternatively, reference local copy of the repo:

```bash
$ git clone -- 'https://www.github.com/imagekit-developer/imagekit-ruby' '<path-to-repo>'
$ git clone -- 'https://github.com/imagekit-developer/imagekit-ruby' '<path-to-repo>'
```

```ruby
Expand All @@ -66,12 +66,6 @@ $ bundle exec rake

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
$ npx prism mock path/to/your/openapi.yml
```

```bash
$ bundle exec rake test
```
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
imagekitio (4.2.0)
imagekitio (4.3.0)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "imagekitio", "~> 4.2.0"
gem "imagekitio", "~> 4.3.0"
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion lib/imagekitio/internal/transport/pooled_net_requester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def build_request(request, &blk)

case body
in nil
nil
req["content-length"] ||= 0 unless req["transfer-encoding"]
in String
req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"]
req.body_stream = Imagekitio::Internal::Util::ReadIOAdapter.new(body, &blk)
Expand Down
33 changes: 32 additions & 1 deletion lib/imagekitio/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,42 @@ def writable_enum(&blk)
end

# @type [Regexp]
JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}
JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
# @type [Regexp]
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down
25 changes: 22 additions & 3 deletions lib/imagekitio/models/transformation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ class Transformation < Imagekitio::Internal::Type::BaseModel
# [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
# - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr).
#
# @return [Float, nil]
optional :dpr, Float
# @return [Float, String, nil]
optional :dpr, union: -> { Imagekitio::Transformation::Dpr }

# @!attribute duration
# Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
Expand Down Expand Up @@ -549,7 +549,7 @@ class Transformation < Imagekitio::Internal::Type::BaseModel
#
# @param distort [String] Distorts the shape of an image. Supports two modes:
#
# @param dpr [Float] Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio (DP
# @param dpr [Float, String] Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio (DP
#
# @param duration [Float, String] Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
#
Expand Down Expand Up @@ -785,6 +785,25 @@ module CropMode
# @return [Array<Symbol>]
end

# Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio
# (DPR) calculation. Also accepts arithmetic expressions.
#
# - Learn about
# [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
# - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr).
#
# @see Imagekitio::Models::Transformation#dpr
module Dpr
extend Imagekitio::Internal::Type::Union

variant Float

variant String

# @!method self.variants
# @return [Array(Float, String)]
end

# Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
# Typically used with startOffset to indicate the length from the start offset.
# Arithmetic expressions are supported. See
Expand Down
3 changes: 2 additions & 1 deletion lib/imagekitio/resources/accounts/usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ class Usage
# @see Imagekitio::Models::Accounts::UsageGetParams
def get(params)
parsed, options = Imagekitio::Accounts::UsageGetParams.dump_request(params)
query = Imagekitio::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/accounts/usage",
query: parsed.transform_keys(end_date: "endDate", start_date: "startDate"),
query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
model: Imagekitio::Models::Accounts::UsageGetResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/imagekitio/resources/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ class Assets
# @see Imagekitio::Models::AssetListParams
def list(params = {})
parsed, options = Imagekitio::AssetListParams.dump_request(params)
query = Imagekitio::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/files",
query: parsed.transform_keys(file_type: "fileType", search_query: "searchQuery"),
query: query.transform_keys(file_type: "fileType", search_query: "searchQuery"),
model: Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::Models::AssetListResponseItem],
options: options
)
Expand Down
9 changes: 5 additions & 4 deletions lib/imagekitio/resources/beta/v2/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ class Files
# about how to implement secure client-side file upload.
#
# **File size limit** \
# On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw
# files, and 100MB for videos. On the paid plan, these limits increase to 40MB for
# images, audio, and raw files, and 2GB for videos. These limits can be further increased
# with higher-tier plans.
# On the free plan, the maximum upload file sizes are 25MB for images, audio, and raw
# files, and 100MB for videos. On the Lite paid plan, these limits increase to 40MB
# for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan,
# these limits increase to 50MB for images, audio, and raw files and 2GB for videos.
# These limits can be further increased with enterprise plans.
#
# **Version limit** \
# A file can have a maximum of 100 versions.
Expand Down
3 changes: 2 additions & 1 deletion lib/imagekitio/resources/custom_metadata_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ def update(id, params = {})
# @see Imagekitio::Models::CustomMetadataFieldListParams
def list(params = {})
parsed, options = Imagekitio::CustomMetadataFieldListParams.dump_request(params)
query = Imagekitio::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/customMetadataFields",
query: parsed.transform_keys(folder_path: "folderPath", include_deleted: "includeDeleted"),
query: query.transform_keys(folder_path: "folderPath", include_deleted: "includeDeleted"),
model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::CustomMetadataField],
options: options
)
Expand Down
9 changes: 5 additions & 4 deletions lib/imagekitio/resources/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,11 @@ def rename(params)
# by verifying the entire payload using JWT.
#
# **File size limit** \
# On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw
# files and 100MB for videos. On the paid plan, these limits increase to 40MB for images,
# audio, and raw files and 2GB for videos. These limits can be further increased with
# higher-tier plans.
# On the free plan, the maximum upload file sizes are 25MB for images, audio, and raw
# files and 100MB for videos. On the Lite paid plan, these limits increase to 40MB
# for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan,
# these limits increase to 50MB for images, audio, and raw files and 2GB for videos.
# These limits can be further increased with enterprise plans.
#
# **Version limit** \
# A file can have a maximum of 100 versions.
Expand Down
3 changes: 2 additions & 1 deletion lib/imagekitio/resources/files/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ def get(file_id, params = {})
# @see Imagekitio::Models::Files::MetadataGetFromURLParams
def get_from_url(params)
parsed, options = Imagekitio::Files::MetadataGetFromURLParams.dump_request(params)
query = Imagekitio::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/metadata",
query: parsed,
query: query,
model: Imagekitio::Metadata,
options: options
)
Expand Down
2 changes: 1 addition & 1 deletion lib/imagekitio/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Imagekitio
VERSION = "4.2.0"
VERSION = "4.3.0"
end
22 changes: 21 additions & 1 deletion rbi/imagekitio/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,31 @@ module Imagekitio
end

JSON_CONTENT =
T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp)
T.let(%r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}, Regexp)
JSONL_CONTENT =
T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)

class << self
# @api private
sig do
params(query: Imagekitio::Internal::AnyHash).returns(
Imagekitio::Internal::AnyHash
)
end
def encode_query_params(query)
end

# @api private
sig do
params(
collection: Imagekitio::Internal::AnyHash,
key: String,
element: T.anything
).void
end
private def write_query_param_element!(collection, key, element)
end

# @api private
sig do
params(
Expand Down
26 changes: 22 additions & 4 deletions rbi/imagekitio/models/transformation.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ module Imagekitio
# - Learn about
# [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
# - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr).
sig { returns(T.nilable(Float)) }
sig { returns(T.nilable(Imagekitio::Transformation::Dpr::Variants)) }
attr_reader :dpr

sig { params(dpr: Float).void }
sig { params(dpr: Imagekitio::Transformation::Dpr::Variants).void }
attr_writer :dpr

# Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
Expand Down Expand Up @@ -672,7 +672,7 @@ module Imagekitio
crop_mode: Imagekitio::Transformation::CropMode::OrSymbol,
default_image: String,
distort: String,
dpr: Float,
dpr: Imagekitio::Transformation::Dpr::Variants,
duration: Imagekitio::Transformation::Duration::Variants,
end_offset: Imagekitio::Transformation::EndOffset::Variants,
flip: Imagekitio::Transformation::Flip::OrSymbol,
Expand Down Expand Up @@ -1006,7 +1006,7 @@ module Imagekitio
crop_mode: Imagekitio::Transformation::CropMode::OrSymbol,
default_image: String,
distort: String,
dpr: Float,
dpr: Imagekitio::Transformation::Dpr::Variants,
duration: Imagekitio::Transformation::Duration::Variants,
end_offset: Imagekitio::Transformation::EndOffset::Variants,
flip: Imagekitio::Transformation::Flip::OrSymbol,
Expand Down Expand Up @@ -1323,6 +1323,24 @@ module Imagekitio
end
end

# Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio
# (DPR) calculation. Also accepts arithmetic expressions.
#
# - Learn about
# [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
# - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr).
module Dpr
extend Imagekitio::Internal::Type::Union

Variants = T.type_alias { T.any(Float, String) }

sig do
override.returns(T::Array[Imagekitio::Transformation::Dpr::Variants])
end
def self.variants
end
end

# Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
# Typically used with startOffset to indicate the length from the start offset.
# Arithmetic expressions are supported. See
Expand Down
9 changes: 5 additions & 4 deletions rbi/imagekitio/resources/beta/v2/files.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ module Imagekitio
# about how to implement secure client-side file upload.
#
# **File size limit** \
# On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw
# files, and 100MB for videos. On the paid plan, these limits increase to 40MB for
# images, audio, and raw files, and 2GB for videos. These limits can be further increased
# with higher-tier plans.
# On the free plan, the maximum upload file sizes are 25MB for images, audio, and raw
# files, and 100MB for videos. On the Lite paid plan, these limits increase to 40MB
# for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan,
# these limits increase to 50MB for images, audio, and raw files and 2GB for videos.
# These limits can be further increased with enterprise plans.
#
# **Version limit** \
# A file can have a maximum of 100 versions.
Expand Down
9 changes: 5 additions & 4 deletions rbi/imagekitio/resources/files.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ module Imagekitio
# by verifying the entire payload using JWT.
#
# **File size limit** \
# On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw
# files and 100MB for videos. On the paid plan, these limits increase to 40MB for images,
# audio, and raw files and 2GB for videos. These limits can be further increased with
# higher-tier plans.
# On the free plan, the maximum upload file sizes are 25MB for images, audio, and raw
# files and 100MB for videos. On the Lite paid plan, these limits increase to 40MB
# for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan,
# these limits increase to 50MB for images, audio, and raw files and 2GB for videos.
# These limits can be further increased with enterprise plans.
#
# **Version limit** \
# A file can have a maximum of 100 versions.
Expand Down
Loading
Loading