Skip to content

Commit 0e398a9

Browse files
committed
Refactor ImageKit helper modules and update signatures
- Updated the TransformationUtils and UuidUtils modules to remove the nested Helpers module, making them top-level modules. - Adjusted method signatures in the Helper class to reflect the new structure. - Corrected type signatures in RBI and RBS files to match the updated module structure. - Ensured consistent formatting and organization of transformation constants and methods.
1 parent ca62b83 commit 0e398a9

File tree

9 files changed

+770
-773
lines changed

9 files changed

+770
-773
lines changed

lib/imagekit/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Client < Imagekit::Internal::Transport::BaseClient
4949
# @return [Imagekit::Resources::Webhooks]
5050
attr_reader :webhooks
5151

52-
# @return [Imagekit::Helpers::Helper]
52+
# @return [Imagekit::Helper]
5353
attr_reader :helper
5454

5555
# @api private
@@ -123,7 +123,7 @@ def initialize(
123123
@accounts = Imagekit::Resources::Accounts.new(client: self)
124124
@beta = Imagekit::Resources::Beta.new(client: self)
125125
@webhooks = Imagekit::Resources::Webhooks.new(client: self)
126-
@helper = Imagekit::Helpers::Helper.new(client: self)
126+
@helper = Imagekit::Helper.new(client: self)
127127
end
128128
end
129129
end

lib/imagekit/helpers/crypto_utils.rb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44
require "digest"
55

66
module Imagekit
7-
module Helpers
8-
# Crypto utilities for ImageKit SDK
9-
# Provides HMAC-SHA1 functionality for URL signing and authentication
10-
module CryptoUtils
11-
class << self
12-
# Creates an HMAC-SHA1 hash
13-
#
14-
# @param key [String] The secret key for HMAC generation
15-
# @param data [String] The data to be signed
16-
# @return [String] Hex-encoded HMAC-SHA1 hash
17-
# @raise [StandardError] if HMAC generation fails
18-
def create_hmac_sha1(key, data)
19-
OpenSSL::HMAC.hexdigest("SHA1", key, data)
20-
rescue StandardError => e
21-
raise StandardError, "Failed to generate HMAC-SHA1 signature: #{e.message}"
22-
end
7+
# @api private
8+
# Crypto utilities for ImageKit SDK
9+
# Provides HMAC-SHA1 functionality for URL signing and authentication
10+
module CryptoUtils
11+
class << self
12+
# Creates an HMAC-SHA1 hash
13+
#
14+
# @param key [String] The secret key for HMAC generation
15+
# @param data [String] The data to be signed
16+
# @return [String] Hex-encoded HMAC-SHA1 hash
17+
# @raise [StandardError] if HMAC generation fails
18+
def create_hmac_sha1(key, data)
19+
OpenSSL::HMAC.hexdigest("SHA1", key, data)
20+
rescue StandardError => e
21+
raise StandardError, "Failed to generate HMAC-SHA1 signature: #{e.message}"
2322
end
2423
end
2524
end

0 commit comments

Comments
 (0)