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
52 changes: 46 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,58 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/imagekit-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/imagekit-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/imagekit-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: |-
github.repository == 'stainless-sdks/imagekit-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: imagekitio
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
Expand Down
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-83a7f3659a437113f2a79e1e72794be19eff00ec232fd0206198c80364ccfebf.yml
openapi_spec_hash: b327552548ab641eb4ea3b45e643dfce
config_hash: 47cb702ee2cb52c58d803ae39ade9b44
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## 4.3.0 (2026-03-16)

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))
* **api:** revert dpr breaking change ([525e6a8](https://github.com/imagekit-developer/imagekit-ruby/commit/525e6a8a59f0f4a17ab17468aebc4b8ccdce182c))
* **client:** add webhook support ([2a65217](https://github.com/imagekit-developer/imagekit-ruby/commit/2a65217314672d643372aafed4c83adf19c0566f))


### Bug Fixes

* **client:** add types for path params, and update structure of unions nested in params ([dd1e1ec](https://github.com/imagekit-developer/imagekit-ruby/commit/dd1e1ec791f563877bc2262b0aea91f4df9b2ced))
* **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

* **ci:** add build step ([c213724](https://github.com/imagekit-developer/imagekit-ruby/commit/c213724d793c735b09c784a5a285cf394f79d528))
* **ci:** skip uploading artifacts on stainless-internal branches ([fbc0465](https://github.com/imagekit-developer/imagekit-ruby/commit/fbc0465b3c2fc05da7a61fe74fab19189be90305))
* **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))
* **internal:** tweak CI branches ([125e8b4](https://github.com/imagekit-developer/imagekit-ruby/commit/125e8b4b0f3676378a863bacfc3cc93bf7b3f6ee))
* update mock server docs ([1e5ed9e](https://github.com/imagekit-developer/imagekit-ruby/commit/1e5ed9ea31388b76995c292fc22f9ed773ad6f40))
* update placeholder string ([cff7f1b](https://github.com/imagekit-developer/imagekit-ruby/commit/cff7f1b4cf7a249e7dd6f426c992472238a8c6e1))

## 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
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ GIT
PATH
remote: .
specs:
imagekitio (4.2.0)
imagekitio (4.3.0)
cgi
connection_pool
standardwebhooks

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -143,6 +144,7 @@ GEM
rexml (>= 3.2.6)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
standardwebhooks (1.0.1)
steep (1.10.0)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
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
1 change: 1 addition & 0 deletions imagekitio.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = ["README.md"]
s.add_dependency "cgi"
s.add_dependency "connection_pool"
s.add_dependency "standardwebhooks"
end
1 change: 1 addition & 0 deletions lib/imagekitio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

# Gems.
require "connection_pool"
require "standardwebhooks"

# Package files.
require_relative "imagekitio/version"
Expand Down
14 changes: 14 additions & 0 deletions lib/imagekitio/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class Client < Imagekitio::Internal::Transport::BaseClient
# @return [String, nil]
attr_reader :password

# Your ImageKit webhook secret for verifying webhook signatures (starts with
# `whsec_`). You can find this in the
# [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only
# required if you're using webhooks.
# @return [String, nil]
attr_reader :webhook_secret

# @return [Imagekitio::Resources::CustomMetadataFields]
attr_reader :custom_metadata_fields

Expand Down Expand Up @@ -80,6 +87,11 @@ def base_url_overridden? = @base_url_overridden
# dummy value. You can ignore this field. Defaults to
# `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]`
#
# @param webhook_secret [String, nil] Your ImageKit webhook secret for verifying webhook signatures (starts with
# `whsec_`). You can find this in the
# [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only
# required if you're using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]`
#
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
# `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]`
#
Expand All @@ -93,6 +105,7 @@ def base_url_overridden? = @base_url_overridden
def initialize(
private_key: ENV["IMAGEKIT_PRIVATE_KEY"],
password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"),
webhook_secret: ENV["IMAGEKIT_WEBHOOK_SECRET"],
base_url: ENV["IMAGE_KIT_BASE_URL"],
max_retries: self.class::DEFAULT_MAX_RETRIES,
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
Expand All @@ -109,6 +122,7 @@ def initialize(

@private_key = private_key.to_s
@password = password.to_s
@webhook_secret = webhook_secret&.to_s

super(
base_url: base_url,
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
10 changes: 1 addition & 9 deletions lib/imagekitio/models/accounts/origin_create_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ class OriginCreateParams < Imagekitio::Internal::Type::BaseModel
extend Imagekitio::Internal::Type::RequestParameters::Converter
include Imagekitio::Internal::Type::RequestParameters

# @!attribute origin_request
# Schema for origin request resources.
#
# @return [Imagekitio::Models::Accounts::OriginRequest::S3, Imagekitio::Models::Accounts::OriginRequest::S3Compatible, Imagekitio::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekitio::Models::Accounts::OriginRequest::WebFolder, Imagekitio::Models::Accounts::OriginRequest::WebProxy, Imagekitio::Models::Accounts::OriginRequest::Gcs, Imagekitio::Models::Accounts::OriginRequest::AzureBlob, Imagekitio::Models::Accounts::OriginRequest::AkeneoPim]
required :origin_request, union: -> { Imagekitio::Accounts::OriginRequest }

# @!method initialize(origin_request:, request_options: {})
# @param origin_request [Imagekitio::Models::Accounts::OriginRequest::S3, Imagekitio::Models::Accounts::OriginRequest::S3Compatible, Imagekitio::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekitio::Models::Accounts::OriginRequest::WebFolder, Imagekitio::Models::Accounts::OriginRequest::WebProxy, Imagekitio::Models::Accounts::OriginRequest::Gcs, Imagekitio::Models::Accounts::OriginRequest::AzureBlob, Imagekitio::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources.
#
# @!method initialize(request_options: {})
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
14 changes: 13 additions & 1 deletion lib/imagekitio/models/accounts/origin_delete_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ class OriginDeleteParams < Imagekitio::Internal::Type::BaseModel
extend Imagekitio::Internal::Type::RequestParameters::Converter
include Imagekitio::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# Unique identifier for the origin. This is generated by ImageKit when you create
# a new origin.
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Accounts::OriginDeleteParams} for more details.
#
# @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create
#
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
14 changes: 13 additions & 1 deletion lib/imagekitio/models/accounts/origin_get_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ class OriginGetParams < Imagekitio::Internal::Type::BaseModel
extend Imagekitio::Internal::Type::RequestParameters::Converter
include Imagekitio::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# Unique identifier for the origin. This is generated by ImageKit when you create
# a new origin.
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Accounts::OriginGetParams} for more details.
#
# @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create
#
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
16 changes: 10 additions & 6 deletions lib/imagekitio/models/accounts/origin_update_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ class OriginUpdateParams < Imagekitio::Internal::Type::BaseModel
extend Imagekitio::Internal::Type::RequestParameters::Converter
include Imagekitio::Internal::Type::RequestParameters

# @!attribute origin_request
# Schema for origin request resources.
# @!attribute id
# Unique identifier for the origin. This is generated by ImageKit when you create
# a new origin.
#
# @return [Imagekitio::Models::Accounts::OriginRequest::S3, Imagekitio::Models::Accounts::OriginRequest::S3Compatible, Imagekitio::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekitio::Models::Accounts::OriginRequest::WebFolder, Imagekitio::Models::Accounts::OriginRequest::WebProxy, Imagekitio::Models::Accounts::OriginRequest::Gcs, Imagekitio::Models::Accounts::OriginRequest::AzureBlob, Imagekitio::Models::Accounts::OriginRequest::AkeneoPim]
required :origin_request, union: -> { Imagekitio::Accounts::OriginRequest }
# @return [String]
required :id, String

# @!method initialize(origin_request:, request_options: {})
# @param origin_request [Imagekitio::Models::Accounts::OriginRequest::S3, Imagekitio::Models::Accounts::OriginRequest::S3Compatible, Imagekitio::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekitio::Models::Accounts::OriginRequest::WebFolder, Imagekitio::Models::Accounts::OriginRequest::WebProxy, Imagekitio::Models::Accounts::OriginRequest::Gcs, Imagekitio::Models::Accounts::OriginRequest::AzureBlob, Imagekitio::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources.
# @!method initialize(id:, request_options: {})
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Accounts::OriginUpdateParams} for more details.
#
# @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create
#
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
end
Expand Down
15 changes: 14 additions & 1 deletion lib/imagekitio/models/accounts/url_endpoint_delete_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ class URLEndpointDeleteParams < Imagekitio::Internal::Type::BaseModel
extend Imagekitio::Internal::Type::RequestParameters::Converter
include Imagekitio::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# Unique identifier for the URL-endpoint. This is generated by ImageKit when you
# create a new URL-endpoint. For the default URL-endpoint, this is always
# `default`.
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Accounts::URLEndpointDeleteParams} for more details.
#
# @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c
#
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
Loading
Loading