imagekitio 4.2.0 → 4.4.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 +4 -4
- data/CHANGELOG.md +73 -0
- data/README.md +9 -2
- data/lib/imagekitio/client.rb +14 -0
- data/lib/imagekitio/helpers/helper.rb +6 -0
- data/lib/imagekitio/internal/transport/pooled_net_requester.rb +1 -1
- data/lib/imagekitio/internal/type/base_model.rb +5 -5
- data/lib/imagekitio/internal/util.rb +54 -8
- data/lib/imagekitio/models/accounts/origin_create_params.rb +1 -9
- data/lib/imagekitio/models/accounts/origin_delete_params.rb +13 -1
- data/lib/imagekitio/models/accounts/origin_get_params.rb +13 -1
- data/lib/imagekitio/models/accounts/origin_update_params.rb +10 -6
- data/lib/imagekitio/models/accounts/url_endpoint_delete_params.rb +14 -1
- data/lib/imagekitio/models/accounts/url_endpoint_get_params.rb +14 -1
- data/lib/imagekitio/models/accounts/url_endpoint_update_params.rb +14 -1
- data/lib/imagekitio/models/ai_tag.rb +39 -0
- data/lib/imagekitio/models/beta/v2/file_upload_response.rb +9 -270
- data/lib/imagekitio/models/cache/invalidation_get_params.rb +7 -1
- data/lib/imagekitio/models/custom_metadata.rb +8 -0
- data/lib/imagekitio/models/custom_metadata_field_delete_params.rb +7 -1
- data/lib/imagekitio/models/custom_metadata_field_update_params.rb +8 -1
- data/lib/imagekitio/models/embedded_metadata.rb +8 -0
- data/lib/imagekitio/models/extension_config.rb +10 -5
- data/lib/imagekitio/models/extensions.rb +10 -5
- data/lib/imagekitio/models/file.rb +11 -275
- data/lib/imagekitio/models/file_create_event.rb +34 -0
- data/lib/imagekitio/models/file_delete_event.rb +44 -0
- data/lib/imagekitio/models/file_delete_params.rb +7 -1
- data/lib/imagekitio/models/file_get_params.rb +7 -1
- data/lib/imagekitio/models/file_update_event.rb +34 -0
- data/lib/imagekitio/models/file_update_params.rb +5 -7
- data/lib/imagekitio/models/file_upload_response.rb +9 -267
- data/lib/imagekitio/models/file_version_create_event.rb +34 -0
- data/lib/imagekitio/models/file_version_delete_event.rb +52 -0
- data/lib/imagekitio/models/files/metadata_get_params.rb +7 -1
- data/lib/imagekitio/models/files/version_delete_params.rb +7 -1
- data/lib/imagekitio/models/files/version_get_params.rb +7 -1
- data/lib/imagekitio/models/files/version_list_params.rb +7 -1
- data/lib/imagekitio/models/files/version_restore_params.rb +7 -1
- data/lib/imagekitio/models/folders/job_get_params.rb +7 -1
- data/lib/imagekitio/models/overlay_position.rb +99 -5
- data/lib/imagekitio/models/saved_extension_delete_params.rb +7 -1
- data/lib/imagekitio/models/saved_extension_get_params.rb +7 -1
- data/lib/imagekitio/models/saved_extension_update_params.rb +8 -1
- data/lib/imagekitio/models/selected_fields_schema.rb +212 -0
- data/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb +16 -1
- data/lib/imagekitio/models/unwrap_webhook_event.rb +16 -1
- data/lib/imagekitio/models/upload_pre_transform_success_event.rb +9 -285
- data/lib/imagekitio/models/version_info.rb +26 -0
- data/lib/imagekitio/models.rb +25 -0
- data/lib/imagekitio/resources/accounts/origins.rb +4 -14
- data/lib/imagekitio/resources/accounts/usage.rb +2 -1
- data/lib/imagekitio/resources/assets.rb +2 -1
- data/lib/imagekitio/resources/beta/v2/files.rb +5 -4
- data/lib/imagekitio/resources/custom_metadata_fields.rb +2 -1
- data/lib/imagekitio/resources/files/metadata.rb +2 -1
- data/lib/imagekitio/resources/files.rb +7 -11
- data/lib/imagekitio/resources/webhooks.rb +14 -3
- data/lib/imagekitio/version.rb +1 -1
- data/lib/imagekitio.rb +12 -1
- data/rbi/imagekitio/client.rbi +13 -0
- data/rbi/imagekitio/internal/util.rbi +29 -1
- data/rbi/imagekitio/models/accounts/origin_create_params.rbi +4 -51
- data/rbi/imagekitio/models/accounts/origin_delete_params.rbi +18 -5
- data/rbi/imagekitio/models/accounts/origin_get_params.rbi +18 -5
- data/rbi/imagekitio/models/accounts/origin_update_params.rbi +9 -43
- data/rbi/imagekitio/models/accounts/url_endpoint_delete_params.rbi +20 -5
- data/rbi/imagekitio/models/accounts/url_endpoint_get_params.rbi +20 -5
- data/rbi/imagekitio/models/accounts/url_endpoint_update_params.rbi +20 -5
- data/rbi/imagekitio/models/ai_tag.rbi +56 -0
- data/rbi/imagekitio/models/beta/v2/file_upload_response.rbi +11 -535
- data/rbi/imagekitio/models/cache/invalidation_get_params.rbi +11 -5
- data/rbi/imagekitio/models/custom_metadata.rbi +11 -0
- data/rbi/imagekitio/models/custom_metadata_field_delete_params.rbi +13 -5
- data/rbi/imagekitio/models/custom_metadata_field_update_params.rbi +6 -0
- data/rbi/imagekitio/models/embedded_metadata.rbi +11 -0
- data/rbi/imagekitio/models/extension_config.rbi +16 -6
- data/rbi/imagekitio/models/extensions.rbi +16 -6
- data/rbi/imagekitio/models/file.rbi +15 -475
- data/rbi/imagekitio/models/file_create_event.rbi +53 -0
- data/rbi/imagekitio/models/file_delete_event.rbi +80 -0
- data/rbi/imagekitio/models/file_delete_params.rbi +13 -5
- data/rbi/imagekitio/models/file_get_params.rbi +13 -5
- data/rbi/imagekitio/models/file_update_event.rbi +53 -0
- data/rbi/imagekitio/models/file_update_params.rbi +5 -28
- data/rbi/imagekitio/models/file_upload_response.rbi +11 -520
- data/rbi/imagekitio/models/file_version_create_event.rbi +56 -0
- data/rbi/imagekitio/models/file_version_delete_event.rbi +93 -0
- data/rbi/imagekitio/models/files/metadata_get_params.rbi +11 -5
- data/rbi/imagekitio/models/files/version_delete_params.rbi +10 -2
- data/rbi/imagekitio/models/files/version_get_params.rbi +10 -2
- data/rbi/imagekitio/models/files/version_list_params.rbi +11 -5
- data/rbi/imagekitio/models/files/version_restore_params.rbi +10 -2
- data/rbi/imagekitio/models/folders/job_get_params.rbi +11 -5
- data/rbi/imagekitio/models/overlay_position.rbi +165 -9
- data/rbi/imagekitio/models/saved_extension_delete_params.rbi +13 -5
- data/rbi/imagekitio/models/saved_extension_get_params.rbi +13 -5
- data/rbi/imagekitio/models/saved_extension_update_params.rbi +6 -0
- data/rbi/imagekitio/models/selected_fields_schema.rbi +364 -0
- data/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi +6 -1
- data/rbi/imagekitio/models/unwrap_webhook_event.rbi +6 -1
- data/rbi/imagekitio/models/upload_pre_transform_success_event.rbi +11 -533
- data/rbi/imagekitio/models/version_info.rbi +40 -0
- data/rbi/imagekitio/models.rbi +34 -0
- data/rbi/imagekitio/resources/accounts/origins.rbi +22 -2
- data/rbi/imagekitio/resources/beta/v2/files.rbi +5 -4
- data/rbi/imagekitio/resources/files.rbi +10 -5
- data/rbi/imagekitio/resources/webhooks.rbi +22 -4
- data/sig/imagekitio/client.rbs +3 -0
- data/sig/imagekitio/internal/util.rbs +14 -0
- data/sig/imagekitio/models/accounts/origin_create_params.rbs +3 -16
- data/sig/imagekitio/models/accounts/origin_delete_params.rbs +11 -3
- data/sig/imagekitio/models/accounts/origin_get_params.rbs +11 -3
- data/sig/imagekitio/models/accounts/origin_update_params.rbs +4 -9
- data/sig/imagekitio/models/accounts/url_endpoint_delete_params.rbs +11 -3
- data/sig/imagekitio/models/accounts/url_endpoint_get_params.rbs +11 -3
- data/sig/imagekitio/models/accounts/url_endpoint_update_params.rbs +13 -3
- data/sig/imagekitio/models/ai_tag.rbs +27 -0
- data/sig/imagekitio/models/beta/v2/file_upload_response.rbs +30 -223
- data/sig/imagekitio/models/cache/invalidation_get_params.rbs +11 -3
- data/sig/imagekitio/models/custom_metadata.rbs +7 -0
- data/sig/imagekitio/models/custom_metadata_field_delete_params.rbs +11 -3
- data/sig/imagekitio/models/custom_metadata_field_update_params.rbs +5 -0
- data/sig/imagekitio/models/embedded_metadata.rbs +7 -0
- data/sig/imagekitio/models/file.rbs +29 -224
- data/sig/imagekitio/models/file_create_event.rbs +32 -0
- data/sig/imagekitio/models/file_delete_event.rbs +48 -0
- data/sig/imagekitio/models/file_delete_params.rbs +11 -3
- data/sig/imagekitio/models/file_get_params.rbs +12 -3
- data/sig/imagekitio/models/file_update_event.rbs +32 -0
- data/sig/imagekitio/models/file_update_params.rbs +4 -9
- data/sig/imagekitio/models/file_upload_response.rbs +29 -224
- data/sig/imagekitio/models/file_version_create_event.rbs +36 -0
- data/sig/imagekitio/models/file_version_delete_event.rbs +50 -0
- data/sig/imagekitio/models/files/metadata_get_params.rbs +11 -3
- data/sig/imagekitio/models/files/version_delete_params.rbs +6 -1
- data/sig/imagekitio/models/files/version_get_params.rbs +6 -1
- data/sig/imagekitio/models/files/version_list_params.rbs +11 -3
- data/sig/imagekitio/models/files/version_restore_params.rbs +6 -1
- data/sig/imagekitio/models/folders/job_get_params.rbs +11 -3
- data/sig/imagekitio/models/overlay_position.rbs +73 -3
- data/sig/imagekitio/models/saved_extension_delete_params.rbs +11 -3
- data/sig/imagekitio/models/saved_extension_get_params.rbs +11 -3
- data/sig/imagekitio/models/saved_extension_update_params.rbs +5 -0
- data/sig/imagekitio/models/selected_fields_schema.rbs +165 -0
- data/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs +5 -0
- data/sig/imagekitio/models/unwrap_webhook_event.rbs +5 -0
- data/sig/imagekitio/models/upload_pre_transform_success_event.rbs +29 -224
- data/sig/imagekitio/models/version_info.rbs +19 -0
- data/sig/imagekitio/models.rbs +22 -0
- data/sig/imagekitio/resources/accounts/origins.rbs +2 -2
- data/sig/imagekitio/resources/files.rbs +1 -1
- data/sig/imagekitio/resources/webhooks.rbs +15 -3
- metadata +46 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3725549133c3a1b7f73bd482205a438cc0c60653bdbff20bc4d02d25d188440c
|
|
4
|
+
data.tar.gz: 9a50059b5bcb0935f83738fd0ec95b08aafe093c7d846054ff1c966986b309a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a87112bc202a98142af8ebc384627d145b815dde075097e99600fbe1fbbdc0ff9fd4b2cae754eec07560e2c0d2a9a736a35f7ed46d338180e98d4602a39c115b
|
|
7
|
+
data.tar.gz: 911b6aaa8efdfc32910bd8458775598edee94f6279f739b4014b652dd0269c9a609d79e8bdd581b1296a9a698ef77a4c936e4c6f97c8c0f8a381cfee9c317728
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.4.0 (2026-04-13)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v4.3.0...v4.4.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.3.0...v4.4.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add missing types in ruby ([6a074df](https://github.com/imagekit-developer/imagekit-ruby/commit/6a074df0249e9ac9969c2bc4b8d12d9abbd1e233))
|
|
10
|
+
* **api:** dam related webhook events ([d2ffbf3](https://github.com/imagekit-developer/imagekit-ruby/commit/d2ffbf33cabaddffbb97d4c7bc7e54be100a3c67))
|
|
11
|
+
* **api:** fix spec indentation ([74e7a6a](https://github.com/imagekit-developer/imagekit-ruby/commit/74e7a6ae49a83d6faa29796443309f20633b430d))
|
|
12
|
+
* **api:** indentation fix ([fae3b74](https://github.com/imagekit-developer/imagekit-ruby/commit/fae3b74e0de1bdd3e5a29c6061f546aacfc423cb))
|
|
13
|
+
* **api:** merge with main to bring back missing parameters ([78377b5](https://github.com/imagekit-developer/imagekit-ruby/commit/78377b55c03f7818a5f2ae57d19464dfae58763a))
|
|
14
|
+
* **api:** update webhook event names and remove DAM prefix ([c621b14](https://github.com/imagekit-developer/imagekit-ruby/commit/c621b14ca3a92b3428bd3a41156539aba3668097))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **api:** extract shared schemas to prevent Go webhook union breaking changes ([0325862](https://github.com/imagekit-developer/imagekit-ruby/commit/032586298410662b5f45b9b4189cc23ef74c1e40))
|
|
20
|
+
* **api:** fix references of schema ([3d07367](https://github.com/imagekit-developer/imagekit-ruby/commit/3d073676557eaac1a3ce9447866936e707f45566))
|
|
21
|
+
* **api:** rename DamFile events to File for consistency ([5998787](https://github.com/imagekit-developer/imagekit-ruby/commit/5998787a6607eb936b51b46b92e24679ac2dd321))
|
|
22
|
+
* **docs:** remove redundant information about versioning in README ([a546963](https://github.com/imagekit-developer/imagekit-ruby/commit/a546963ec88a011e18426a2a9ad46893e8e45eec))
|
|
23
|
+
* **docs:** remove redundant sub-item for webhook signature verification in README ([03f4b45](https://github.com/imagekit-developer/imagekit-ruby/commit/03f4b4580157f6c5a81905b549801e9abb2f3c2c))
|
|
24
|
+
* **docs:** remove unnecessary password parameter from example ([77c9134](https://github.com/imagekit-developer/imagekit-ruby/commit/77c9134775b106ac5107579f3059390870ced790))
|
|
25
|
+
* multipart encoding for file arrays ([5f02f3a](https://github.com/imagekit-developer/imagekit-ruby/commit/5f02f3a700d92bdcba063ce82d64c82fc70d37f8))
|
|
26
|
+
* **webhooks:** encode webhook key in Base64 before verification ([db0b711](https://github.com/imagekit-developer/imagekit-ruby/commit/db0b711f50b3e992f36dd3f30ef74dac502a44a2))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Documentation
|
|
30
|
+
|
|
31
|
+
* add webhook verification section to README ([ceb1927](https://github.com/imagekit-developer/imagekit-ruby/commit/ceb1927213edf8467e8e584a4b43999f0cedcf20))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Refactors
|
|
35
|
+
|
|
36
|
+
* AITags to singular AITag schema with array items pattern ([01a4f00](https://github.com/imagekit-developer/imagekit-ruby/commit/01a4f00f0ce0b7f308f8f84351327c2a25a77408))
|
|
37
|
+
|
|
38
|
+
## 4.3.0 (2026-04-06)
|
|
39
|
+
|
|
40
|
+
Full Changelog: [v4.2.0...v4.3.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.2.0...v4.3.0)
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* **api:** add support for x_center, y_center, and anchor_point in overlay positioning ([dcbcf76](https://github.com/imagekit-developer/imagekit-ruby/commit/dcbcf7610f2a484689f5c83a8779ab3dd4c5b092))
|
|
45
|
+
* **api:** dpr type update ([650aa0f](https://github.com/imagekit-developer/imagekit-ruby/commit/650aa0f905b4a586c036ae2f019bd7cfb7775d40))
|
|
46
|
+
* **api:** Introduce lxc, lyc, lap parameters in overlays. ([5a87ef0](https://github.com/imagekit-developer/imagekit-ruby/commit/5a87ef064bc9c14d1d62bbd338b64d7718888460))
|
|
47
|
+
* **api:** revert dpr breaking change ([525e6a8](https://github.com/imagekit-developer/imagekit-ruby/commit/525e6a8a59f0f4a17ab17468aebc4b8ccdce182c))
|
|
48
|
+
* **client:** add webhook support ([2a65217](https://github.com/imagekit-developer/imagekit-ruby/commit/2a65217314672d643372aafed4c83adf19c0566f))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* align path encoding with RFC 3986 section 3.3 ([88f5590](https://github.com/imagekit-developer/imagekit-ruby/commit/88f5590fc3bb8b7766d4698892aff762f80d3629))
|
|
54
|
+
* **client:** add types for path params, and update structure of unions nested in params ([dd1e1ec](https://github.com/imagekit-developer/imagekit-ruby/commit/dd1e1ec791f563877bc2262b0aea91f4df9b2ced))
|
|
55
|
+
* **client:** always add content-length to post body, even when empty ([e156b70](https://github.com/imagekit-developer/imagekit-ruby/commit/e156b70c82c9b38de49307218fb3f687f651aa5b))
|
|
56
|
+
* **client:** loosen json header parsing ([9fc1fc6](https://github.com/imagekit-developer/imagekit-ruby/commit/9fc1fc60c60173f92f1f99fabe38f9ec826d940d))
|
|
57
|
+
* **client:** serialize query parameters properly ([bbfc6e0](https://github.com/imagekit-developer/imagekit-ruby/commit/bbfc6e0d80da5661600a888e8c915d336919fe36))
|
|
58
|
+
* **internal:** correct multipart form field name encoding ([f3c20a9](https://github.com/imagekit-developer/imagekit-ruby/commit/f3c20a9740682cb96e90eecfd617f204cd28a491))
|
|
59
|
+
* properly mock time in ruby ci tests ([8f0a0a9](https://github.com/imagekit-developer/imagekit-ruby/commit/8f0a0a93ebc66d8d56d5e47950607f8d67f37514))
|
|
60
|
+
* variable name typo ([1d32dc3](https://github.com/imagekit-developer/imagekit-ruby/commit/1d32dc3ec09c80961cc58ecfd40b2449957a2ac9))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Chores
|
|
64
|
+
|
|
65
|
+
* **ci:** add build step ([c213724](https://github.com/imagekit-developer/imagekit-ruby/commit/c213724d793c735b09c784a5a285cf394f79d528))
|
|
66
|
+
* **ci:** skip lint on metadata-only changes ([62e401f](https://github.com/imagekit-developer/imagekit-ruby/commit/62e401f6fc35fa3bc0e16593bab8e4a477536d4f))
|
|
67
|
+
* **ci:** skip uploading artifacts on stainless-internal branches ([fbc0465](https://github.com/imagekit-developer/imagekit-ruby/commit/fbc0465b3c2fc05da7a61fe74fab19189be90305))
|
|
68
|
+
* **ci:** support opting out of skipping builds on metadata-only commits ([af71b49](https://github.com/imagekit-developer/imagekit-ruby/commit/af71b4919ea7eb3bf704ed6a83eaa9301b5201f9))
|
|
69
|
+
* **docs:** remove www prefix ([a4b9610](https://github.com/imagekit-developer/imagekit-ruby/commit/a4b961058ac8967dcfef109421dbca9ee3eedf0b))
|
|
70
|
+
* **internal:** remove mock server code ([c8aa3b8](https://github.com/imagekit-developer/imagekit-ruby/commit/c8aa3b8c2320102d8e29941f78f1f1ade06cab00))
|
|
71
|
+
* **internal:** tweak CI branches ([125e8b4](https://github.com/imagekit-developer/imagekit-ruby/commit/125e8b4b0f3676378a863bacfc3cc93bf7b3f6ee))
|
|
72
|
+
* **internal:** update gitignore ([741331c](https://github.com/imagekit-developer/imagekit-ruby/commit/741331c210a1af49f43ff77f593293e42882c15b))
|
|
73
|
+
* update mock server docs ([1e5ed9e](https://github.com/imagekit-developer/imagekit-ruby/commit/1e5ed9ea31388b76995c292fc22f9ed773ad6f40))
|
|
74
|
+
* update placeholder string ([cff7f1b](https://github.com/imagekit-developer/imagekit-ruby/commit/cff7f1b4cf7a249e7dd6f426c992472238a8c6e1))
|
|
75
|
+
|
|
3
76
|
## 4.2.0 (2026-02-02)
|
|
4
77
|
|
|
5
78
|
Full Changelog: [v4.1.2...v4.2.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.1.2...v4.2.0)
|
data/README.md
CHANGED
|
@@ -25,6 +25,7 @@ If you're using Ruby on Rails, the [ImageKit Rails gem](https://github.com/image
|
|
|
25
25
|
- [Helper Methods](#helper-methods)
|
|
26
26
|
- [Authentication parameters for client-side uploads](#authentication-parameters-for-client-side-uploads)
|
|
27
27
|
- [Responsive image attributes](#responsive-image-attributes)
|
|
28
|
+
- [Webhook verification](#webhook-verification)
|
|
28
29
|
- [Handling errors](#handling-errors)
|
|
29
30
|
- [Retries](#retries)
|
|
30
31
|
- [Timeouts](#timeouts)
|
|
@@ -45,7 +46,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
45
46
|
<!-- x-release-please-start-version -->
|
|
46
47
|
|
|
47
48
|
```ruby
|
|
48
|
-
gem "imagekitio", "~> 4.
|
|
49
|
+
gem "imagekitio", "~> 4.4.0"
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
<!-- x-release-please-end -->
|
|
@@ -525,6 +526,12 @@ attrs = image_kit.helper.get_responsive_image_attributes({
|
|
|
525
526
|
})
|
|
526
527
|
```
|
|
527
528
|
|
|
529
|
+
## Webhook verification
|
|
530
|
+
|
|
531
|
+
The ImageKit SDK provides utilities to verify webhook signatures for secure event handling. This ensures that webhook requests are actually coming from ImageKit and haven't been tampered with.
|
|
532
|
+
|
|
533
|
+
For detailed information about webhook setup, signature verification, and handling different webhook events, refer to the [ImageKit webhook documentation](https://imagekit.io/docs/webhooks#verify-webhook-signature).
|
|
534
|
+
|
|
528
535
|
### Handling errors
|
|
529
536
|
|
|
530
537
|
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown:
|
|
@@ -731,7 +738,7 @@ image_kit.assets.list(
|
|
|
731
738
|
|
|
732
739
|
## Versioning
|
|
733
740
|
|
|
734
|
-
This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions.
|
|
741
|
+
This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions.
|
|
735
742
|
|
|
736
743
|
This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
|
|
737
744
|
|
data/lib/imagekitio/client.rb
CHANGED
|
@@ -25,6 +25,13 @@ module Imagekitio
|
|
|
25
25
|
# @return [String, nil]
|
|
26
26
|
attr_reader :password
|
|
27
27
|
|
|
28
|
+
# Your ImageKit webhook secret for verifying webhook signatures (starts with
|
|
29
|
+
# `whsec_`). You can find this in the
|
|
30
|
+
# [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only
|
|
31
|
+
# required if you're using webhooks.
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
attr_reader :webhook_secret
|
|
34
|
+
|
|
28
35
|
# @return [Imagekitio::Resources::CustomMetadataFields]
|
|
29
36
|
attr_reader :custom_metadata_fields
|
|
30
37
|
|
|
@@ -80,6 +87,11 @@ module Imagekitio
|
|
|
80
87
|
# dummy value. You can ignore this field. Defaults to
|
|
81
88
|
# `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]`
|
|
82
89
|
#
|
|
90
|
+
# @param webhook_secret [String, nil] Your ImageKit webhook secret for verifying webhook signatures (starts with
|
|
91
|
+
# `whsec_`). You can find this in the
|
|
92
|
+
# [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only
|
|
93
|
+
# required if you're using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]`
|
|
94
|
+
#
|
|
83
95
|
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
|
|
84
96
|
# `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]`
|
|
85
97
|
#
|
|
@@ -93,6 +105,7 @@ module Imagekitio
|
|
|
93
105
|
def initialize(
|
|
94
106
|
private_key: ENV["IMAGEKIT_PRIVATE_KEY"],
|
|
95
107
|
password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"),
|
|
108
|
+
webhook_secret: ENV["IMAGEKIT_WEBHOOK_SECRET"],
|
|
96
109
|
base_url: ENV["IMAGE_KIT_BASE_URL"],
|
|
97
110
|
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
|
98
111
|
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
|
|
@@ -109,6 +122,7 @@ module Imagekitio
|
|
|
109
122
|
|
|
110
123
|
@private_key = private_key.to_s
|
|
111
124
|
@password = password.to_s
|
|
125
|
+
@webhook_secret = webhook_secret&.to_s
|
|
112
126
|
|
|
113
127
|
super(
|
|
114
128
|
base_url: base_url,
|
|
@@ -635,11 +635,17 @@ module Imagekitio
|
|
|
635
635
|
if position
|
|
636
636
|
x = safe_get(position, :x)
|
|
637
637
|
y = safe_get(position, :y_)
|
|
638
|
+
x_center = safe_get(position, :x_center)
|
|
639
|
+
y_center = safe_get(position, :y_center)
|
|
638
640
|
focus = safe_get(position, :focus)
|
|
641
|
+
anchor_point = safe_get(position, :anchor_point)
|
|
639
642
|
|
|
640
643
|
parts << "lx-#{x}" if x
|
|
641
644
|
parts << "ly-#{y}" if y
|
|
645
|
+
parts << "lxc-#{x_center}" if x_center
|
|
646
|
+
parts << "lyc-#{y_center}" if y_center
|
|
642
647
|
parts << "lfo-#{focus}" if focus
|
|
648
|
+
parts << "lap-#{anchor_point}" if anchor_point
|
|
643
649
|
end
|
|
644
650
|
|
|
645
651
|
# Add timing properties
|
|
@@ -75,7 +75,7 @@ module Imagekitio
|
|
|
75
75
|
|
|
76
76
|
case body
|
|
77
77
|
in nil
|
|
78
|
-
|
|
78
|
+
req["content-length"] ||= 0 unless req["transfer-encoding"]
|
|
79
79
|
in String
|
|
80
80
|
req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"]
|
|
81
81
|
req.body_stream = Imagekitio::Internal::Util::ReadIOAdapter.new(body, &blk)
|
|
@@ -438,11 +438,11 @@ module Imagekitio
|
|
|
438
438
|
# @return [Hash{Symbol=>Object}]
|
|
439
439
|
#
|
|
440
440
|
# @example
|
|
441
|
-
# # `
|
|
442
|
-
#
|
|
443
|
-
#
|
|
444
|
-
#
|
|
445
|
-
#
|
|
441
|
+
# # `ai_tag` is a `Imagekitio::AITag`
|
|
442
|
+
# ai_tag => {
|
|
443
|
+
# confidence: confidence,
|
|
444
|
+
# name: name,
|
|
445
|
+
# source: source
|
|
446
446
|
# }
|
|
447
447
|
def deconstruct_keys(keys)
|
|
448
448
|
(keys || self.class.known_fields.keys)
|
|
@@ -157,7 +157,7 @@ module Imagekitio
|
|
|
157
157
|
in Hash | nil => coerced
|
|
158
158
|
coerced
|
|
159
159
|
else
|
|
160
|
-
message = "Expected a #{Hash} or #{Imagekitio::Internal::Type::BaseModel}, got #{
|
|
160
|
+
message = "Expected a #{Hash} or #{Imagekitio::Internal::Type::BaseModel}, got #{input.inspect}"
|
|
161
161
|
raise ArgumentError.new(message)
|
|
162
162
|
end
|
|
163
163
|
end
|
|
@@ -237,6 +237,11 @@ module Imagekitio
|
|
|
237
237
|
end
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
+
# @type [Regexp]
|
|
241
|
+
#
|
|
242
|
+
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
|
|
243
|
+
RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
|
|
244
|
+
|
|
240
245
|
class << self
|
|
241
246
|
# @api private
|
|
242
247
|
#
|
|
@@ -247,6 +252,15 @@ module Imagekitio
|
|
|
247
252
|
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
|
|
248
253
|
end
|
|
249
254
|
|
|
255
|
+
# @api private
|
|
256
|
+
#
|
|
257
|
+
# @param path [String, Integer]
|
|
258
|
+
#
|
|
259
|
+
# @return [String]
|
|
260
|
+
def encode_path(path)
|
|
261
|
+
path.to_s.gsub(Imagekitio::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
|
|
262
|
+
end
|
|
263
|
+
|
|
250
264
|
# @api private
|
|
251
265
|
#
|
|
252
266
|
# @param path [String, Array<String>]
|
|
@@ -259,7 +273,7 @@ module Imagekitio
|
|
|
259
273
|
in []
|
|
260
274
|
""
|
|
261
275
|
in [String => p, *interpolations]
|
|
262
|
-
encoded = interpolations.map {
|
|
276
|
+
encoded = interpolations.map { encode_path(_1) }
|
|
263
277
|
format(p, *encoded)
|
|
264
278
|
end
|
|
265
279
|
end
|
|
@@ -485,11 +499,42 @@ module Imagekitio
|
|
|
485
499
|
end
|
|
486
500
|
|
|
487
501
|
# @type [Regexp]
|
|
488
|
-
JSON_CONTENT = %r{^application/(?:
|
|
502
|
+
JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
|
|
489
503
|
# @type [Regexp]
|
|
490
504
|
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
|
|
491
505
|
|
|
492
506
|
class << self
|
|
507
|
+
# @api private
|
|
508
|
+
#
|
|
509
|
+
# @param query [Hash{Symbol=>Object}]
|
|
510
|
+
#
|
|
511
|
+
# @return [Hash{Symbol=>Object}]
|
|
512
|
+
def encode_query_params(query)
|
|
513
|
+
out = {}
|
|
514
|
+
query.each { write_query_param_element!(out, _1, _2) }
|
|
515
|
+
out
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# @api private
|
|
519
|
+
#
|
|
520
|
+
# @param collection [Hash{Symbol=>Object}]
|
|
521
|
+
# @param key [String]
|
|
522
|
+
# @param element [Object]
|
|
523
|
+
#
|
|
524
|
+
# @return [nil]
|
|
525
|
+
private def write_query_param_element!(collection, key, element)
|
|
526
|
+
case element
|
|
527
|
+
in Hash
|
|
528
|
+
element.each do |name, value|
|
|
529
|
+
write_query_param_element!(collection, "#{key}[#{name}]", value)
|
|
530
|
+
end
|
|
531
|
+
in Array
|
|
532
|
+
collection[key] = element.map(&:to_s).join(",")
|
|
533
|
+
else
|
|
534
|
+
collection[key] = element.to_s
|
|
535
|
+
end
|
|
536
|
+
end
|
|
537
|
+
|
|
493
538
|
# @api private
|
|
494
539
|
#
|
|
495
540
|
# @param y [Enumerator::Yielder]
|
|
@@ -540,16 +585,15 @@ module Imagekitio
|
|
|
540
585
|
y << "Content-Disposition: form-data"
|
|
541
586
|
|
|
542
587
|
unless key.nil?
|
|
543
|
-
|
|
544
|
-
y << "; name=\"#{name}\""
|
|
588
|
+
y << "; name=\"#{key}\""
|
|
545
589
|
end
|
|
546
590
|
|
|
547
591
|
case val
|
|
548
592
|
in Imagekitio::FilePart unless val.filename.nil?
|
|
549
|
-
filename =
|
|
593
|
+
filename = encode_path(val.filename)
|
|
550
594
|
y << "; filename=\"#{filename}\""
|
|
551
595
|
in Pathname | IO
|
|
552
|
-
filename =
|
|
596
|
+
filename = encode_path(::File.basename(val.to_path))
|
|
553
597
|
y << "; filename=\"#{filename}\""
|
|
554
598
|
else
|
|
555
599
|
end
|
|
@@ -566,6 +610,7 @@ module Imagekitio
|
|
|
566
610
|
#
|
|
567
611
|
# @return [Array(String, Enumerable<String>)]
|
|
568
612
|
private def encode_multipart_streaming(body)
|
|
613
|
+
# rubocop:disable Style/CaseEquality
|
|
569
614
|
# RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
|
|
570
615
|
boundary = SecureRandom.urlsafe_base64(46)
|
|
571
616
|
|
|
@@ -575,7 +620,7 @@ module Imagekitio
|
|
|
575
620
|
in Hash
|
|
576
621
|
body.each do |key, val|
|
|
577
622
|
case val
|
|
578
|
-
in Array if val.all? { primitive?(_1) }
|
|
623
|
+
in Array if val.all? { primitive?(_1) || Imagekitio::Internal::Type::FileInput === _1 }
|
|
579
624
|
val.each do |v|
|
|
580
625
|
write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
|
|
581
626
|
end
|
|
@@ -591,6 +636,7 @@ module Imagekitio
|
|
|
591
636
|
|
|
592
637
|
fused_io = fused_enum(strio) { closing.each(&:call) }
|
|
593
638
|
[boundary, fused_io]
|
|
639
|
+
# rubocop:enable Style/CaseEquality
|
|
594
640
|
end
|
|
595
641
|
|
|
596
642
|
# @api private
|
|
@@ -8,15 +8,7 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!
|
|
12
|
-
# Schema for origin request resources.
|
|
13
|
-
#
|
|
14
|
-
# @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]
|
|
15
|
-
required :origin_request, union: -> { Imagekitio::Accounts::OriginRequest }
|
|
16
|
-
|
|
17
|
-
# @!method initialize(origin_request:, request_options: {})
|
|
18
|
-
# @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.
|
|
19
|
-
#
|
|
11
|
+
# @!method initialize(request_options: {})
|
|
20
12
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
21
13
|
end
|
|
22
14
|
end
|
|
@@ -8,7 +8,19 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!
|
|
11
|
+
# @!attribute id
|
|
12
|
+
# Unique identifier for the origin. This is generated by ImageKit when you create
|
|
13
|
+
# a new origin.
|
|
14
|
+
#
|
|
15
|
+
# @return [String]
|
|
16
|
+
required :id, String
|
|
17
|
+
|
|
18
|
+
# @!method initialize(id:, request_options: {})
|
|
19
|
+
# Some parameter documentations has been truncated, see
|
|
20
|
+
# {Imagekitio::Models::Accounts::OriginDeleteParams} for more details.
|
|
21
|
+
#
|
|
22
|
+
# @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create
|
|
23
|
+
#
|
|
12
24
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
13
25
|
end
|
|
14
26
|
end
|
|
@@ -8,7 +8,19 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!
|
|
11
|
+
# @!attribute id
|
|
12
|
+
# Unique identifier for the origin. This is generated by ImageKit when you create
|
|
13
|
+
# a new origin.
|
|
14
|
+
#
|
|
15
|
+
# @return [String]
|
|
16
|
+
required :id, String
|
|
17
|
+
|
|
18
|
+
# @!method initialize(id:, request_options: {})
|
|
19
|
+
# Some parameter documentations has been truncated, see
|
|
20
|
+
# {Imagekitio::Models::Accounts::OriginGetParams} for more details.
|
|
21
|
+
#
|
|
22
|
+
# @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create
|
|
23
|
+
#
|
|
12
24
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
13
25
|
end
|
|
14
26
|
end
|
|
@@ -8,14 +8,18 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!attribute
|
|
12
|
-
#
|
|
11
|
+
# @!attribute id
|
|
12
|
+
# Unique identifier for the origin. This is generated by ImageKit when you create
|
|
13
|
+
# a new origin.
|
|
13
14
|
#
|
|
14
|
-
# @return [
|
|
15
|
-
required :
|
|
15
|
+
# @return [String]
|
|
16
|
+
required :id, String
|
|
16
17
|
|
|
17
|
-
# @!method initialize(
|
|
18
|
-
#
|
|
18
|
+
# @!method initialize(id:, request_options: {})
|
|
19
|
+
# Some parameter documentations has been truncated, see
|
|
20
|
+
# {Imagekitio::Models::Accounts::OriginUpdateParams} for more details.
|
|
21
|
+
#
|
|
22
|
+
# @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create
|
|
19
23
|
#
|
|
20
24
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
21
25
|
end
|
|
@@ -8,7 +8,20 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!
|
|
11
|
+
# @!attribute id
|
|
12
|
+
# Unique identifier for the URL-endpoint. This is generated by ImageKit when you
|
|
13
|
+
# create a new URL-endpoint. For the default URL-endpoint, this is always
|
|
14
|
+
# `default`.
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :id, String
|
|
18
|
+
|
|
19
|
+
# @!method initialize(id:, request_options: {})
|
|
20
|
+
# Some parameter documentations has been truncated, see
|
|
21
|
+
# {Imagekitio::Models::Accounts::URLEndpointDeleteParams} for more details.
|
|
22
|
+
#
|
|
23
|
+
# @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c
|
|
24
|
+
#
|
|
12
25
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
13
26
|
end
|
|
14
27
|
end
|
|
@@ -8,7 +8,20 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!
|
|
11
|
+
# @!attribute id
|
|
12
|
+
# Unique identifier for the URL-endpoint. This is generated by ImageKit when you
|
|
13
|
+
# create a new URL-endpoint. For the default URL-endpoint, this is always
|
|
14
|
+
# `default`.
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :id, String
|
|
18
|
+
|
|
19
|
+
# @!method initialize(id:, request_options: {})
|
|
20
|
+
# Some parameter documentations has been truncated, see
|
|
21
|
+
# {Imagekitio::Models::Accounts::URLEndpointGetParams} for more details.
|
|
22
|
+
#
|
|
23
|
+
# @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c
|
|
24
|
+
#
|
|
12
25
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
13
26
|
end
|
|
14
27
|
end
|
|
@@ -8,7 +8,20 @@ module Imagekitio
|
|
|
8
8
|
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
9
|
include Imagekitio::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
|
-
# @!
|
|
11
|
+
# @!attribute id
|
|
12
|
+
# Unique identifier for the URL-endpoint. This is generated by ImageKit when you
|
|
13
|
+
# create a new URL-endpoint. For the default URL-endpoint, this is always
|
|
14
|
+
# `default`.
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :id, String
|
|
18
|
+
|
|
19
|
+
# @!method initialize(id:, request_options: {})
|
|
20
|
+
# Some parameter documentations has been truncated, see
|
|
21
|
+
# {Imagekitio::Models::Accounts::URLEndpointUpdateParams} for more details.
|
|
22
|
+
#
|
|
23
|
+
# @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c
|
|
24
|
+
#
|
|
12
25
|
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
13
26
|
end
|
|
14
27
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Models
|
|
5
|
+
class AITag < Imagekitio::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute confidence
|
|
7
|
+
# Confidence score of the tag.
|
|
8
|
+
#
|
|
9
|
+
# @return [Float, nil]
|
|
10
|
+
optional :confidence, Float
|
|
11
|
+
|
|
12
|
+
# @!attribute name
|
|
13
|
+
# Name of the tag.
|
|
14
|
+
#
|
|
15
|
+
# @return [String, nil]
|
|
16
|
+
optional :name, String
|
|
17
|
+
|
|
18
|
+
# @!attribute source
|
|
19
|
+
# Source of the tag. Possible values are `google-auto-tagging` and
|
|
20
|
+
# `aws-auto-tagging`.
|
|
21
|
+
#
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
optional :source, String
|
|
24
|
+
|
|
25
|
+
# @!method initialize(confidence: nil, name: nil, source: nil)
|
|
26
|
+
# Some parameter documentations has been truncated, see
|
|
27
|
+
# {Imagekitio::Models::AITag} for more details.
|
|
28
|
+
#
|
|
29
|
+
# AI-generated tag associated with an image. These tags can be added using the
|
|
30
|
+
# `google-auto-tagging` or `aws-auto-tagging` extensions.
|
|
31
|
+
#
|
|
32
|
+
# @param confidence [Float] Confidence score of the tag.
|
|
33
|
+
#
|
|
34
|
+
# @param name [String] Name of the tag.
|
|
35
|
+
#
|
|
36
|
+
# @param source [String] Source of the tag. Possible values are `google-auto-tagging` and `aws-auto-taggi
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|