@@ -7,7 +7,7 @@ class Helper
77 #
88 # @param transformations [Array<Imagekit::Models::Transformation>] Array of transformation objects
99 # @return [String] The built URL with transformations
10- def buildURL ( transformations )
10+ def build_url ( transformations )
1111 # TODO: Implement actual URL building logic
1212 # For now, return a fixed URL as requested
1313 "https://ik.imagekit.io/your_imagekit_id/sample-image.jpg?tr=w-400,h-300"
@@ -17,23 +17,31 @@ def buildURL(transformations)
1717 #
1818 # @param transformations [Array<Imagekit::Models::Transformation>] Array of transformation objects
1919 # @return [String] The transformation string (e.g., "w-400,h-300")
20- def buildTransformationString ( transformations )
20+ def build_transformation_string ( transformations )
2121 # TODO: Implement actual transformation string generation
2222 # For now, return a fixed transformation string
2323 "w-400,h-300"
2424 end
2525
26- # Gets authentication parameters for ImageKit requests
26+ # Generates authentication parameters for client-side file uploads using ImageKit's Upload API V1.
2727 #
28- # @param token [String, nil] Optional token for authentication
29- # @return [Hash] Authentication parameters
30- def GetAuthenticationParameters ( token = nil )
28+ # This method creates the required authentication signature that allows secure file uploads
29+ # directly from the browser or mobile applications without exposing your private API key.
30+ # The generated parameters include a unique token, expiration timestamp, and HMAC signature.
31+ #
32+ # @param token [String, nil] Custom token for the upload session. If not provided, a UUID v4 will be generated automatically.
33+ # @param expire [Integer, nil] Expiration time in seconds from now. If not provided, defaults to 1800 seconds (30 minutes).
34+ # @return [Hash] Authentication parameters object containing:
35+ # - token: Unique identifier for this upload session
36+ # - expire: Unix timestamp when these parameters expire
37+ # - signature: HMAC-SHA1 signature for authenticating the upload
38+ def get_authentication_parameters ( token = nil , expire = nil )
3139 # TODO: Implement actual authentication parameter generation
3240 # For now, return a fixed hash
3341 {
34- signature : "dummy_signature ",
35- expire : Time . now . to_i + 3600 ,
36- token : token || "dummy_token "
42+ token : token || "dummy_token ",
43+ expire : expire || ( Time . now . to_i + 1800 ) ,
44+ signature : "dummy_signature "
3745 }
3846 end
3947
0 commit comments