lib/algolia/client.rb in algoliasearch-1.1.5 vs lib/algolia/client.rb in algoliasearch-1.1.6

- old
+ new

@@ -173,12 +173,14 @@ # - deleteObject : allows to delete an existing object (https only) # - deleteIndex : allows to delete index content (https only) # - settings : allows to get index settings (https only) # - editSettings : allows to change index settings (https only) # @param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key) + # @param maxQueriesPerIPPerHour the maximum number of API calls allowed from an IP address per hour (0 means unlimited) + # @param maxHitsPerQuery the maximum number of hits this API key can retrieve in one call (0 means unlimited) # - def Algolia.add_user_key(acls, validity = 0) - Algolia.client.post(Protocol.keys_uri, {"acl" => acls, "validity" => validity}.to_json) + def Algolia.add_user_key(acls, validity = 0, maxQueriesPerIPPerHour = 0, maxHitsPerQuery = 0) + Algolia.client.post(Protocol.keys_uri, {"acl" => acls, "validity" => validity.to_i, "maxQueriesPerIPPerHour" => maxQueriesPerIPPerHour.to_i, "maxHitsPerQuery" => maxHitsPerQuery.to_i}.to_json) end # Delete an existing user key def Algolia.delete_user_key(key) Algolia.client.delete(Protocol.key_uri(key))