algolia 2.2.0 → 2.2.3
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 +17 -1
 - data/SECURITY.md +1 -1
 - data/lib/algolia/config/personalization_config.rb +20 -0
 - data/lib/algolia/config/recommendation_config.rb +2 -15
 - data/lib/algolia/personalization_client.rb +60 -0
 - data/lib/algolia/recommendation_client.rb +2 -55
 - data/lib/algolia/responses/add_api_key_response.rb +1 -1
 - data/lib/algolia/responses/delete_api_key_response.rb +1 -1
 - data/lib/algolia/responses/restore_api_key_response.rb +1 -1
 - data/lib/algolia/responses/update_api_key_response.rb +1 -1
 - data/lib/algolia/search_client.rb +3 -0
 - data/lib/algolia/search_index.rb +1 -1
 - data/lib/algolia/version.rb +1 -1
 - data/lib/algolia.rb +2 -0
 - data/test/algolia/integration/account_client_test.rb +2 -2
 - data/test/algolia/integration/mocks/mock_requester.rb +1 -1
 - data/test/algolia/integration/personalization_client_test.rb +30 -0
 - data/test/algolia/integration/search_client_test.rb +1 -1
 - metadata +6 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c113b61e6f68cb0512af5184ec64500c3dfcce89cef1f72fa07c25c9276f5cb1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6474ee0b14ce28607a2a17bb2353fd7853128d48694f93d608b7faae728044b8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: efab3e1d53bb186dc091e69e00962223adb1f7c17567e0fbcd97609ed07fc6cb99ae6552e08852f19c3815bd1164fde3475fc74f2445b8c4909f4de5258ee405
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7c961f777ab5616edd3c59c0049ffd5b2b74126cd79697ebcdb4ffee42822866cab8fae0ab7a8922c434479fb032d9d865e83ba7b46543dd7a6b32a013d555ff
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,6 +1,22 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # ChangeLog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            ## [Unreleased](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2. 
     | 
| 
      
 3 
     | 
    
         
            +
            ## [Unreleased](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.3..master)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## [2.2.3](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.2...2.2.3) (2022-04-21)
         
     | 
