recombee_api_client 3.0.0 → 4.0.0
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 +5 -5
 - data/README.md +10 -5
 - data/lib/recombee_api_client/api/add_search_synonym.rb +72 -0
 - data/lib/recombee_api_client/api/delete_all_search_synonyms.rb +47 -0
 - data/lib/recombee_api_client/api/delete_item.rb +1 -1
 - data/lib/recombee_api_client/api/delete_more_items.rb +52 -0
 - data/lib/recombee_api_client/api/delete_search_synonym.rb +50 -0
 - data/lib/recombee_api_client/api/delete_user.rb +1 -1
 - data/lib/recombee_api_client/api/list_search_synonyms.rb +59 -0
 - data/lib/recombee_api_client/api/recommend_items_to_item.rb +12 -5
 - data/lib/recombee_api_client/api/recommend_items_to_user.rb +13 -6
 - data/lib/recombee_api_client/api/recommend_next_items.rb +69 -0
 - data/lib/recombee_api_client/api/recommend_users_to_item.rb +4 -2
 - data/lib/recombee_api_client/api/recommend_users_to_user.rb +5 -3
 - data/lib/recombee_api_client/api/search_items.rb +11 -4
 - data/lib/recombee_api_client/api/update_more_items.rb +63 -0
 - data/lib/recombee_api_client/version.rb +1 -1
 - data/lib/recombee_api_client.rb +40 -15
 - data/recombee_api_client.gemspec +2 -2
 - metadata +14 -10
 - data/lib/recombee_api_client/api/item_based_recommendation.rb +0 -159
 - data/lib/recombee_api_client/api/user_based_recommendation.rb +0 -143
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ddc59d0fe517546ea3c3e201f4ba31fdab38fee38ef7ab2780a226744d94ed8a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2afe45ef3d9540eb9a1c112152b33a2559d8be9dd49bc613904020ee648e300a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4550dea796a247b45f3e80c840b876dec5065835f9127ad5f991440256e512dbd40c9d1c95675c7d3d4fe8700d5851201c278193ed561d2d28414b660b111d30
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: efa14da6a11f0fa00490e38cf22f0e9bdf741e7a331ef69a9b609ef683c28b2f7c07afb70548d07077e8b366ca968f2592290249591b28f1d8f0320136b54f49
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -29,7 +29,7 @@ Or install it yourself as: 
     | 
|
| 
       29 
29 
     | 
    
         
             
            require 'recombee_api_client'
         
     | 
| 
       30 
30 
     | 
    
         
             
            include RecombeeApiClient
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
            client = RecombeeClient('--my-database-id--', '--db-private-token--')
         
     | 
| 
      
 32 
     | 
    
         
            +
            client = RecombeeClient('--my-database-id--', '--db-private-token--', {:region => 'us-west'})
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
            # Generate some random purchases of items by users
         
     | 
| 
       35 
35 
     | 
    
         
             
            NUM = 100
         
     | 
| 
         @@ -55,8 +55,13 @@ begin 
     | 
|
| 
       55 
55 
     | 
    
         
             
              client.send(Batch.new(purchases))
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
              # Get recommendations for user 'user-25'
         
     | 
| 
       58 
     | 
    
         
            -
               
     | 
| 
       59 
     | 
    
         
            -
              puts "Recommended items for user-25: #{ 
     | 
| 
      
 58 
     | 
    
         
            +
              response = client.send(RecommendItemsToUser.new('user-25', 5))
         
     | 
| 
      
 59 
     | 
    
         
            +
              puts "Recommended items for user-25: #{response}"
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              # User scrolled down - get next 3 recommended items
         
     | 
| 
      
 62 
     | 
    
         
            +
              response = client.send(RecommendNextItems.new(response['recommId'], 3))
         
     | 
| 
      
 63 
     | 
    
         
            +
              puts "Next recommended items for user-25: #{response}"
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
       60 
65 
     | 
    
         
             
            rescue APIError => e
         
     | 
| 
       61 
66 
     | 
    
         
             
              puts e
         
     | 
| 
       62 
67 
     | 
    
         
             
              # Use fallback
         
     | 
| 
         @@ -71,7 +76,7 @@ include RecombeeApiClient 
     | 
|
| 
       71 
76 
     | 
    
         
             
            NUM = 100
         
     | 
| 
       72 
77 
     | 
    
         
             
            PROBABILITY_PURCHASED = 0.1
         
     | 
| 
       73 
78 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
            client = RecombeeClient('--my-database-id--', '--db-private-token--')
         
     | 
| 
      
 79 
     | 
    
         
            +
            client = RecombeeClient('--my-database-id--', '--db-private-token--', {:region => 'ap-se'})
         
     | 
| 
       75 
80 
     | 
    
         
             
            client.send(ResetDatabase.new) # Clear everything from the database (asynchronous)
         
     | 
| 
       76 
81 
     | 
    
         | 
| 
       77 
82 
     | 
    
         
             
            # We will use computers as items in this example
         
     | 
