@@ -3288,7 +3288,7 @@ def browse_synonyms(
3288
3288
#
3289
3289
# @return [String]
3290
3290
#
3291
- def generate_secured_api_key ( parent_api_key , restrictions = { } )
3291
+ def self . generate_secured_api_key ( parent_api_key , restrictions = { } )
3292
3292
restrictions = restrictions . to_hash
3293
3293
if restrictions . key? ( :searchParams )
3294
3294
# merge searchParams with the root of the restrictions
@@ -3310,13 +3310,24 @@ def generate_secured_api_key(parent_api_key, restrictions = {})
3310
3310
Base64 . encode64 ( "#{ hmac } #{ url_encoded_restrictions } " ) . gsub ( "\n " , "" )
3311
3311
end
3312
3312
3313
+ # Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
3314
+ #
3315
+ # @param parent_api_key [String] Parent API key used the generate the secured key
3316
+ # @param restrictions [SecuredApiKeyRestrictions] Restrictions to apply on the secured key
3317
+ #
3318
+ # @return [String]
3319
+ #
3320
+ def generate_secured_api_key ( parent_api_key , restrictions = { } )
3321
+ self . class . generate_secured_api_key ( parent_api_key , restrictions )
3322
+ end
3323
+
3313
3324
# Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `validUntil` parameter must have been provided.
3314
3325
#
3315
3326
# @param secured_api_key [String]
3316
3327
#
3317
3328
# @return [Integer]
3318
3329
#
3319
- def get_secured_api_key_remaining_validity ( secured_api_key )
3330
+ def self . get_secured_api_key_remaining_validity ( secured_api_key )
3320
3331
now = Time . now . to_i
3321
3332
decoded_key = Base64 . decode64 ( secured_api_key )
3322
3333
regex = "validUntil=(\\ d+)"
@@ -3331,6 +3342,16 @@ def get_secured_api_key_remaining_validity(secured_api_key)
3331
3342
valid_until - now
3332
3343
end
3333
3344
3345
+ # Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `validUntil` parameter must have been provided.
3346
+ #
3347
+ # @param secured_api_key [String]
3348
+ #
3349
+ # @return [Integer]
3350
+ #
3351
+ def get_secured_api_key_remaining_validity ( secured_api_key )
3352
+ self . class . get_secured_api_key_remaining_validity ( secured_api_key )
3353
+ end
3354
+
3334
3355
# Helper: Saves the given array of objects in the given index. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
3335
3356
#
3336
3357
# @param index_name [String]: The `index_name` to save `objects` in.
0 commit comments