| 
      
 6 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 7 
     | 
    
         
            +
            - API polling flood issue due to msec sleep time mishandling ([`#472`](https://github.com/algolia/algoliasearch-client-ruby/pull/472))
         
     | 
| 
      
 8 
     | 
    
         
            +
            - mailto link in SECURITY.md ([`#463`](https://github.com/algolia/algoliasearch-client-ruby/pull/463))
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 11 
     | 
    
         
            +
            - allow hash in multiple queries ([`#468`](https://github.com/algolia/algoliasearch-client-ruby/pull/468))
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## [2.2.2](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.1...2.2.2) (2021-12-08)
         
     | 
| 
      
 14 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 15 
     | 
    
         
            +
            - Added a `status` field to the `MockRequester` ([`#467`](https://github.com/algolia/algoliasearch-client-ruby/pull/467))
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ## [2.2.1](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.0...2.2.1) (2021-11-12)
         
     | 
| 
      
 18 
     | 
    
         
            +
            ### Chore
         
     | 
| 
      
 19 
     | 
    
         
            +
            - Deprecated `RecommendationClient` in favor of `PersonalizationClient` ([`#461`](https://github.com/algolia/algoliasearch-client-ruby/pull/461))
         
     | 
| 
       4 
20 
     | 
    
         | 
| 
       5 
21 
     | 
    
         
             
            ## [2.2.0](https://github.com/algolia/algoliasearch-client-ruby/compare/2.1.1...2.2.0) (2021-11-08)
         
     | 
| 
       6 
22 
     | 
    
         
             
            ### Added
         
     | 
    
        data/SECURITY.md
    CHANGED
    
    | 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ## Reporting a Vulnerability
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            To report a security vulnerability, please use the [Algolia security email](security@algolia.com). Algolia will coordinate the fix and disclosure.
         
     | 
| 
      
 3 
     | 
    
         
            +
            To report a security vulnerability, please use the [Algolia security email](mailto:security@algolia.com). Algolia will coordinate the fix and disclosure.
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Algolia
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Personalization
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Config < BaseConfig
         
     | 
| 
      
 4 
     | 
    
         
            +
                  attr_accessor :region, :default_hosts
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  # Initialize a config
         
     | 
| 
      
 7 
     | 
    
         
            +
                  #
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # @option options [String] :application_id
         
     | 
| 
      
 9 
     | 
    
         
            +
                  # @option options [String] :api_key
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # @option options [String] :region
         
     | 
| 
      
 11 
     | 
    
         
            +
                  #
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def initialize(opts = {})
         
     | 
| 
      
 13 
     | 
    
         
            +
                    super(opts)
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    @region        = opts[:region] || 'us'
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @default_hosts = [Transport::StatefulHost.new("personalization.#{region}.algolia.com")]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,20 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Algolia
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Recommendation
         
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
                  # Initialize a config
         
     | 
| 
       7 
     | 
    
         
            -
                  #
         
     | 
| 
       8 
     | 
    
         
            -
                  # @option options [String] :application_id
         
     | 
| 
       9 
     | 
    
         
            -
                  # @option options [String] :api_key
         
     | 
| 
       10 
     | 
    
         
            -
                  # @option options [String] :region
         
     | 
| 
       11 
     | 
    
         
            -
                  #
         
     | 
| 
       12 
     | 
    
         
            -
                  def initialize(opts = {})
         
     | 
| 
       13 
     | 
    
         
            -
                    super(opts)
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                    @region        = opts[:region] || 'us'
         
     | 
| 
       16 
     | 
    
         
            -
                    @default_hosts = [Transport::StatefulHost.new("recommendation.#{region}.algolia.com")]
         
     | 
| 
       17 
     | 
    
         
            -
                  end
         
     | 
| 
      
 3 
     | 
    
         
            +
                # <b>DEPRECATED:</b> Please use <tt>Algolia::Personalization::Config</tt> instead.
         
     | 
| 
      
 4 
     | 
    
         
            +
                class Config < Algolia::Personalization::Config
         
     | 
| 
       18 
5 
     | 
    
         
             
                end
         
     | 
| 
       19 
6 
     | 
    
         
             
              end
         
     | 
| 
       20 
7 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,60 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Algolia
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Personalization
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Client
         
     | 
| 
      
 4 
     | 
    
         
            +
                  # Initializes the Personalization client
         
     | 
| 
      
 5 
     | 
    
         
            +
                  #
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # @param personalization_config [Personalization::Config] a Personalization::Config object which contains your APP_ID and API_KEY
         
     | 
| 
      
 7 
     | 
    
         
            +
                  # @option adapter [Object] adapter object used for the connection
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # @option logger [Object]
         
     | 
| 
      
 9 
     | 
    
         
            +
                  # @option http_requester [Object] http_requester object used for the connection
         
     | 
| 
      
 10 
     | 
    
         
            +
                  #
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize(personalization_config, opts = {})
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @config      = personalization_config
         
     | 
| 
      
 13 
     | 
    
         
            +
                    adapter      = opts[:adapter] || Defaults::ADAPTER
         
     | 
| 
      
 14 
     | 
    
         
            +
                    logger       = opts[:logger] || LoggerHelper.create('debug.log')
         
     | 
| 
      
 15 
     | 
    
         
            +
                    requester    = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @transporter = Transport::Transport.new(@config, requester)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  # Create a new client providing only app ID and API key
         
     | 
| 
      
 20 
     | 
    
         
            +
                  #
         
     | 
| 
      
 21 
     | 
    
         
            +
                  # @param app_id [String] Algolia application ID
         
     | 
| 
      
 22 
     | 
    
         
            +
                  # @param api_key [String] Algolia API key
         
     | 
| 
      
 23 
     | 
    
         
            +
                  #
         
     | 
| 
      
 24 
     | 
    
         
            +
                  # @return self
         
     | 
| 
      
 25 
     | 
    
         
            +
                  #
         
     | 
| 
      
 26 
     | 
    
         
            +
                  def self.create(app_id, api_key)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    config = Personalization::Config.new(application_id: app_id, api_key: api_key)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    create_with_config(config)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  # Create a new client providing only an Personalization::Config object
         
     | 
| 
      
 32 
     | 
    
         
            +
                  #
         
     | 
| 
      
 33 
     | 
    
         
            +
                  # @param config [Personalization::Config]
         
     | 
| 
      
 34 
     | 
    
         
            +
                  #
         
     | 
| 
      
 35 
     | 
    
         
            +
                  # @return self
         
     | 
| 
      
 36 
     | 
    
         
            +
                  #
         
     | 
| 
      
 37 
     | 
    
         
            +
                  def self.create_with_config(config)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    new(config)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  # Set the personalization strategy.
         
     | 
| 
      
 42 
     | 
    
         
            +
                  #
         
     | 
| 
      
 43 
     | 
    
         
            +
                  # @param personalization_strategy [Hash] A strategy object.
         
     | 
| 
      
 44 
     | 
    
         
            +
                  #
         
     | 
| 
      
 45 
     | 
    
         
            +
                  # @return [Hash]
         
     | 
| 
      
 46 
     | 
    
         
            +
                  #
         
     | 
| 
      
 47 
     | 
    
         
            +
                  def set_personalization_strategy(personalization_strategy, opts = {})
         
     | 
| 
      
 48 
     | 
    
         
            +
                    @transporter.write(:POST, '1/strategies/personalization', personalization_strategy, opts)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  # Get the personalization strategy.
         
     | 
| 
      
 52 
     | 
    
         
            +
                  #
         
     | 
| 
      
 53 
     | 
    
         
            +
                  # @return [Hash]
         
     | 
| 
      
 54 
     | 
    
         
            +
                  #
         
     | 
| 
      
 55 
     | 
    
         
            +
                  def get_personalization_strategy(opts = {})
         
     | 
| 
      
 56 
     | 
    
         
            +
                    @transporter.read(:GET, '1/strategies/personalization', {}, opts)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,60 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Algolia
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Recommendation
         
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                  #
         
     | 
| 
       6 
     | 
    
         
            -
                  # @param recommendation_config [Recommendation::Config] a Recommendation::Config object which contains your APP_ID and API_KEY
         
     | 
| 
       7 
     | 
    
         
            -
                  # @option adapter [Object] adapter object used for the connection
         
     | 
| 
       8 
     | 
    
         
            -
                  # @option logger [Object]
         
     | 
| 
       9 
     | 
    
         
            -
                  # @option http_requester [Object] http_requester object used for the connection
         
     | 
| 
       10 
     | 
    
         
            -
                  #
         
     | 
| 
       11 
     | 
    
         
            -
                  def initialize(recommendation_config, opts = {})
         
     | 
| 
       12 
     | 
    
         
            -
                    @config      = recommendation_config
         
     | 
| 
       13 
     | 
    
         
            -
                    adapter      = opts[:adapter] || Defaults::ADAPTER
         
     | 
| 
       14 
     | 
    
         
            -
                    logger       = opts[:logger] || LoggerHelper.create('debug.log')
         
     | 
| 
       15 
     | 
    
         
            -
                    requester    = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
         
     | 
| 
       16 
     | 
    
         
            -
                    @transporter = Transport::Transport.new(@config, requester)
         
     | 
| 
       17 
     | 
    
         
            -
                  end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                  # Create a new client providing only app ID and API key
         
     | 
| 
       20 
     | 
    
         
            -
                  #
         
     | 
| 
       21 
     | 
    
         
            -
                  # @param app_id [String] Algolia application ID
         
     | 
| 
       22 
     | 
    
         
            -
                  # @param api_key [String] Algolia API key
         
     | 
| 
       23 
     | 
    
         
            -
                  #
         
     | 
| 
       24 
     | 
    
         
            -
                  # @return self
         
     | 
| 
       25 
     | 
    
         
            -
                  #
         
     | 
| 
       26 
     | 
    
         
            -
                  def self.create(app_id, api_key)
         
     | 
| 
       27 
     | 
    
         
            -
                    config = Recommendation::Config.new(application_id: app_id, api_key: api_key)
         
     | 
| 
       28 
     | 
    
         
            -
                    create_with_config(config)
         
     | 
| 
       29 
     | 
    
         
            -
                  end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                  # Create a new client providing only an Recommendation::Config object
         
     | 
| 
       32 
     | 
    
         
            -
                  #
         
     | 
| 
       33 
     | 
    
         
            -
                  # @param config [Recommendation::Config]
         
     | 
| 
       34 
     | 
    
         
            -
                  #
         
     | 
| 
       35 
     | 
    
         
            -
                  # @return self
         
     | 
| 
       36 
     | 
    
         
            -
                  #
         
     | 
| 
       37 
     | 
    
         
            -
                  def self.create_with_config(config)
         
     | 
| 
       38 
     | 
    
         
            -
                    new(config)
         
     | 
| 
       39 
     | 
    
         
            -
                  end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                  # Set the personalization strategy.
         
     | 
| 
       42 
     | 
    
         
            -
                  #
         
     | 
| 
       43 
     | 
    
         
            -
                  # @param personalization_strategy [Hash] A strategy object.
         
     | 
| 
       44 
     | 
    
         
            -
                  #
         
     | 
| 
       45 
     | 
    
         
            -
                  # @return [Hash]
         
     | 
| 
       46 
     | 
    
         
            -
                  #
         
     | 
| 
       47 
     | 
    
         
            -
                  def set_personalization_strategy(personalization_strategy, opts = {})
         
     | 
| 
       48 
     | 
    
         
            -
                    @transporter.write(:POST, '1/strategies/personalization', personalization_strategy, opts)
         
     | 
| 
       49 
     | 
    
         
            -
                  end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                  # Get the personalization strategy.
         
     | 
| 
       52 
     | 
    
         
            -
                  #
         
     | 
| 
       53 
     | 
    
         
            -
                  # @return [Hash]
         
     | 
| 
       54 
     | 
    
         
            -
                  #
         
     | 
| 
       55 
     | 
    
         
            -
                  def get_personalization_strategy(opts = {})
         
     | 
| 
       56 
     | 
    
         
            -
                    @transporter.read(:GET, '1/strategies/personalization', {}, opts)
         
     | 
| 
       57 
     | 
    
         
            -
                  end
         
     | 
| 
      
 3 
     | 
    
         
            +
                # <b>DEPRECATED:</b> Please use <tt>Algolia::Personalization::Client</tt> instead.
         
     | 
| 
      
 4 
     | 
    
         
            +
                class Client < Algolia::Personalization::Client
         
     | 
| 
       58 
5 
     | 
    
         
             
                end
         
     | 
| 
       59 
6 
     | 
    
         
             
              end
         
     | 
| 
       60 
7 
     | 
    
         
             
            end
         
     | 
| 
         @@ -478,6 +478,9 @@ module Algolia 
     | 
|
| 
       478 
478 
     | 
    
         
             
                  # @return [Hash]
         
     | 
| 
       479 
479 
     | 
    
         
             
                  #
         
     | 
| 
       480 
480 
     | 
    
         
             
                  def multiple_queries(queries, opts = {})
         
     | 
| 
      
 481 
     | 
    
         
            +
                    queries.each do |q|
         
     | 
| 
      
 482 
     | 
    
         
            +
                      q[:params] = to_query_string(q[:params]) unless q[:params].is_a?(String)
         
     | 
| 
      
 483 
     | 
    
         
            +
                    end
         
     | 
| 
       481 
484 
     | 
    
         
             
                    @transporter.read(:POST, '/1/indexes/*/queries', { requests: queries }, opts)
         
     | 
| 
       482 
485 
     | 
    
         
             
                  end
         
     | 
| 
       483 
486 
     | 
    
         
             
                  alias_method :search, :multiple_queries
         
     | 
    
        data/lib/algolia/search_index.rb
    CHANGED
    
    
    
        data/lib/algolia/version.rb
    CHANGED
    
    
    
        data/lib/algolia.rb
    CHANGED
    
    | 
         @@ -8,6 +8,7 @@ require 'algolia/config/search_config' 
     | 
|
| 
       8 
8 
     | 
    
         
             
            require 'algolia/config/analytics_config'
         
     | 
| 
       9 
9 
     | 
    
         
             
            require 'algolia/config/insights_config'
         
     | 
| 
       10 
10 
     | 
    
         
             
            require 'algolia/config/recommend_config'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'algolia/config/personalization_config'
         
     | 
| 
       11 
12 
     | 
    
         
             
            require 'algolia/config/recommendation_config'
         
     | 
| 
       12 
13 
     | 
    
         
             
            require 'algolia/enums/call_type'
         
     | 
| 
       13 
14 
     | 
    
         
             
            require 'algolia/enums/retry_outcome_type'
         
     | 
| 
         @@ -35,6 +36,7 @@ require 'algolia/search_client' 
     | 
|
| 
       35 
36 
     | 
    
         
             
            require 'algolia/analytics_client'
         
     | 
| 
       36 
37 
     | 
    
         
             
            require 'algolia/insights_client'
         
     | 
| 
       37 
38 
     | 
    
         
             
            require 'algolia/recommend_client'
         
     | 
| 
      
 39 
     | 
    
         
            +
            require 'algolia/personalization_client'
         
     | 
| 
       38 
40 
     | 
    
         
             
            require 'algolia/recommendation_client'
         
     | 
| 
       39 
41 
     | 
    
         
             
            require 'algolia/error'
         
     | 
| 
       40 
42 
     | 
    
         
             
            require 'algolia/search_index'
         
     | 
| 
         @@ -14,7 +14,7 @@ class AccountClientTest < BaseTest 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                  search_client2 = Algolia::Search::Client.create(APPLICATION_ID_2, ADMIN_KEY_2)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  index2         = search_client2.init_index(get_test_index_name('copy_index2'))
         
     | 
| 
       17 
     | 
    
         
            -
                  index1.save_object!({ objectID: 'one' })
         
     | 
| 
      
 17 
     | 
    
         
            +
                  index1.save_object!({ objectID: 'one', title: 'Test title' })
         
     | 
| 
       18 
18 
     | 
    
         
             
                  index1.save_rule!({
         
     | 
| 
       19 
19 
     | 
    
         
             
                    objectID: 'one',
         
     | 
| 
       20 
20 
     | 
    
         
             
                    condition: { anchoring: 'is', pattern: 'pattern' },
         
     | 
| 
         @@ -29,7 +29,7 @@ class AccountClientTest < BaseTest 
     | 
|
| 
       29 
29 
     | 
    
         
             
                    }
         
     | 
| 
       30 
30 
     | 
    
         
             
                  })
         
     | 
| 
       31 
31 
     | 
    
         
             
                  index1.save_synonym!({ objectID: 'one', type: 'synonym', synonyms: %w(one two) })
         
     | 
| 
       32 
     | 
    
         
            -
                  index1.set_settings!({ searchableAttributes: [' 
     | 
| 
      
 32 
     | 
    
         
            +
                  index1.set_settings!({ searchableAttributes: ['title'] })
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                  Algolia::Account::Client.copy_index!(index1, index2)
         
     | 
| 
       35 
35 
     | 
    
         
             
                  assert_equal 'one', index2.get_object('one')[:objectID]
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'base_test'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'date'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class PersonalizationClientTest < BaseTest
         
     | 
| 
      
 5 
     | 
    
         
            +
              describe 'Personalization client' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                def test_personalization_client
         
     | 
| 
      
 7 
     | 
    
         
            +
                  client                   = Algolia::Personalization::Client.create(APPLICATION_ID_1, ADMIN_KEY_1)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  personalization_strategy = {
         
     | 
| 
      
 9 
     | 
    
         
            +
                    eventsScoring: [
         
     | 
| 
      
 10 
     | 
    
         
            +
                      { eventName: 'Add to cart', eventType: 'conversion', score: 50 },
         
     | 
| 
      
 11 
     | 
    
         
            +
                      { eventName: 'Purchase', eventType: 'conversion', score: 100 }
         
     | 
| 
      
 12 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 13 
     | 
    
         
            +
                    facetsScoring: [
         
     | 
| 
      
 14 
     | 
    
         
            +
                      { facetName: 'brand', score: 100 },
         
     | 
| 
      
 15 
     | 
    
         
            +
                      { facetName: 'categories', score: 10 }
         
     | 
| 
      
 16 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 17 
     | 
    
         
            +
                    personalizationImpact: 0
         
     | 
| 
      
 18 
     | 
    
         
            +
                  }
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 21 
     | 
    
         
            +
                    client.set_personalization_strategy(personalization_strategy)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  rescue Algolia::AlgoliaHttpError => e
         
     | 
| 
      
 23 
     | 
    
         
            +
                    raise e unless e.code == 429
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  response = client.get_personalization_strategy
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  assert_equal response, personalization_strategy
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -294,7 +294,7 @@ class SearchClientTest < BaseTest 
     | 
|
| 
       294 
294 
     | 
    
         | 
| 
       295 
295 
     | 
    
         
             
                  results = @@search_client.multiple_queries([
         
     | 
| 
       296 
296 
     | 
    
         
             
                    { indexName: index_name1, params: to_query_string({ query: '', hitsPerPage: 2 }) },
         
     | 
| 
       297 
     | 
    
         
            -
                    { indexName: index_name2, params:  
     | 
| 
      
 297 
     | 
    
         
            +
                    { indexName: index_name2, params: { query: '', hitsPerPage: 2 } }
         
     | 
| 
       298 
298 
     | 
    
         
             
                  ], { strategy: 'none' })[:results]
         
     | 
| 
       299 
299 
     | 
    
         | 
| 
       300 
300 
     | 
    
         
             
                  assert_equal 2, results.length
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: algolia
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.2.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Algolia
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -218,6 +218,7 @@ files: 
     | 
|
| 
       218 
218 
     | 
    
         
             
            - lib/algolia/config/analytics_config.rb
         
     | 
| 
       219 
219 
     | 
    
         
             
            - lib/algolia/config/base_config.rb
         
     | 
| 
       220 
220 
     | 
    
         
             
            - lib/algolia/config/insights_config.rb
         
     | 
| 
      
 221 
     | 
    
         
            +
            - lib/algolia/config/personalization_config.rb
         
     | 
| 
       221 
222 
     | 
    
         
             
            - lib/algolia/config/recommend_config.rb
         
     | 
| 
       222 
223 
     | 
    
         
             
            - lib/algolia/config/recommendation_config.rb
         
     | 
| 
       223 
224 
     | 
    
         
             
            - lib/algolia/config/search_config.rb
         
     | 
| 
         @@ -235,6 +236,7 @@ files: 
     | 
|
| 
       235 
236 
     | 
    
         
             
            - lib/algolia/iterators/rule_iterator.rb
         
     | 
| 
       236 
237 
     | 
    
         
             
            - lib/algolia/iterators/synonym_iterator.rb
         
     | 
| 
       237 
238 
     | 
    
         
             
            - lib/algolia/logger_helper.rb
         
     | 
| 
      
 239 
     | 
    
         
            +
            - lib/algolia/personalization_client.rb
         
     | 
| 
       238 
240 
     | 
    
         
             
            - lib/algolia/recommend_client.rb
         
     | 
| 
       239 
241 
     | 
    
         
             
            - lib/algolia/recommendation_client.rb
         
     | 
| 
       240 
242 
     | 
    
         
             
            - lib/algolia/responses/add_api_key_response.rb
         
     | 
| 
         @@ -276,6 +278,7 @@ files: 
     | 
|
| 
       276 
278 
     | 
    
         
             
            - test/algolia/integration/base_test.rb
         
     | 
| 
       277 
279 
     | 
    
         
             
            - test/algolia/integration/insights_client_test.rb
         
     | 
| 
       278 
280 
     | 
    
         
             
            - test/algolia/integration/mocks/mock_requester.rb
         
     | 
| 
      
 281 
     | 
    
         
            +
            - test/algolia/integration/personalization_client_test.rb
         
     | 
| 
       279 
282 
     | 
    
         
             
            - test/algolia/integration/recommend_client_test.rb
         
     | 
| 
       280 
283 
     | 
    
         
             
            - test/algolia/integration/recommendation_client_test.rb
         
     | 
| 
       281 
284 
     | 
    
         
             
            - test/algolia/integration/search_client_test.rb
         
     | 
| 
         @@ -318,6 +321,7 @@ test_files: 
     | 
|
| 
       318 
321 
     | 
    
         
             
            - test/algolia/integration/base_test.rb
         
     | 
| 
       319 
322 
     | 
    
         
             
            - test/algolia/integration/insights_client_test.rb
         
     | 
| 
       320 
323 
     | 
    
         
             
            - test/algolia/integration/mocks/mock_requester.rb
         
     | 
| 
      
 324 
     | 
    
         
            +
            - test/algolia/integration/personalization_client_test.rb
         
     | 
| 
       321 
325 
     | 
    
         
             
            - test/algolia/integration/recommend_client_test.rb
         
     | 
| 
       322 
326 
     | 
    
         
             
            - test/algolia/integration/recommendation_client_test.rb
         
     | 
| 
       323 
327 
     | 
    
         
             
            - test/algolia/integration/search_client_test.rb
         
     |