| 
         @@ -146,7 +151,7 @@ recommended = client.send( 
     | 
|
| 
       146 
151 
     | 
    
         | 
| 
       147 
152 
     | 
    
         
             
            # Perform personalized full-text search with a user's search query (e.g. 'computers').
         
     | 
| 
       148 
153 
     | 
    
         
             
            matches = client.send(
         
     | 
| 
       149 
     | 
    
         
            -
              SearchItems.new('user-42', 'computers', 5)
         
     | 
| 
      
 154 
     | 
    
         
            +
              SearchItems.new('user-42', 'computers', 5, {:scenario => 'search_top'})
         
     | 
| 
       150 
155 
     | 
    
         
             
              )
         
     | 
| 
       151 
156 
     | 
    
         
             
            puts "Matched items: #{matches}"
         
     | 
| 
       152 
157 
     | 
    
         
             
            ```
         
     | 
| 
         @@ -0,0 +1,72 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Adds a new synonym for the [Search items](https://docs.recombee.com/api.html#search-items).
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              #When the `term` is used in the search query, the `synonym` is also used for the full-text search.
         
     | 
| 
      
 13 
     | 
    
         
            +
              #Unless `oneWay=true`, it works also in the opposite way (`synonym` -> `term`).
         
     | 
| 
      
 14 
     | 
    
         
            +
              #
         
     | 
| 
      
 15 
     | 
    
         
            +
              #An example of a synonym can be `science fiction` for the term `sci-fi`.
         
     | 
| 
      
 16 
     | 
    
         
            +
              #
         
     | 
| 
      
 17 
     | 
    
         
            +
              class AddSearchSynonym < ApiRequest
         
     | 
| 
      
 18 
     | 
    
         
            +
                attr_reader :term, :synonym, :one_way
         
     | 
| 
      
 19 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 20 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 21 
     | 
    
         
            +
              
         
     | 
| 
      
 22 
     | 
    
         
            +
              ##
         
     | 
| 
      
 23 
     | 
    
         
            +
              # * *Required arguments*
         
     | 
| 
      
 24 
     | 
    
         
            +
              #   - +term+ -> A word to which the `synonym` is specified.
         
     | 
| 
      
 25 
     | 
    
         
            +
              #   - +synonym+ -> A word that should be considered equal to the `term` by the full-text search engine.
         
     | 
| 
      
 26 
     | 
    
         
            +
              #
         
     | 
| 
      
 27 
     | 
    
         
            +
              # * *Optional arguments (given as hash optional)*
         
     | 
| 
      
 28 
     | 
    
         
            +
              #   - +oneWay+ -> If set to `true`, only `term` -> `synonym` is considered. If set to `false`, also `synonym` -> `term` works.
         
     | 
| 
      
 29 
     | 
    
         
            +
              #
         
     | 
| 
      
 30 
     | 
    
         
            +
              #Default: `false`.
         
     | 
| 
      
 31 
     | 
    
         
            +
              #
         
     | 
| 
      
 32 
     | 
    
         
            +
              #
         
     | 
| 
      
 33 
     | 
    
         
            +
                def initialize(term, synonym, optional = {})
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @term = term
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @synonym = synonym
         
     | 
| 
      
 36 
     | 
    
         
            +
                  optional = normalize_optional(optional)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @one_way = optional['oneWay']
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @optional = optional
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @timeout = 10000
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @optional.each do |par, _|
         
     | 
| 
      
 42 
     | 
    
         
            +
                    fail UnknownOptionalParameter.new(par) unless ["oneWay"].include? par
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              
         
     | 
| 
      
 46 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 47 
     | 
    
         
            +
                def method
         
     | 
| 
      
 48 
     | 
    
         
            +
                  :post
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              
         
     | 
| 
      
 51 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 52 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 53 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 54 
     | 
    
         
            +
                  p['term'] = @term
         
     | 
| 
      
 55 
     | 
    
         
            +
                  p['synonym'] = @synonym
         
     | 
| 
      
 56 
     | 
    
         
            +
                  p['oneWay'] = @optional['oneWay'] if @optional.include? 'oneWay'
         
     | 
| 
      
 57 
     | 
    
         
            +
                  p
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
              
         
     | 
| 
      
 60 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 61 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 62 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 63 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 64 
     | 
    
         
            +
                  params
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
              
         
     | 
| 
      
 67 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 68 
     | 
    
         
            +
                def path
         
     | 
| 
      
 69 
     | 
    
         
            +
                  "/{databaseId}/synonyms/items/"
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Deletes all synonyms defined in the database.
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              class DeleteAllSearchSynonyms < ApiRequest
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 15 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              ##
         
     | 
| 
      
 18 
     | 
    
         
            +
              #
         
     | 
| 
      
 19 
     | 
    
         
            +
                def initialize()
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @timeout = 10000
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              
         
     | 
| 
      
 24 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 25 
     | 
    
         
            +
                def method
         
     | 
| 
      
 26 
     | 
    
         
            +
                  :delete
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
              
         
     | 
| 
      
 29 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 30 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 31 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 32 
     | 
    
         
            +
                  p
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              
         
     | 
| 
      
 35 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 36 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 37 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 38 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 39 
     | 
    
         
            +
                  params
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
              
         
     | 
| 
      
 42 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 43 
     | 
    
         
            +
                def path
         
     | 
| 
      
 44 
     | 
    
         
            +
                  "/{databaseId}/synonyms/items/"
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -11,7 +11,7 @@ module RecombeeApiClient 
     | 
|
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
12 
     | 
    
         
             
              #If there are any *purchases*, *ratings*, *bookmarks*, *cart additions* or *detail views* of the item present in the database, they will be deleted in cascade as well. Also, if the item is present in some *series*, it will be removed from all the *series* where present.
         
     | 
| 
       13 
13 
     | 
    
         
             
              #
         
     | 
| 
       14 
     | 
    
         
            -
              #If an item becomes obsolete/no longer available, it is  
     | 
| 
      
 14 
     | 
    
         
            +
              #If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql.html) instead of deleting the item completely.
         
     | 
| 
       15 
15 
     | 
    
         
             
              #
         
     | 
| 
       16 
16 
     | 
    
         
             
              class DeleteItem < ApiRequest
         
     | 
| 
       17 
17 
     | 
    
         
             
                attr_reader :item_id
         
     | 
| 
         @@ -0,0 +1,52 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Delete all the items that pass the filter.
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              #If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql.html) instead of deleting the item completely.
         
     | 
| 
      
 13 
     | 
    
         
            +
              class DeleteMoreItems < ApiRequest
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_reader :filter
         
     | 
| 
      
 15 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 16 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 17 
     | 
    
         
            +
              
         
     | 
| 
      
 18 
     | 
    
         
            +
              ##
         
     | 
| 
      
 19 
     | 
    
         
            +
              # * *Required arguments*
         
     | 
| 
      
 20 
     | 
    
         
            +
              #   - +filter+ -> A [ReQL](https://docs.recombee.com/reql.html) expression, which return `true` for the items that shall be updated.
         
     | 
| 
      
 21 
     | 
    
         
            +
              #
         
     | 
| 
      
 22 
     | 
    
         
            +
                def initialize(filter)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @filter = filter
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @timeout = 1000
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              
         
     | 
| 
      
 28 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 29 
     | 
    
         
            +
                def method
         
     | 
| 
      
 30 
     | 
    
         
            +
                  :delete
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              
         
     | 
| 
      
 33 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 34 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 35 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 36 
     | 
    
         
            +
                  p['filter'] = @filter
         
     | 
| 
      
 37 
     | 
    
         
            +
                  p
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              
         
     | 
| 
      
 40 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 41 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 42 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 43 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 44 
     | 
    
         
            +
                  params
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              
         
     | 
| 
      
 47 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 48 
     | 
    
         
            +
                def path
         
     | 
| 
      
 49 
     | 
    
         
            +
                  "/{databaseId}/more-items/"
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Deletes synonym of given `id` and this synonym is no longer taken into account in the [Search items](https://docs.recombee.com/api.html#search-items).
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              class DeleteSearchSynonym < ApiRequest
         
     | 
| 
      
 13 
     | 
    
         
            +
                attr_reader :id
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 15 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              ##
         
     | 
| 
      
 18 
     | 
    
         
            +
              # * *Required arguments*
         
     | 
| 
      
 19 
     | 
    
         
            +
              #   - +id+ -> ID of the synonym that should be deleted.
         
     | 
| 
      
 20 
     | 
    
         
            +
              #
         
     | 
| 
      
 21 
     | 
    
         
            +
                def initialize(id)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @id = id
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @timeout = 10000
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
      
 27 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 28 
     | 
    
         
            +
                def method
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :delete
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              
         
     | 
| 
      
 32 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 33 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 34 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 35 
     | 
    
         
            +
                  p
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              
         
     | 
| 
      
 38 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 39 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 40 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 41 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 42 
     | 
    
         
            +
                  params
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 46 
     | 
    
         
            +
                def path
         
     | 
| 
      
 47 
     | 
    
         
            +
                  "/{databaseId}/synonyms/items/#{@id}"
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Gives the list of synonyms defined in the database.
         
     | 
| 
      
 11 
     | 
    
         
            +
              class ListSearchSynonyms < ApiRequest
         
     | 
| 
      
 12 
     | 
    
         
            +
                attr_reader :count, :offset
         
     | 
| 
      
 13 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 15 
     | 
    
         
            +
              
         
     | 
| 
      
 16 
     | 
    
         
            +
              ##
         
     | 
| 
      
 17 
     | 
    
         
            +
              #
         
     | 
| 
      
 18 
     | 
    
         
            +
              # * *Optional arguments (given as hash optional)*
         
     | 
| 
      
 19 
     | 
    
         
            +
              #   - +count+ -> The number of synonyms to be listed.
         
     | 
| 
      
 20 
     | 
    
         
            +
              #   - +offset+ -> Specifies the number of synonyms to skip (ordered by `term`).
         
     | 
| 
      
 21 
     | 
    
         
            +
              #
         
     | 
| 
      
 22 
     | 
    
         
            +
                def initialize(optional = {})
         
     | 
| 
      
 23 
     | 
    
         
            +
                  optional = normalize_optional(optional)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @count = optional['count']
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @offset = optional['offset']
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @optional = optional
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @timeout = 100000
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @optional.each do |par, _|
         
     | 
| 
      
 30 
     | 
    
         
            +
                    fail UnknownOptionalParameter.new(par) unless ["count","offset"].include? par
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              
         
     | 
| 
      
 34 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 35 
     | 
    
         
            +
                def method
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :get
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              
         
     | 
| 
      
 39 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 40 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 41 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 42 
     | 
    
         
            +
                  p
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 46 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 47 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 48 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 49 
     | 
    
         
            +
                  params['count'] = @optional['count'] if @optional['count']
         
     | 
| 
      
 50 
     | 
    
         
            +
                  params['offset'] = @optional['offset'] if @optional['offset']
         
     | 
| 
      
 51 
     | 
    
         
            +
                  params
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              
         
     | 
| 
      
 54 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 55 
     | 
    
         
            +
                def path
         
     | 
| 
      
 56 
     | 
    
         
            +
                  "/{databaseId}/synonyms/items/"
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -9,9 +9,14 @@ module RecombeeApiClient 
     | 
|
| 
       9 
9 
     | 
    
         
             
              ##
         
     | 
| 
       10 
10 
     | 
    
         
             
              #Recommends set of items that are somehow related to one given item, *X*. Typical scenario  is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user *A* into account.
         
     | 
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
     | 
    
         
            -
              # 
     | 
| 
      
 12 
     | 
    
         
            +
              #The returned items are sorted by relevance (first item being the most relevant).
         
     | 
| 
      
 13 
     | 
    
         
            +
              #
         
     | 
| 
      
 14 
     | 
    
         
            +
              #Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
         
     | 
| 
       13 
15 
     | 
    
         
             
              #
         
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
      
 16 
     | 
    
         
            +
              #- Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics).
         
     | 
| 
      
 17 
     | 
    
         
            +
              #- Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items).
         
     | 
| 
      
 18 
     | 
    
         
            +
              #
         
     | 
| 
      
 19 
     | 
    
         
            +
              #It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
         
     | 
| 
       15 
20 
     | 
    
         
             
              #
         
     | 
| 
       16 
21 
     | 
    
         
             
              class RecommendItemsToItem < ApiRequest
         
     | 
| 
       17 
22 
     | 
    
         
             
                attr_reader :item_id, :target_user_id, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter, :booster, :logic, :user_impact, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
         
     | 
| 
         @@ -75,7 +80,8 @@ module RecombeeApiClient 
     | 
|
| 
       75 
80 
     | 
    
         
             
              #            "url": "myshop.com/mixer-42"
         
     | 
| 
       76 
81 
     | 
    
         
             
              #          }
         
     | 
| 
       77 
82 
     | 
    
         
             
              #        }
         
     | 
| 
       78 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 83 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 84 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       79 
85 
     | 
    
         
             
              #  }
         
     | 
| 
       80 
86 
     | 
    
         
             
              #```
         
     | 
| 
       81 
87 
     | 
    
         
             
              #
         
     | 
| 
         @@ -101,7 +107,8 @@ module RecombeeApiClient 
     | 
|
| 
       101 
107 
     | 
    
         
             
              #            "price": 39
         
     | 
| 
       102 
108 
     | 
    
         
             
              #          }
         
     | 
| 
       103 
109 
     | 
    
         
             
              #        }
         
     | 
| 
       104 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 110 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 111 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       105 
112 
     | 
    
         
             
              #  }
         
     | 
| 
       106 
113 
     | 
    
         
             
              #```
         
     | 
| 
       107 
114 
     | 
    
         
             
              #
         
     | 
| 
         @@ -124,7 +131,7 @@ module RecombeeApiClient 
     | 
|
| 
       124 
131 
     | 
    
         
             
              #
         
     | 
| 
       125 
132 
     | 
    
         
             
              #   - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
         
     | 
| 
       126 
133 
     | 
    
         
             
              #
         
     | 
| 
       127 
     | 
    
         
            -
              #   - +minRelevance+ -> **Expert option** If the *targetUserId* is provided:  Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested  
     | 
| 
      
 134 
     | 
    
         
            +
              #   - +minRelevance+ -> **Expert option** If the *targetUserId* is provided:  Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance, and may return less than *count* items when there is not enough data to fulfill it.
         
     | 
| 
       128 
135 
     | 
    
         
             
              #
         
     | 
| 
       129 
136 
     | 
    
         
             
              #   - +rotationRate+ -> **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items.
         
     | 
| 
       130 
137 
     | 
    
         
             
              #
         
     | 
| 
         @@ -11,9 +11,14 @@ module RecombeeApiClient 
     | 
|
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
12 
     | 
    
         
             
              #The most typical use cases are recommendations at homepage, in some "Picked just for you" section or in email.
         
     | 
| 
       13 
13 
     | 
    
         
             
              #
         
     | 
| 
       14 
     | 
    
         
            -
              # 
     | 
| 
      
 14 
     | 
    
         
            +
              #The returned items are sorted by relevance (first item being the most relevant).
         
     | 
| 
      
 15 
     | 
    
         
            +
              #
         
     | 
| 
      
 16 
     | 
    
         
            +
              #Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
         
     | 
| 
       15 
17 
     | 
    
         
             
              #
         
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
      
 18 
     | 
    
         
            +
              #- Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics).
         
     | 
| 
      
 19 
     | 
    
         
            +
              #- Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items).
         
     | 
| 
      
 20 
     | 
    
         
            +
              #
         
     | 
| 
      
 21 
     | 
    
         
            +
              #It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
         
     | 
| 
       17 
22 
     | 
    
         
             
              #
         
     | 
| 
       18 
23 
     | 
    
         
             
              class RecommendItemsToUser < ApiRequest
         
     | 
| 
       19 
24 
     | 
    
         
             
                attr_reader :user_id, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter, :booster, :logic, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
         
     | 
| 
         @@ -61,7 +66,8 @@ module RecombeeApiClient 
     | 
|
| 
       61 
66 
     | 
    
         
             
              #            "url": "myshop.com/mixer-42"
         
     | 
| 
       62 
67 
     | 
    
         
             
              #          }
         
     | 
| 
       63 
68 
     | 
    
         
             
              #        }
         
     | 
| 
       64 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 69 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 70 
     | 
    
         
            +
              #     "numberNextRecommsCalls": 0
         
     | 
| 
       65 
71 
     | 
    
         
             
              #  }
         
     | 
| 
       66 
72 
     | 
    
         
             
              #```
         
     | 
| 
       67 
73 
     | 
    
         
             
              #
         
     | 
| 
         @@ -87,7 +93,8 @@ module RecombeeApiClient 
     | 
|
| 
       87 
93 
     | 
    
         
             
              #            "price": 39
         
     | 
| 
       88 
94 
     | 
    
         
             
              #          }
         
     | 
| 
       89 
95 
     | 
    
         
             
              #        }
         
     | 
| 
       90 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 96 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 97 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       91 
98 
     | 
    
         
             
              #  }
         
     | 
| 
       92 
99 
     | 
    
         
             
              #```
         
     | 
| 
       93 
100 
     | 
    
         
             
              #
         
     | 
| 
         @@ -108,9 +115,9 @@ module RecombeeApiClient 
     | 
|
| 
       108 
115 
     | 
    
         
             
              #
         
     | 
| 
       109 
116 
     | 
    
         
             
              #   - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
         
     | 
| 
       110 
117 
     | 
    
         
             
              #
         
     | 
| 
       111 
     | 
    
         
            -
              #   - +minRelevance+ -> **Expert option** Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested  
     | 
| 
      
 118 
     | 
    
         
            +
              #   - +minRelevance+ -> **Expert option** Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance, and may return less than *count* items when there is not enough data to fulfill it.
         
     | 
| 
       112 
119 
     | 
    
         
             
              #
         
     | 
| 
       113 
     | 
    
         
            -
              #   - +rotationRate+ -> **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0 
     | 
| 
      
 120 
     | 
    
         
            +
              #   - +rotationRate+ -> **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0`.
         
     | 
| 
       114 
121 
     | 
    
         
             
              #
         
     | 
| 
       115 
122 
     | 
    
         
             
              #   - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
         
     | 
| 
       116 
123 
     | 
    
         
             
              #
         
     | 
| 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Returns items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (*infinite scroll*) or goes to a next page.
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              #It accepts `recommId` of a base recommendation request (e.g. request from the first page) and number of items that shall be returned (`count`).
         
     | 
| 
      
 13 
     | 
    
         
            +
              #The base request can be one of:
         
     | 
| 
      
 14 
     | 
    
         
            +
              #  - [Recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item)
         
     | 
| 
      
 15 
     | 
    
         
            +
              #  - [Recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user)
         
     | 
| 
      
 16 
     | 
    
         
            +
              #  - [Search items](https://docs.recombee.com/api.html#search-items)
         
     | 
| 
      
 17 
     | 
    
         
            +
              #
         
     | 
| 
      
 18 
     | 
    
         
            +
              #All the other parameters are inherited from the base request.
         
     | 
| 
      
 19 
     | 
    
         
            +
              #
         
     | 
| 
      
 20 
     | 
    
         
            +
              #*Recommend next items* can be called many times for a single `recommId` and each call returns different (previously not recommended) items.
         
     | 
| 
      
 21 
     | 
    
         
            +
              #The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field.
         
     | 
| 
      
 22 
     | 
    
         
            +
              #
         
     | 
| 
      
 23 
     | 
    
         
            +
              #*Recommend next items* can be requested up to 30 minutes after the base request or a previous *Recommend next items* call.
         
     | 
| 
      
 24 
     | 
    
         
            +
              #
         
     | 
| 
      
 25 
     | 
    
         
            +
              #For billing purposes, each call to *Recommend next items* is counted as a separate recommendation request.
         
     | 
| 
      
 26 
     | 
    
         
            +
              #
         
     | 
| 
      
 27 
     | 
    
         
            +
              class RecommendNextItems < ApiRequest
         
     | 
| 
      
 28 
     | 
    
         
            +
                attr_reader :recomm_id, :count
         
     | 
| 
      
 29 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 30 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 31 
     | 
    
         
            +
              
         
     | 
| 
      
 32 
     | 
    
         
            +
              ##
         
     | 
| 
      
 33 
     | 
    
         
            +
              # * *Required arguments*
         
     | 
| 
      
 34 
     | 
    
         
            +
              #   - +recomm_id+ -> ID of the base recommendation request for which next recommendations should be returned
         
     | 
| 
      
 35 
     | 
    
         
            +
              #   - +count+ -> Number of items to be recommended
         
     | 
| 
      
 36 
     | 
    
         
            +
              #
         
     | 
| 
      
 37 
     | 
    
         
            +
              #
         
     | 
| 
      
 38 
     | 
    
         
            +
                def initialize(recomm_id, count)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @recomm_id = recomm_id
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @count = count
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @timeout = 3000
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 46 
     | 
    
         
            +
                def method
         
     | 
| 
      
 47 
     | 
    
         
            +
                  :post
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              
         
     | 
| 
      
 50 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 51 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 52 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 53 
     | 
    
         
            +
                  p['count'] = @count
         
     | 
| 
      
 54 
     | 
    
         
            +
                  p
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
              
         
     | 
| 
      
 57 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 58 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 59 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 60 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 61 
     | 
    
         
            +
                  params
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
              
         
     | 
| 
      
 64 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 65 
     | 
    
         
            +
                def path
         
     | 
| 
      
 66 
     | 
    
         
            +
                  "/{databaseId}/recomms/next/items/#{@recomm_id}"
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -53,7 +53,8 @@ module RecombeeApiClient 
     | 
|
| 
       53 
53 
     | 
    
         
             
              #            "sex": "M"
         
     | 
| 
       54 
54 
     | 
    
         
             
              #          }
         
     | 
| 
       55 
55 
     | 
    
         
             
              #        }
         
     | 
| 
       56 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 56 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 57 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       57 
58 
     | 
    
         
             
              #  }
         
     | 
| 
       58 
59 
     | 
    
         
             
              #```
         
     | 
| 
       59 
60 
     | 
    
         
             
              #
         
     | 
| 
         @@ -77,7 +78,8 @@ module RecombeeApiClient 
     | 
|
| 
       77 
78 
     | 
    
         
             
              #            "country": "CAN"
         
     | 
| 
       78 
79 
     | 
    
         
             
              #          }
         
     | 
| 
       79 
80 
     | 
    
         
             
              #        }
         
     | 
| 
       80 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 81 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 82 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       81 
83 
     | 
    
         
             
              #  }
         
     | 
| 
       82 
84 
     | 
    
         
             
              #```
         
     | 
| 
       83 
85 
     | 
    
         
             
              #
         
     | 
| 
         @@ -53,8 +53,9 @@ module RecombeeApiClient 
     | 
|
| 
       53 
53 
     | 
    
         
             
              #            "sex": "M"
         
     | 
| 
       54 
54 
     | 
    
         
             
              #          }
         
     | 
| 
       55 
55 
     | 
    
         
             
              #        }
         
     | 
| 
       56 
     | 
    
         
            -
              #      ]
         
     | 
| 
       57 
     | 
    
         
            -
              #     
     | 
| 
      
 56 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 57 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
      
 58 
     | 
    
         
            +
              #  }
         
     | 
| 
       58 
59 
     | 
    
         
             
              #```
         
     | 
| 
       59 
60 
     | 
    
         
             
              #
         
     | 
| 
       60 
61 
     | 
    
         
             
              #   - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list. 
         
     | 
| 
         @@ -77,7 +78,8 @@ module RecombeeApiClient 
     | 
|
| 
       77 
78 
     | 
    
         
             
              #            "country": "CAN"
         
     | 
| 
       78 
79 
     | 
    
         
             
              #          }
         
     | 
| 
       79 
80 
     | 
    
         
             
              #        }
         
     | 
| 
       80 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 81 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 82 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       81 
83 
     | 
    
         
             
              #  }
         
     | 
| 
       82 
84 
     | 
    
         
             
              #```
         
     | 
| 
       83 
85 
     | 
    
         
             
              #
         
     | 
| 
         @@ -13,9 +13,14 @@ module RecombeeApiClient 
     | 
|
| 
       13 
13 
     | 
    
         
             
              #
         
     | 
| 
       14 
14 
     | 
    
         
             
              #This endpoint should be used in a search box at your website/app. It can be called multiple times as the user is typing the query in order to get the most viable suggestions based on current state of the query, or once after submitting the whole query. 
         
     | 
| 
       15 
15 
     | 
    
         
             
              #
         
     | 
| 
       16 
     | 
    
         
            -
              # 
     | 
| 
      
 16 
     | 
    
         
            +
              #The returned items are sorted by relevance (first item being the most relevant).
         
     | 
| 
      
 17 
     | 
    
         
            +
              #
         
     | 
| 
      
 18 
     | 
    
         
            +
              #Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
         
     | 
| 
       17 
19 
     | 
    
         
             
              #
         
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              #- Let Recombee know that this search was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics).
         
     | 
| 
      
 21 
     | 
    
         
            +
              #- Get subsequent search results when the user scrolls down or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items).
         
     | 
| 
      
 22 
     | 
    
         
            +
              #
         
     | 
| 
      
 23 
     | 
    
         
            +
              #It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
         
     | 
| 
       19 
24 
     | 
    
         
             
              #
         
     | 
| 
       20 
25 
     | 
    
         
             
              class SearchItems < ApiRequest
         
     | 
| 
       21 
26 
     | 
    
         
             
                attr_reader :user_id, :search_query, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter, :booster, :logic, :expert_settings, :return_ab_group
         
     | 
| 
         @@ -62,7 +67,8 @@ module RecombeeApiClient 
     | 
|
| 
       62 
67 
     | 
    
         
             
              #            "url": "myshop.com/mixer-42"
         
     | 
| 
       63 
68 
     | 
    
         
             
              #          }
         
     | 
| 
       64 
69 
     | 
    
         
             
              #        }
         
     | 
| 
       65 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 70 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 71 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       66 
72 
     | 
    
         
             
              #  }
         
     | 
| 
       67 
73 
     | 
    
         
             
              #```
         
     | 
| 
       68 
74 
     | 
    
         
             
              #
         
     | 
| 
         @@ -88,7 +94,8 @@ module RecombeeApiClient 
     | 
|
| 
       88 
94 
     | 
    
         
             
              #            "price": 39
         
     | 
| 
       89 
95 
     | 
    
         
             
              #          }
         
     | 
| 
       90 
96 
     | 
    
         
             
              #        }
         
     | 
| 
       91 
     | 
    
         
            -
              #      ]
         
     | 
| 
      
 97 
     | 
    
         
            +
              #      ],
         
     | 
| 
      
 98 
     | 
    
         
            +
              #    "numberNextRecommsCalls": 0
         
     | 
| 
       92 
99 
     | 
    
         
             
              #  }
         
     | 
| 
       93 
100 
     | 
    
         
             
              #```
         
     | 
| 
       94 
101 
     | 
    
         
             
              #
         
     | 
| 
         @@ -0,0 +1,63 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated, do not edit
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module RecombeeApiClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              require_relative 'request'
         
     | 
| 
      
 7 
     | 
    
         
            +
              require_relative '../errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              ##
         
     | 
| 
      
 10 
     | 
    
         
            +
              #Update (some) property values of all the items that pass the filter.
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              #Example: *Setting all the items that are older than a week as unavailable*
         
     | 
| 
      
 13 
     | 
    
         
            +
              #
         
     | 
| 
      
 14 
     | 
    
         
            +
              #  ```
         
     | 
| 
      
 15 
     | 
    
         
            +
              #    {
         
     | 
| 
      
 16 
     | 
    
         
            +
              #      "filter": "'releaseDate' < now() - 7*24*3600",
         
     | 
| 
      
 17 
     | 
    
         
            +
              #      "changes": {"available": false}
         
     | 
| 
      
 18 
     | 
    
         
            +
              #    }
         
     | 
| 
      
 19 
     | 
    
         
            +
              #  ```
         
     | 
| 
      
 20 
     | 
    
         
            +
              #
         
     | 
| 
      
 21 
     | 
    
         
            +
              class UpdateMoreItems < ApiRequest
         
     | 
| 
      
 22 
     | 
    
         
            +
                attr_reader :filter, :changes
         
     | 
| 
      
 23 
     | 
    
         
            +
                attr_accessor :timeout
         
     | 
| 
      
 24 
     | 
    
         
            +
                attr_accessor :ensure_https
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              ##
         
     | 
| 
      
 27 
     | 
    
         
            +
              # * *Required arguments*
         
     | 
| 
      
 28 
     | 
    
         
            +
              #   - +filter+ -> A [ReQL](https://docs.recombee.com/reql.html) expression, which return `true` for the items that shall be updated.
         
     | 
| 
      
 29 
     | 
    
         
            +
              #   - +changes+ -> A dictionary where the keys are properties which shall be updated.
         
     | 
| 
      
 30 
     | 
    
         
            +
              #
         
     | 
| 
      
 31 
     | 
    
         
            +
                def initialize(filter, changes)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @filter = filter
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @changes = changes
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @timeout = 1000
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @ensure_https = false
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              
         
     | 
| 
      
 38 
     | 
    
         
            +
                # HTTP method
         
     | 
| 
      
 39 
     | 
    
         
            +
                def method
         
     | 
| 
      
 40 
     | 
    
         
            +
                  :post
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              
         
     | 
| 
      
 43 
     | 
    
         
            +
                # Values of body parameters as a Hash
         
     | 
| 
      
 44 
     | 
    
         
            +
                def body_parameters
         
     | 
| 
      
 45 
     | 
    
         
            +
                  p = Hash.new
         
     | 
| 
      
 46 
     | 
    
         
            +
                  p['filter'] = @filter
         
     | 
| 
      
 47 
     | 
    
         
            +
                  p['changes'] = @changes
         
     | 
| 
      
 48 
     | 
    
         
            +
                  p
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              
         
     | 
| 
      
 51 
     | 
    
         
            +
                # Values of query parameters as a Hash.
         
     | 
| 
      
 52 
     | 
    
         
            +
                # name of parameter => value of the parameter
         
     | 
| 
      
 53 
     | 
    
         
            +
                def query_parameters
         
     | 
| 
      
 54 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 55 
     | 
    
         
            +
                  params
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              
         
     | 
| 
      
 58 
     | 
    
         
            +
                # Relative path to the endpoint
         
     | 
| 
      
 59 
     | 
    
         
            +
                def path
         
     | 
| 
      
 60 
     | 
    
         
            +
                  "/{databaseId}/more-items/"
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/recombee_api_client.rb
    CHANGED
    
    | 
         @@ -18,19 +18,16 @@ module RecombeeApiClient 
     | 
|
| 
       18 
18 
     | 
    
         
             
                include HTTParty
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                BATCH_MAX_SIZE = 10000
         
     | 
| 
       21 
     | 
    
         
            -
                USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/ 
     | 
| 
      
 21 
     | 
    
         
            +
                USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/4.0.0'}
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                ##
         
     | 
| 
       24 
24 
     | 
    
         
             
                #   - +account+ -> Name of your account at Recombee
         
     | 
| 
       25 
25 
     | 
    
         
             
                #   - +token+ -> Secret token obtained from Recombee for signing requests
         
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
       27 
     | 
    
         
            -
                def initialize(account, token, protocol = 'https', options = {})
         
     | 
| 
      
 26 
     | 
    
         
            +
                def initialize(account, token, options = {})
         
     | 
| 
       28 
27 
     | 
    
         
             
                  @account = account
         
     | 
| 
       29 
28 
     | 
    
         
             
                  @token = token
         
     | 
| 
       30 
     | 
    
         
            -
                  @protocol = protocol
         
     | 
| 
       31 
     | 
    
         
            -
                  @base_uri =  
     | 
| 
       32 
     | 
    
         
            -
                  @base_uri||=  options[:base_uri]
         
     | 
| 
       33 
     | 
    
         
            -
                  @base_uri||= 'rapi.recombee.com'
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @protocol = options[:protocol] || 'https'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @base_uri = get_base_uri(options)
         
     | 
| 
       34 
31 
     | 
    
         
             
                end
         
     | 
| 
       35 
32 
     | 
    
         | 
| 
       36 
33 
     | 
    
         
             
                ##
         
     | 
| 
         @@ -42,7 +39,7 @@ module RecombeeApiClient 
     | 
|
| 
       42 
39 
     | 
    
         
             
                  timeout = request.timeout / 1000
         
     | 
| 
       43 
40 
     | 
    
         
             
                  uri = process_request_uri(request)
         
     | 
| 
       44 
41 
     | 
    
         
             
                  uri = sign_url(uri)
         
     | 
| 
       45 
     | 
    
         
            -
                  protocol = request.ensure_https ? 'https' : @protocol
         
     | 
| 
      
 42 
     | 
    
         
            +
                  protocol = request.ensure_https ? 'https' : @protocol.to_s
         
     | 
| 
       46 
43 
     | 
    
         
             
                  uri = protocol + '://' + @base_uri + uri
         
     | 
| 
       47 
44 
     | 
    
         
             
                  # puts uri
         
     | 
| 
       48 
45 
     | 
    
         
             
                  begin
         
     | 
| 
         @@ -63,10 +60,33 @@ module RecombeeApiClient 
     | 
|
| 
       63 
60 
     | 
    
         | 
| 
       64 
61 
     | 
    
         
             
                private
         
     | 
| 
       65 
62 
     | 
    
         | 
| 
      
 63 
     | 
    
         
            +
                def get_regional_base_uri(region)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  uri = {
         
     | 
| 
      
 65 
     | 
    
         
            +
                        'ap-se' => 'rapi-ap-se.recombee.com',
         
     | 
| 
      
 66 
     | 
    
         
            +
                        'ca-east' => 'rapi-ca-east.recombee.com',
         
     | 
| 
      
 67 
     | 
    
         
            +
                        'eu-west' => 'rapi-eu-west.recombee.com',
         
     | 
| 
      
 68 
     | 
    
         
            +
                        'us-west' => 'rapi-us-west.recombee.com'
         
     | 
| 
      
 69 
     | 
    
         
            +
                      }[region.to_s.gsub('_', '-').downcase]
         
     | 
| 
      
 70 
     | 
    
         
            +
                  raise ArgumentError.new("Region \"#{region}\" is unknown. You may need to update the version of the SDK.") if uri == nil
         
     | 
| 
      
 71 
     | 
    
         
            +
                  uri
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                def get_base_uri(options)
         
     | 
| 
      
 75 
     | 
    
         
            +
                  base_uri = ENV['RAPI_URI']
         
     | 
| 
      
 76 
     | 
    
         
            +
                  base_uri ||= options[:base_uri]
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  if options.key? :region
         
     | 
| 
      
 79 
     | 
    
         
            +
                    raise ArgumentError.new(':base_uri and :region cannot be specified at the same time') if base_uri
         
     | 
| 
      
 80 
     | 
    
         
            +
                    base_uri = get_regional_base_uri(options[:region])
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                  base_uri||= 'rapi.recombee.com'
         
     | 
| 
      
 83 
     | 
    
         
            +
                  base_uri
         
     | 
| 
      
 84 
     | 
    
         
            +
                end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       66 
86 
     | 
    
         
             
                def put(request, uri, timeout)
         
     | 
| 
       67 
87 
     | 
    
         
             
                  response = self.class.put(uri, body: request.body_parameters.to_json, 
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
                                            headers: { 'Content-Type' => 'application/json' }.merge(USER_AGENT),
         
     | 
| 
      
 89 
     | 
    
         
            +
                                            timeout: timeout)
         
     | 
| 
       70 
90 
     | 
    
         
             
                  check_errors(response, request)
         
     | 
| 
       71 
91 
     | 
    
         
             
                  response.body
         
     | 
| 
       72 
92 
     | 
    
         
             
                end
         
     | 
| 
         @@ -78,10 +98,9 @@ module RecombeeApiClient 
     | 
|
| 
       78 
98 
     | 
    
         
             
                end
         
     | 
| 
       79 
99 
     | 
    
         | 
| 
       80 
100 
     | 
    
         
             
                def post(request, uri, timeout)
         
     | 
| 
       81 
     | 
    
         
            -
                  # pass arguments in body
         
     | 
| 
       82 
101 
     | 
    
         
             
                  response = self.class.post(uri, body: request.body_parameters.to_json, 
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
      
 102 
     | 
    
         
            +
                                             headers: { 'Content-Type' => 'application/json' }.merge(USER_AGENT),
         
     | 
| 
      
 103 
     | 
    
         
            +
                                             timeout: timeout)
         
     | 
| 
       85 
104 
     | 
    
         
             
                  check_errors(response, request)
         
     | 
| 
       86 
105 
     | 
    
         
             
                  begin
         
     | 
| 
       87 
106 
     | 
    
         
             
                    return JSON.parse(response.body)
         
     | 
| 
         @@ -91,9 +110,15 @@ module RecombeeApiClient 
     | 
|
| 
       91 
110 
     | 
    
         
             
                end
         
     | 
| 
       92 
111 
     | 
    
         | 
| 
       93 
112 
     | 
    
         
             
                def delete(request, uri, timeout)
         
     | 
| 
       94 
     | 
    
         
            -
                  response = self.class.delete(uri,  
     | 
| 
      
 113 
     | 
    
         
            +
                  response = self.class.delete(uri, body: request.body_parameters.to_json,
         
     | 
| 
      
 114 
     | 
    
         
            +
                                               headers: { 'Content-Type' => 'application/json' }.merge(USER_AGENT),
         
     | 
| 
      
 115 
     | 
    
         
            +
                                               timeout: timeout)
         
     | 
| 
       95 
116 
     | 
    
         
             
                  check_errors(response, request)
         
     | 
| 
       96 
     | 
    
         
            -
                   
     | 
| 
      
 117 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 118 
     | 
    
         
            +
                    return JSON.parse(response.body)
         
     | 
| 
      
 119 
     | 
    
         
            +
                  rescue JSON::ParserError
         
     | 
| 
      
 120 
     | 
    
         
            +
                    return response.body
         
     | 
| 
      
 121 
     | 
    
         
            +
                  end
         
     | 
| 
       97 
122 
     | 
    
         
             
                end
         
     | 
| 
       98 
123 
     | 
    
         | 
| 
       99 
124 
     | 
    
         
             
                def check_errors(response, request)
         
     | 
    
        data/recombee_api_client.gemspec
    CHANGED
    
    | 
         @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       20 
20 
     | 
    
         
             
              spec.add_dependency 'multi_json'
         
     | 
| 
       21 
21 
     | 
    
         
             
              spec.add_dependency 'httparty'
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              spec.add_development_dependency 'bundler', '~>  
     | 
| 
       24 
     | 
    
         
            -
              spec.add_development_dependency 'rake', '~>  
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 2.2.10'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 12.3.3'
         
     | 
| 
       25 
25 
     | 
    
         
             
              spec.add_development_dependency 'rspec'
         
     | 
| 
       26 
26 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: recombee_api_client
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 4.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ondřej Fiedler
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: multi_json
         
     | 
| 
         @@ -44,28 +44,28 @@ dependencies: 
     | 
|
| 
       44 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
45 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       46 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version:  
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 2.2.10
         
     | 
| 
       48 
48 
     | 
    
         
             
              type: :development
         
     | 
| 
       49 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version:  
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 2.2.10
         
     | 
| 
       55 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
56 
     | 
    
         
             
              name: rake
         
     | 
| 
       57 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version:  
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 12.3.3
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version:  
     | 
| 
      
 68 
     | 
    
         
            +
                    version: 12.3.3
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: rspec
         
     | 
| 
       71 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -100,18 +100,22 @@ files: 
     | 
|
| 
       100 
100 
     | 
    
         
             
            - lib/recombee_api_client/api/add_item_property.rb
         
     | 
| 
       101 
101 
     | 
    
         
             
            - lib/recombee_api_client/api/add_purchase.rb
         
     | 
| 
       102 
102 
     | 
    
         
             
            - lib/recombee_api_client/api/add_rating.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/recombee_api_client/api/add_search_synonym.rb
         
     | 
| 
       103 
104 
     | 
    
         
             
            - lib/recombee_api_client/api/add_series.rb
         
     | 
| 
       104 
105 
     | 
    
         
             
            - lib/recombee_api_client/api/add_user.rb
         
     | 
| 
       105 
106 
     | 
    
         
             
            - lib/recombee_api_client/api/add_user_property.rb
         
     | 
| 
       106 
107 
     | 
    
         
             
            - lib/recombee_api_client/api/batch.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/recombee_api_client/api/delete_all_search_synonyms.rb
         
     | 
| 
       107 
109 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_bookmark.rb
         
     | 
| 
       108 
110 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_cart_addition.rb
         
     | 
| 
       109 
111 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_detail_view.rb
         
     | 
| 
       110 
112 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_group.rb
         
     | 
| 
       111 
113 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_item.rb
         
     | 
| 
       112 
114 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_item_property.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/recombee_api_client/api/delete_more_items.rb
         
     | 
| 
       113 
116 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_purchase.rb
         
     | 
| 
       114 
117 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_rating.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib/recombee_api_client/api/delete_search_synonym.rb
         
     | 
| 
       115 
119 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_series.rb
         
     | 
| 
       116 
120 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_user.rb
         
     | 
| 
       117 
121 
     | 
    
         
             
            - lib/recombee_api_client/api/delete_user_property.rb
         
     | 
| 
         @@ -123,7 +127,6 @@ files: 
     | 
|
| 
       123 
127 
     | 
    
         
             
            - lib/recombee_api_client/api/hash_normalizer.rb
         
     | 
| 
       124 
128 
     | 
    
         
             
            - lib/recombee_api_client/api/insert_to_group.rb
         
     | 
| 
       125 
129 
     | 
    
         
             
            - lib/recombee_api_client/api/insert_to_series.rb
         
     | 
| 
       126 
     | 
    
         
            -
            - lib/recombee_api_client/api/item_based_recommendation.rb
         
     | 
| 
       127 
130 
     | 
    
         
             
            - lib/recombee_api_client/api/list_group_items.rb
         
     | 
| 
       128 
131 
     | 
    
         
             
            - lib/recombee_api_client/api/list_groups.rb
         
     | 
| 
       129 
132 
     | 
    
         
             
            - lib/recombee_api_client/api/list_item_bookmarks.rb
         
     | 
| 
         @@ -134,6 +137,7 @@ files: 
     | 
|
| 
       134 
137 
     | 
    
         
             
            - lib/recombee_api_client/api/list_item_ratings.rb
         
     | 
| 
       135 
138 
     | 
    
         
             
            - lib/recombee_api_client/api/list_item_view_portions.rb
         
     | 
| 
       136 
139 
     | 
    
         
             
            - lib/recombee_api_client/api/list_items.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - lib/recombee_api_client/api/list_search_synonyms.rb
         
     | 
| 
       137 
141 
     | 
    
         
             
            - lib/recombee_api_client/api/list_series.rb
         
     | 
| 
       138 
142 
     | 
    
         
             
            - lib/recombee_api_client/api/list_series_items.rb
         
     | 
| 
       139 
143 
     | 
    
         
             
            - lib/recombee_api_client/api/list_user_bookmarks.rb
         
     | 
| 
         @@ -147,6 +151,7 @@ files: 
     | 
|
| 
       147 
151 
     | 
    
         
             
            - lib/recombee_api_client/api/merge_users.rb
         
     | 
| 
       148 
152 
     | 
    
         
             
            - lib/recombee_api_client/api/recommend_items_to_item.rb
         
     | 
| 
       149 
153 
     | 
    
         
             
            - lib/recombee_api_client/api/recommend_items_to_user.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/recombee_api_client/api/recommend_next_items.rb
         
     | 
| 
       150 
155 
     | 
    
         
             
            - lib/recombee_api_client/api/recommend_users_to_item.rb
         
     | 
| 
       151 
156 
     | 
    
         
             
            - lib/recombee_api_client/api/recommend_users_to_user.rb
         
     | 
| 
       152 
157 
     | 
    
         
             
            - lib/recombee_api_client/api/remove_from_group.rb
         
     | 
| 
         @@ -158,7 +163,7 @@ files: 
     | 
|
| 
       158 
163 
     | 
    
         
             
            - lib/recombee_api_client/api/set_user_values.rb
         
     | 
| 
       159 
164 
     | 
    
         
             
            - lib/recombee_api_client/api/set_values.rb
         
     | 
| 
       160 
165 
     | 
    
         
             
            - lib/recombee_api_client/api/set_view_portion.rb
         
     | 
| 
       161 
     | 
    
         
            -
            - lib/recombee_api_client/api/ 
     | 
| 
      
 166 
     | 
    
         
            +
            - lib/recombee_api_client/api/update_more_items.rb
         
     | 
| 
       162 
167 
     | 
    
         
             
            - lib/recombee_api_client/errors.rb
         
     | 
| 
       163 
168 
     | 
    
         
             
            - lib/recombee_api_client/version.rb
         
     | 
| 
       164 
169 
     | 
    
         
             
            - recombee_api_client.gemspec
         
     | 
| 
         @@ -181,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       181 
186 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       182 
187 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       183 
188 
     | 
    
         
             
            requirements: []
         
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
            rubygems_version: 2.6.11
         
     | 
| 
      
 189 
     | 
    
         
            +
            rubygems_version: 3.1.2
         
     | 
| 
       186 
190 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       187 
191 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       188 
192 
     | 
    
         
             
            summary: Client for Recombee recommendation API
         
     | 
| 
         @@ -1,159 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # This file is auto-generated, do not edit
         
     | 
| 
       3 
     | 
    
         
            -
            #
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            module RecombeeApiClient
         
     | 
| 
       6 
     | 
    
         
            -
              require_relative 'request'
         
     | 
| 
       7 
     | 
    
         
            -
              require_relative '../errors'
         
     | 
| 
       8 
     | 
    
         
            -
              
         
     | 
| 
       9 
     | 
    
         
            -
              ##
         
     | 
| 
       10 
     | 
    
         
            -
              #Deprecated since version 2.0.0. Use RecommendItemsToItem request instead.
         
     | 
| 
       11 
     | 
    
         
            -
              #
         
     | 
| 
       12 
     | 
    
         
            -
              #Recommends set of items that are somehow related to one given item, *X*. Typical scenario for using item-based recommendation is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Item-recommendation request gives you Top-N such items, optionally taking the target user *A* into account.
         
     | 
| 
       13 
     | 
    
         
            -
              #
         
     | 
| 
       14 
     | 
    
         
            -
              # It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
         
     | 
| 
       15 
     | 
    
         
            -
              #
         
     | 
| 
       16 
     | 
    
         
            -
              class ItemBasedRecommendation < ApiRequest
         
     | 
| 
       17 
     | 
    
         
            -
                attr_reader :item_id, :count, :target_user_id, :user_impact, :filter, :booster, :allow_nonexistent, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings
         
     | 
| 
       18 
     | 
    
         
            -
                attr_accessor :timeout
         
     | 
| 
       19 
     | 
    
         
            -
                attr_accessor :ensure_https
         
     | 
| 
       20 
     | 
    
         
            -
              
         
     | 
| 
       21 
     | 
    
         
            -
              ##
         
     | 
| 
       22 
     | 
    
         
            -
              # * *Required arguments*
         
     | 
| 
       23 
     | 
    
         
            -
              #   - +item_id+ -> ID of the item for which the recommendations are to be generated.
         
     | 
| 
       24 
     | 
    
         
            -
              #   - +count+ -> Number of items to be recommended (N for the top-N recommendation).
         
     | 
| 
       25 
     | 
    
         
            -
              #
         
     | 
| 
       26 
     | 
    
         
            -
              # * *Optional arguments (given as hash optional)*
         
     | 
| 
       27 
     | 
    
         
            -
              #   - +targetUserId+ -> ID of the user who will see the recommendations.
         
     | 
| 
       28 
     | 
    
         
            -
              #
         
     | 
| 
       29 
     | 
    
         
            -
              #Specifying the *targetUserId* is beneficial because:
         
     | 
| 
       30 
     | 
    
         
            -
              #
         
     | 
| 
       31 
     | 
    
         
            -
              #* It makes the recommendations personalized
         
     | 
| 
       32 
     | 
    
         
            -
              #* Allows the calculation of Actions and Conversions in the graphical user interface,
         
     | 
| 
       33 
     | 
    
         
            -
              #  as Recombee can pair the user who got recommendations and who afterwards viewed/purchased an item.
         
     | 
| 
       34 
     | 
    
         
            -
              #
         
     | 
| 
       35 
     | 
    
         
            -
              #For the above reasons, we encourage you to set the *targetUserId* even for anonymous/unregistered users (i.e. use their session ID).
         
     | 
| 
       36 
     | 
    
         
            -
              #
         
     | 
| 
       37 
     | 
    
         
            -
              #   - +userImpact+ -> If *targetUserId* parameter is present, the recommendations are biased towards the user given. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get user-based recommendation. The default value is `0`.
         
     | 
| 
       38 
     | 
    
         
            -
              #
         
     | 
| 
       39 
     | 
    
         
            -
              #   - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended items based on the values of their attributes.
         
     | 
| 
       40 
     | 
    
         
            -
              #   - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some items based on the values of their attributes.
         
     | 
| 
       41 
     | 
    
         
            -
              #   - +allowNonexistent+ -> Instead of causing HTTP 404 error, returns some (non-personalized) recommendations if either item of given *itemId* or user of given *targetUserId* does not exist in the database. It creates neither of the missing entities in the database.
         
     | 
| 
       42 
     | 
    
         
            -
              #   - +cascadeCreate+ -> If item of given *itemId* or user of given *targetUserId* doesn't exist in the database, it creates the missing enity/entities and returns some (non-personalized) recommendations. This allows for example rotations in the following recommendations for the user of given *targetUserId*, as the user will be already known to the system.
         
     | 
| 
       43 
     | 
    
         
            -
              #   - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
         
     | 
| 
       44 
     | 
    
         
            -
              #   - +returnProperties+ -> With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying of the recommended items to the user. 
         
     | 
| 
       45 
     | 
    
         
            -
              #
         
     | 
| 
       46 
     | 
    
         
            -
              #Example response:
         
     | 
| 
       47 
     | 
    
         
            -
              #```
         
     | 
| 
       48 
     | 
    
         
            -
              #  [
         
     | 
| 
       49 
     | 
    
         
            -
              #    {
         
     | 
| 
       50 
     | 
    
         
            -
              #      "itemId": "tv-178",
         
     | 
| 
       51 
     | 
    
         
            -
              #      "description": "4K TV with 3D feature",
         
     | 
| 
       52 
     | 
    
         
            -
              #      "categories":   ["Electronics", "Televisions"],
         
     | 
| 
       53 
     | 
    
         
            -
              #      "price": 342,
         
     | 
| 
       54 
     | 
    
         
            -
              #      "url": "myshop.com/tv-178"
         
     | 
| 
       55 
     | 
    
         
            -
              #    },
         
     | 
| 
       56 
     | 
    
         
            -
              #    {
         
     | 
| 
       57 
     | 
    
         
            -
              #      "itemId": "mixer-42",
         
     | 
| 
       58 
     | 
    
         
            -
              #      "description": "Stainless Steel Mixer",
         
     | 
| 
       59 
     | 
    
         
            -
              #      "categories":   ["Home & Kitchen"],
         
     | 
| 
       60 
     | 
    
         
            -
              #      "price": 39,
         
     | 
| 
       61 
     | 
    
         
            -
              #      "url": "myshop.com/mixer-42"
         
     | 
| 
       62 
     | 
    
         
            -
              #    }
         
     | 
| 
       63 
     | 
    
         
            -
              #  ]
         
     | 
| 
       64 
     | 
    
         
            -
              #```
         
     | 
| 
       65 
     | 
    
         
            -
              #
         
     | 
| 
       66 
     | 
    
         
            -
              #   - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list. 
         
     | 
| 
       67 
     | 
    
         
            -
              #
         
     | 
| 
       68 
     | 
    
         
            -
              #Example response for `includedProperties=description,price`:
         
     | 
| 
       69 
     | 
    
         
            -
              #```
         
     | 
| 
       70 
     | 
    
         
            -
              #  [
         
     | 
| 
       71 
     | 
    
         
            -
              #    {
         
     | 
| 
       72 
     | 
    
         
            -
              #      "itemId": "tv-178",
         
     | 
| 
       73 
     | 
    
         
            -
              #      "description": "4K TV with 3D feature",
         
     | 
| 
       74 
     | 
    
         
            -
              #      "price": 342
         
     | 
| 
       75 
     | 
    
         
            -
              #    },
         
     | 
| 
       76 
     | 
    
         
            -
              #    {
         
     | 
| 
       77 
     | 
    
         
            -
              #      "itemId": "mixer-42",
         
     | 
| 
       78 
     | 
    
         
            -
              #      "description": "Stainless Steel Mixer",
         
     | 
| 
       79 
     | 
    
         
            -
              #      "price": 39
         
     | 
| 
       80 
     | 
    
         
            -
              #    }
         
     | 
| 
       81 
     | 
    
         
            -
              #  ]
         
     | 
| 
       82 
     | 
    
         
            -
              #```
         
     | 
| 
       83 
     | 
    
         
            -
              #
         
     | 
| 
       84 
     | 
    
         
            -
              #   - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
         
     | 
| 
       85 
     | 
    
         
            -
              #
         
     | 
| 
       86 
     | 
    
         
            -
              #   - +minRelevance+ -> **Expert option** If the *targetUserId* is provided:  Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested qualit, and may return less than *count* items when there is not enough data to fulfill it.
         
     | 
| 
       87 
     | 
    
         
            -
              #
         
     | 
| 
       88 
     | 
    
         
            -
              #   - +rotationRate+ -> **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.01`.
         
     | 
| 
       89 
     | 
    
         
            -
              #
         
     | 
| 
       90 
     | 
    
         
            -
              #   - +rotationTime+ -> **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
         
     | 
| 
       91 
     | 
    
         
            -
              #
         
     | 
| 
       92 
     | 
    
         
            -
              #   - +expertSettings+ -> Dictionary of custom options.
         
     | 
| 
       93 
     | 
    
         
            -
              #
         
     | 
| 
       94 
     | 
    
         
            -
              #
         
     | 
| 
       95 
     | 
    
         
            -
                def initialize(item_id, count, optional = {})
         
     | 
| 
       96 
     | 
    
         
            -
                  @item_id = item_id
         
     | 
| 
       97 
     | 
    
         
            -
                  @count = count
         
     | 
| 
       98 
     | 
    
         
            -
                  optional = normalize_optional(optional)
         
     | 
| 
       99 
     | 
    
         
            -
                  @target_user_id = optional['targetUserId']
         
     | 
| 
       100 
     | 
    
         
            -
                  @user_impact = optional['userImpact']
         
     | 
| 
       101 
     | 
    
         
            -
                  @filter = optional['filter']
         
     | 
| 
       102 
     | 
    
         
            -
                  @booster = optional['booster']
         
     | 
| 
       103 
     | 
    
         
            -
                  @allow_nonexistent = optional['allowNonexistent']
         
     | 
| 
       104 
     | 
    
         
            -
                  @cascade_create = optional['cascadeCreate']
         
     | 
| 
       105 
     | 
    
         
            -
                  @scenario = optional['scenario']
         
     | 
| 
       106 
     | 
    
         
            -
                  @return_properties = optional['returnProperties']
         
     | 
| 
       107 
     | 
    
         
            -
                  @included_properties = optional['includedProperties']
         
     | 
| 
       108 
     | 
    
         
            -
                  @diversity = optional['diversity']
         
     | 
| 
       109 
     | 
    
         
            -
                  @min_relevance = optional['minRelevance']
         
     | 
| 
       110 
     | 
    
         
            -
                  @rotation_rate = optional['rotationRate']
         
     | 
| 
       111 
     | 
    
         
            -
                  @rotation_time = optional['rotationTime']
         
     | 
| 
       112 
     | 
    
         
            -
                  @expert_settings = optional['expertSettings']
         
     | 
| 
       113 
     | 
    
         
            -
                  @optional = optional
         
     | 
| 
       114 
     | 
    
         
            -
                  @timeout = 3000
         
     | 
| 
       115 
     | 
    
         
            -
                  @ensure_https = false
         
     | 
| 
       116 
     | 
    
         
            -
                  @optional.each do |par, _|
         
     | 
| 
       117 
     | 
    
         
            -
                    fail UnknownOptionalParameter.new(par) unless ["targetUserId","userImpact","filter","booster","allowNonexistent","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
         
     | 
| 
       118 
     | 
    
         
            -
                  end
         
     | 
| 
       119 
     | 
    
         
            -
                end
         
     | 
| 
       120 
     | 
    
         
            -
              
         
     | 
| 
       121 
     | 
    
         
            -
                # HTTP method
         
     | 
| 
       122 
     | 
    
         
            -
                def method
         
     | 
| 
       123 
     | 
    
         
            -
                  :post
         
     | 
| 
       124 
     | 
    
         
            -
                end
         
     | 
| 
       125 
     | 
    
         
            -
              
         
     | 
| 
       126 
     | 
    
         
            -
                # Values of body parameters as a Hash
         
     | 
| 
       127 
     | 
    
         
            -
                def body_parameters
         
     | 
| 
       128 
     | 
    
         
            -
                  p = Hash.new
         
     | 
| 
       129 
     | 
    
         
            -
                  p['count'] = @count
         
     | 
| 
       130 
     | 
    
         
            -
                  p['targetUserId'] = @optional['targetUserId'] if @optional.include? 'targetUserId'
         
     | 
| 
       131 
     | 
    
         
            -
                  p['userImpact'] = @optional['userImpact'] if @optional.include? 'userImpact'
         
     | 
| 
       132 
     | 
    
         
            -
                  p['filter'] = @optional['filter'] if @optional.include? 'filter'
         
     | 
| 
       133 
     | 
    
         
            -
                  p['booster'] = @optional['booster'] if @optional.include? 'booster'
         
     | 
| 
       134 
     | 
    
         
            -
                  p['allowNonexistent'] = @optional['allowNonexistent'] if @optional.include? 'allowNonexistent'
         
     | 
| 
       135 
     | 
    
         
            -
                  p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
         
     | 
| 
       136 
     | 
    
         
            -
                  p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
         
     | 
| 
       137 
     | 
    
         
            -
                  p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
         
     | 
| 
       138 
     | 
    
         
            -
                  p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
         
     | 
| 
       139 
     | 
    
         
            -
                  p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
         
     | 
| 
       140 
     | 
    
         
            -
                  p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
         
     | 
| 
       141 
     | 
    
         
            -
                  p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
         
     | 
| 
       142 
     | 
    
         
            -
                  p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
         
     | 
| 
       143 
     | 
    
         
            -
                  p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
         
     | 
| 
       144 
     | 
    
         
            -
                  p
         
     | 
| 
       145 
     | 
    
         
            -
                end
         
     | 
| 
       146 
     | 
    
         
            -
              
         
     | 
| 
       147 
     | 
    
         
            -
                # Values of query parameters as a Hash.
         
     | 
| 
       148 
     | 
    
         
            -
                # name of parameter => value of the parameter
         
     | 
| 
       149 
     | 
    
         
            -
                def query_parameters
         
     | 
| 
       150 
     | 
    
         
            -
                  params = {}
         
     | 
| 
       151 
     | 
    
         
            -
                  params
         
     | 
| 
       152 
     | 
    
         
            -
                end
         
     | 
| 
       153 
     | 
    
         
            -
              
         
     | 
| 
       154 
     | 
    
         
            -
                # Relative path to the endpoint
         
     | 
| 
       155 
     | 
    
         
            -
                def path
         
     | 
| 
       156 
     | 
    
         
            -
                  "/{databaseId}/items/#{@item_id}/recomms/"
         
     | 
| 
       157 
     | 
    
         
            -
                end
         
     | 
| 
       158 
     | 
    
         
            -
              end
         
     | 
| 
       159 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,143 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # This file is auto-generated, do not edit
         
     | 
| 
       3 
     | 
    
         
            -
            #
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            module RecombeeApiClient
         
     | 
| 
       6 
     | 
    
         
            -
              require_relative 'request'
         
     | 
| 
       7 
     | 
    
         
            -
              require_relative '../errors'
         
     | 
| 
       8 
     | 
    
         
            -
              
         
     | 
| 
       9 
     | 
    
         
            -
              ##
         
     | 
| 
       10 
     | 
    
         
            -
              #Deprecated since version 2.0.0. Use RecommendItemsToUser request instead.
         
     | 
| 
       11 
     | 
    
         
            -
              #
         
     | 
| 
       12 
     | 
    
         
            -
              #Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user.
         
     | 
| 
       13 
     | 
    
         
            -
              #
         
     | 
| 
       14 
     | 
    
         
            -
              #It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
         
     | 
| 
       15 
     | 
    
         
            -
              #
         
     | 
| 
       16 
     | 
    
         
            -
              class UserBasedRecommendation < ApiRequest
         
     | 
| 
       17 
     | 
    
         
            -
                attr_reader :user_id, :count, :filter, :booster, :allow_nonexistent, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings
         
     | 
| 
       18 
     | 
    
         
            -
                attr_accessor :timeout
         
     | 
| 
       19 
     | 
    
         
            -
                attr_accessor :ensure_https
         
     | 
| 
       20 
     | 
    
         
            -
              
         
     | 
| 
       21 
     | 
    
         
            -
              ##
         
     | 
| 
       22 
     | 
    
         
            -
              # * *Required arguments*
         
     | 
| 
       23 
     | 
    
         
            -
              #   - +user_id+ -> ID of the user for whom the personalized recommendations are to be generated.
         
     | 
| 
       24 
     | 
    
         
            -
              #   - +count+ -> Number of items to be recommended (N for the top-N recommendation).
         
     | 
| 
       25 
     | 
    
         
            -
              #
         
     | 
| 
       26 
     | 
    
         
            -
              # * *Optional arguments (given as hash optional)*
         
     | 
| 
       27 
     | 
    
         
            -
              #   - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended items based on the values of their attributes.
         
     | 
| 
       28 
     | 
    
         
            -
              #   - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some items based on the values of their attributes.
         
     | 
| 
       29 
     | 
    
         
            -
              #   - +allowNonexistent+ -> If the user does not exist in the database, returns a list of non-personalized recommendations instead of causing HTTP 404 error. It doesn't create the user in the database.
         
     | 
| 
       30 
     | 
    
         
            -
              #   - +cascadeCreate+ -> If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows for example rotations in the following recommendations for that user, as the user will be already known to the system.
         
     | 
| 
       31 
     | 
    
         
            -
              #   - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
         
     | 
| 
       32 
     | 
    
         
            -
              #   - +returnProperties+ -> With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying of the recommended items to the user. 
         
     | 
| 
       33 
     | 
    
         
            -
              #
         
     | 
| 
       34 
     | 
    
         
            -
              #Example response:
         
     | 
| 
       35 
     | 
    
         
            -
              #```
         
     | 
| 
       36 
     | 
    
         
            -
              #  [
         
     | 
| 
       37 
     | 
    
         
            -
              #    {
         
     | 
| 
       38 
     | 
    
         
            -
              #      "itemId": "tv-178",
         
     | 
| 
       39 
     | 
    
         
            -
              #      "description": "4K TV with 3D feature",
         
     | 
| 
       40 
     | 
    
         
            -
              #      "categories":   ["Electronics", "Televisions"],
         
     | 
| 
       41 
     | 
    
         
            -
              #      "price": 342,
         
     | 
| 
       42 
     | 
    
         
            -
              #      "url": "myshop.com/tv-178"
         
     | 
| 
       43 
     | 
    
         
            -
              #    },
         
     | 
| 
       44 
     | 
    
         
            -
              #    {
         
     | 
| 
       45 
     | 
    
         
            -
              #      "itemId": "mixer-42",
         
     | 
| 
       46 
     | 
    
         
            -
              #      "description": "Stainless Steel Mixer",
         
     | 
| 
       47 
     | 
    
         
            -
              #      "categories":   ["Home & Kitchen"],
         
     | 
| 
       48 
     | 
    
         
            -
              #      "price": 39,
         
     | 
| 
       49 
     | 
    
         
            -
              #      "url": "myshop.com/mixer-42"
         
     | 
| 
       50 
     | 
    
         
            -
              #    }
         
     | 
| 
       51 
     | 
    
         
            -
              #  ]
         
     | 
| 
       52 
     | 
    
         
            -
              #```
         
     | 
| 
       53 
     | 
    
         
            -
              #
         
     | 
| 
       54 
     | 
    
         
            -
              #   - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list. 
         
     | 
| 
       55 
     | 
    
         
            -
              #
         
     | 
| 
       56 
     | 
    
         
            -
              #Example response for `includedProperties=description,price`:
         
     | 
| 
       57 
     | 
    
         
            -
              #```
         
     | 
| 
       58 
     | 
    
         
            -
              #  [
         
     | 
| 
       59 
     | 
    
         
            -
              #    {
         
     | 
| 
       60 
     | 
    
         
            -
              #      "itemId": "tv-178",
         
     | 
| 
       61 
     | 
    
         
            -
              #      "description": "4K TV with 3D feature",
         
     | 
| 
       62 
     | 
    
         
            -
              #      "price": 342
         
     | 
| 
       63 
     | 
    
         
            -
              #    },
         
     | 
| 
       64 
     | 
    
         
            -
              #    {
         
     | 
| 
       65 
     | 
    
         
            -
              #      "itemId": "mixer-42",
         
     | 
| 
       66 
     | 
    
         
            -
              #      "description": "Stainless Steel Mixer",
         
     | 
| 
       67 
     | 
    
         
            -
              #      "price": 39
         
     | 
| 
       68 
     | 
    
         
            -
              #    }
         
     | 
| 
       69 
     | 
    
         
            -
              #  ]
         
     | 
| 
       70 
     | 
    
         
            -
              #```
         
     | 
| 
       71 
     | 
    
         
            -
              #
         
     | 
| 
       72 
     | 
    
         
            -
              #   - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
         
     | 
| 
       73 
     | 
    
         
            -
              #
         
     | 
| 
       74 
     | 
    
         
            -
              #   - +minRelevance+ -> **Expert option** Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested qualit, and may return less than *count* items when there is not enough data to fulfill it.
         
     | 
| 
       75 
     | 
    
         
            -
              #
         
     | 
| 
       76 
     | 
    
         
            -
              #   - +rotationRate+ -> **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`.
         
     | 
| 
       77 
     | 
    
         
            -
              #
         
     | 
| 
       78 
     | 
    
         
            -
              #   - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
         
     | 
| 
       79 
     | 
    
         
            -
              #
         
     | 
| 
       80 
     | 
    
         
            -
              #   - +expertSettings+ -> Dictionary of custom options.
         
     | 
| 
       81 
     | 
    
         
            -
              #
         
     | 
| 
       82 
     | 
    
         
            -
              #
         
     | 
| 
       83 
     | 
    
         
            -
                def initialize(user_id, count, optional = {})
         
     | 
| 
       84 
     | 
    
         
            -
                  @user_id = user_id
         
     | 
| 
       85 
     | 
    
         
            -
                  @count = count
         
     | 
| 
       86 
     | 
    
         
            -
                  optional = normalize_optional(optional)
         
     | 
| 
       87 
     | 
    
         
            -
                  @filter = optional['filter']
         
     | 
| 
       88 
     | 
    
         
            -
                  @booster = optional['booster']
         
     | 
| 
       89 
     | 
    
         
            -
                  @allow_nonexistent = optional['allowNonexistent']
         
     | 
| 
       90 
     | 
    
         
            -
                  @cascade_create = optional['cascadeCreate']
         
     | 
| 
       91 
     | 
    
         
            -
                  @scenario = optional['scenario']
         
     | 
| 
       92 
     | 
    
         
            -
                  @return_properties = optional['returnProperties']
         
     | 
| 
       93 
     | 
    
         
            -
                  @included_properties = optional['includedProperties']
         
     | 
| 
       94 
     | 
    
         
            -
                  @diversity = optional['diversity']
         
     | 
| 
       95 
     | 
    
         
            -
                  @min_relevance = optional['minRelevance']
         
     | 
| 
       96 
     | 
    
         
            -
                  @rotation_rate = optional['rotationRate']
         
     | 
| 
       97 
     | 
    
         
            -
                  @rotation_time = optional['rotationTime']
         
     | 
| 
       98 
     | 
    
         
            -
                  @expert_settings = optional['expertSettings']
         
     | 
| 
       99 
     | 
    
         
            -
                  @optional = optional
         
     | 
| 
       100 
     | 
    
         
            -
                  @timeout = 3000
         
     | 
| 
       101 
     | 
    
         
            -
                  @ensure_https = false
         
     | 
| 
       102 
     | 
    
         
            -
                  @optional.each do |par, _|
         
     | 
| 
       103 
     | 
    
         
            -
                    fail UnknownOptionalParameter.new(par) unless ["filter","booster","allowNonexistent","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
         
     | 
| 
       104 
     | 
    
         
            -
                  end
         
     | 
| 
       105 
     | 
    
         
            -
                end
         
     | 
| 
       106 
     | 
    
         
            -
              
         
     | 
| 
       107 
     | 
    
         
            -
                # HTTP method
         
     | 
| 
       108 
     | 
    
         
            -
                def method
         
     | 
| 
       109 
     | 
    
         
            -
                  :post
         
     | 
| 
       110 
     | 
    
         
            -
                end
         
     | 
| 
       111 
     | 
    
         
            -
              
         
     | 
| 
       112 
     | 
    
         
            -
                # Values of body parameters as a Hash
         
     | 
| 
       113 
     | 
    
         
            -
                def body_parameters
         
     | 
| 
       114 
     | 
    
         
            -
                  p = Hash.new
         
     | 
| 
       115 
     | 
    
         
            -
                  p['count'] = @count
         
     | 
| 
       116 
     | 
    
         
            -
                  p['filter'] = @optional['filter'] if @optional.include? 'filter'
         
     | 
| 
       117 
     | 
    
         
            -
                  p['booster'] = @optional['booster'] if @optional.include? 'booster'
         
     | 
| 
       118 
     | 
    
         
            -
                  p['allowNonexistent'] = @optional['allowNonexistent'] if @optional.include? 'allowNonexistent'
         
     | 
| 
       119 
     | 
    
         
            -
                  p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
         
     | 
| 
       120 
     | 
    
         
            -
                  p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
         
     | 
| 
       121 
     | 
    
         
            -
                  p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
         
     | 
| 
       122 
     | 
    
         
            -
                  p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
         
     | 
| 
       123 
     | 
    
         
            -
                  p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
         
     | 
| 
       124 
     | 
    
         
            -
                  p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
         
     | 
| 
       125 
     | 
    
         
            -
                  p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
         
     | 
| 
       126 
     | 
    
         
            -
                  p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
         
     | 
| 
       127 
     | 
    
         
            -
                  p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
         
     | 
| 
       128 
     | 
    
         
            -
                  p
         
     | 
| 
       129 
     | 
    
         
            -
                end
         
     | 
| 
       130 
     | 
    
         
            -
              
         
     | 
| 
       131 
     | 
    
         
            -
                # Values of query parameters as a Hash.
         
     | 
| 
       132 
     | 
    
         
            -
                # name of parameter => value of the parameter
         
     | 
| 
       133 
     | 
    
         
            -
                def query_parameters
         
     | 
| 
       134 
     | 
    
         
            -
                  params = {}
         
     | 
| 
       135 
     | 
    
         
            -
                  params
         
     | 
| 
       136 
     | 
    
         
            -
                end
         
     | 
| 
       137 
     | 
    
         
            -
              
         
     | 
| 
       138 
     | 
    
         
            -
                # Relative path to the endpoint
         
     | 
| 
       139 
     | 
    
         
            -
                def path
         
     | 
| 
       140 
     | 
    
         
            -
                  "/{databaseId}/users/#{@user_id}/recomms/"
         
     | 
| 
       141 
     | 
    
         
            -
                end
         
     | 
| 
       142 
     | 
    
         
            -
              end
         
     | 
| 
       143 
     | 
    
         
            -
            end
         
     |