recombee_api_client 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/recombee_api_client/api/add_cart_addition.rb +8 -2
  3. data/lib/recombee_api_client/api/add_item_property.rb +1 -1
  4. data/lib/recombee_api_client/api/add_purchase.rb +11 -2
  5. data/lib/recombee_api_client/api/add_user_property.rb +1 -1
  6. data/lib/recombee_api_client/api/delete_item_property.rb +1 -1
  7. data/lib/recombee_api_client/api/delete_user_property.rb +1 -1
  8. data/lib/recombee_api_client/api/get_user_property_info.rb +1 -1
  9. data/lib/recombee_api_client/api/list_group_items.rb +1 -1
  10. data/lib/recombee_api_client/api/list_groups.rb +1 -1
  11. data/lib/recombee_api_client/api/list_item_properties.rb +1 -1
  12. data/lib/recombee_api_client/api/list_items.rb +1 -1
  13. data/lib/recombee_api_client/api/list_series.rb +1 -1
  14. data/lib/recombee_api_client/api/list_series_items.rb +1 -1
  15. data/lib/recombee_api_client/api/list_user_properties.rb +1 -1
  16. data/lib/recombee_api_client/api/list_users.rb +1 -1
  17. data/lib/recombee_api_client/api/merge_users.rb +1 -1
  18. data/lib/recombee_api_client/api/recommend_items_to_item.rb +179 -0
  19. data/lib/recombee_api_client/api/recommend_items_to_user.rb +155 -0
  20. data/lib/recombee_api_client/api/recommend_users_to_item.rb +137 -0
  21. data/lib/recombee_api_client/api/recommend_users_to_user.rb +149 -0
  22. data/lib/recombee_api_client/api/reset_database.rb +1 -1
  23. data/lib/recombee_api_client/api/set_view_portion.rb +1 -1
  24. data/lib/recombee_api_client/api/user_based_recommendation.rb +1 -1
  25. data/lib/recombee_api_client/version.rb +1 -1
  26. data/lib/recombee_api_client.rb +1 -1
  27. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f352c6ef8fe7deec30fcbe75a95f6fca0973d332
4
- data.tar.gz: 99dc6053c007b41e86ebf06cf688740a8beeb5d9
3
+ metadata.gz: 459b60d097073f0ab3172fcd183ae14560acb374
4
+ data.tar.gz: 1563a5306b4eadd16aad23ab27aeb438046688e9
5
5
  SHA512:
6
- metadata.gz: d39f7acd6fffaa2a2de295959845b5444a240d31f5639314c05e6e23b4752fbe7d57bba46236e7e47b3dd8f17498cf748d54df3a88f6438158b96415d383bdbc
7
- data.tar.gz: a57d0ca06bced0c0b5ccfcb384c308d0323e27637011e37d0a60824fab90ac4a26a4f550ddf1c273e0690cbb070a3070a294ec6593d7dbc5b099d9a1ced0b27a
6
+ metadata.gz: 722df39fe6db7183b6a488b166a0776998205dc6322863b2039f225c9c73dc62b7dc2e307dbefc7987d3565f7f32a87bb009f4719f89974ac7480e38b3265134
7
+ data.tar.gz: 724dc7c636925783e632a3b5573c624bc18b567174e63a98ecd428c328fe35e8f62a57774b8be74a367c280cc736db37d6c0086be0837dc7c164878e35cec89c
@@ -10,7 +10,7 @@ module RecombeeApiClient
10
10
  #Adds a cart addition of a given item made by a given user.
11
11
  #
12
12
  class AddCartAddition < ApiRequest
13
- attr_reader :user_id, :item_id, :timestamp, :cascade_create
13
+ attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price
14
14
  attr_accessor :timeout
15
15
  attr_accessor :ensure_https
16
16
 
@@ -22,17 +22,21 @@ module RecombeeApiClient
22
22
  # * *Optional arguments (given as hash optional)*
23
23
  # - +timestamp+ -> UTC timestamp of the cart addition as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
24
24
  # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
25
+ # - +amount+ -> Amount (number) added to cart. The default is 1. For example if `user-x` adds two `item-y` during a single order (session...), the `amount` should equal to 2.
26
+ # - +price+ -> Price of the added item. If `amount` is greater than 1, sum of prices of all the items should be given.
25
27
  #
26
28
  def initialize(user_id, item_id, optional = {})
27
29
  @user_id = user_id
28
30
  @item_id = item_id
29
31
  @timestamp = optional['timestamp']
30
32
  @cascade_create = optional['cascadeCreate']
33
+ @amount = optional['amount']
34
+ @price = optional['price']
31
35
  @optional = optional
32
36
  @timeout = 1000
33
37
  @ensure_https = false
34
38
  @optional.each do |par, _|
35
- fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate"].include? par
39
+ fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price"].include? par
36
40
  end
37
41
  end
38
42
 
@@ -48,6 +52,8 @@ module RecombeeApiClient
48
52
  p['itemId'] = @item_id
49
53
  p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
50
54
  p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
55
+ p['amount'] = @optional['amount'] if @optional.include? 'amount'
56
+ p['price'] = @optional['price'] if @optional.include? 'price'
51
57
  p
52
58
  end
53
59
 
@@ -24,7 +24,7 @@ module RecombeeApiClient
24
24
  def initialize(property_name, type)
25
25
  @property_name = property_name
26
26
  @type = type
27
- @timeout = 1000
27
+ @timeout = 100000
28
28
  @ensure_https = false
29
29
  end
30
30
 
@@ -10,7 +10,7 @@ module RecombeeApiClient
10
10
  #Adds a purchase of a given item made by a given user.
11
11
  #
12
12
  class AddPurchase < ApiRequest
13
- attr_reader :user_id, :item_id, :timestamp, :cascade_create
13
+ attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :profit
14
14
  attr_accessor :timeout
15
15
  attr_accessor :ensure_https
16
16
 
@@ -22,17 +22,23 @@ module RecombeeApiClient
22
22
  # * *Optional arguments (given as hash optional)*
23
23
  # - +timestamp+ -> UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
24
24
  # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
25
+ # - +amount+ -> Amount (number) of purchased items. The default is 1. For example if `user-x` purchases two `item-y` during a single order (session...), the `amount` should equal to 2.
26
+ # - +price+ -> Price paid by the user for the item. If `amount` is greater than 1, sum of prices of all the items should be given.
27
+ # - +profit+ -> Your profit from the purchased item. The profit is natural in e-commerce domain (for example if `user-x` purchases `item-y` for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If `amount` is greater than 1, sum of profit of all the items should be given.
25
28
  #
26
29
  def initialize(user_id, item_id, optional = {})
27
30
  @user_id = user_id
28
31
  @item_id = item_id
29
32
  @timestamp = optional['timestamp']
30
33
  @cascade_create = optional['cascadeCreate']
34
+ @amount = optional['amount']
35
+ @price = optional['price']
36
+ @profit = optional['profit']
31
37
  @optional = optional
32
38
  @timeout = 1000
33
39
  @ensure_https = false
34
40
  @optional.each do |par, _|
35
- fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate"].include? par
41
+ fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","profit"].include? par
36
42
  end
37
43
  end
38
44
 
@@ -48,6 +54,9 @@ module RecombeeApiClient
48
54
  p['itemId'] = @item_id
49
55
  p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
50
56
  p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
57
+ p['amount'] = @optional['amount'] if @optional.include? 'amount'
58
+ p['price'] = @optional['price'] if @optional.include? 'price'
59
+ p['profit'] = @optional['profit'] if @optional.include? 'profit'
51
60
  p
52
61
  end
53
62
 
@@ -24,7 +24,7 @@ module RecombeeApiClient
24
24
  def initialize(property_name, type)
25
25
  @property_name = property_name
26
26
  @type = type
27
- @timeout = 1000
27
+ @timeout = 100000
28
28
  @ensure_https = false
29
29
  end
30
30
 
@@ -20,7 +20,7 @@ module RecombeeApiClient
20
20
  #
21
21
  def initialize(property_name)
22
22
  @property_name = property_name
23
- @timeout = 1000
23
+ @timeout = 100000
24
24
  @ensure_https = false
25
25
  end
26
26
 
@@ -20,7 +20,7 @@ module RecombeeApiClient
20
20
  #
21
21
  def initialize(property_name)
22
22
  @property_name = property_name
23
- @timeout = 1000
23
+ @timeout = 100000
24
24
  @ensure_https = false
25
25
  end
26
26
 
@@ -20,7 +20,7 @@ module RecombeeApiClient
20
20
  #
21
21
  def initialize(property_name)
22
22
  @property_name = property_name
23
- @timeout = 1000
23
+ @timeout = 100000
24
24
  @ensure_https = false
25
25
  end
26
26
 
@@ -19,7 +19,7 @@ module RecombeeApiClient
19
19
  #
20
20
  def initialize(group_id)
21
21
  @group_id = group_id
22
- @timeout = 1000
22
+ @timeout = 100000
23
23
  @ensure_https = false
24
24
  end
25
25
 
@@ -16,7 +16,7 @@ module RecombeeApiClient
16
16
  ##
17
17
  #
18
18
  def initialize()
19
- @timeout = 239000
19
+ @timeout = 100000
20
20
  @ensure_https = false
21
21
  end
22
22
 
@@ -17,7 +17,7 @@ module RecombeeApiClient
17
17
  ##
18
18
  #
19
19
  def initialize()
20
- @timeout = 1000
20
+ @timeout = 100000
21
21
  @ensure_https = false
22
22
  end
23
23
 
@@ -67,7 +67,7 @@ module RecombeeApiClient
67
67
  @return_properties = optional['returnProperties']
68
68
  @included_properties = optional['includedProperties']
69
69
  @optional = optional
70
- @timeout = 600000
70
+ @timeout = 100000
71
71
  @ensure_https = false
72
72
  @optional.each do |par, _|
73
73
  fail UnknownOptionalParameter.new(par) unless ["filter","count","offset","returnProperties","includedProperties"].include? par
@@ -16,7 +16,7 @@ module RecombeeApiClient
16
16
  ##
17
17
  #
18
18
  def initialize()
19
- @timeout = 239000
19
+ @timeout = 100000
20
20
  @ensure_https = false
21
21
  end
22
22
 
@@ -19,7 +19,7 @@ module RecombeeApiClient
19
19
  #
20
20
  def initialize(series_id)
21
21
  @series_id = series_id
22
- @timeout = 1000
22
+ @timeout = 100000
23
23
  @ensure_https = false
24
24
  end
25
25
 
@@ -17,7 +17,7 @@ module RecombeeApiClient
17
17
  ##
18
18
  #
19
19
  def initialize()
20
- @timeout = 1000
20
+ @timeout = 100000
21
21
  @ensure_https = false
22
22
  end
23
23
 
@@ -61,7 +61,7 @@ module RecombeeApiClient
61
61
  @return_properties = optional['returnProperties']
62
62
  @included_properties = optional['includedProperties']
63
63
  @optional = optional
64
- @timeout = 239000
64
+ @timeout = 100000
65
65
  @ensure_https = false
66
66
  @optional.each do |par, _|
67
67
  fail UnknownOptionalParameter.new(par) unless ["filter","count","offset","returnProperties","includedProperties"].include? par
@@ -7,7 +7,7 @@ module RecombeeApiClient
7
7
  require_relative '../errors'
8
8
 
9
9
  ##
10
- #Merges purchases, ratings, bookmarks, and detail views of two different users under a single user ID. This is especially useful for online e-commerce applications working with anonymous users identified by unique tokens such as the session ID. In such applications, it may often happen that a user owns a persistent account, yet accesses the system anonymously while, e.g., putting items into a shopping cart. At some point in time, such as when the user wishes to confirm the purchase, (s)he logs into the system using his/her username and password. The interactions made under anonymous session ID then become connected with the persistent account, and merging these two together becomes desirable.
10
+ #Merges interactions (purchases, ratings, bookmarks, detail views ...) of two different users under a single user ID. This is especially useful for online e-commerce applications working with anonymous users identified by unique tokens such as the session ID. In such applications, it may often happen that a user owns a persistent account, yet accesses the system anonymously while, e.g., putting items into a shopping cart. At some point in time, such as when the user wishes to confirm the purchase, (s)he logs into the system using his/her username and password. The interactions made under anonymous session ID then become connected with the persistent account, and merging these two together becomes desirable.
11
11
  #
12
12
  #
13
13
  #Merging happens between two users referred to as the *target* and the *source*. After the merge, all the interactions of the source user are attributed to the target user, and the source user is **deleted** unless special parameter `keepSourceUser` is set `true`.
@@ -0,0 +1,179 @@
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
+ #This feature is currently in beta.
11
+ #
12
+ #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.
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 RecommendItemsToItem < ApiRequest
17
+ attr_reader :item_id, :target_user_id, :count, :user_impact, :filter, :booster, :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
+ # - +target_user_id+ -> ID of the user who will see the recommendations.
25
+ #
26
+ #Specifying the *targetUserId* is beneficial because:
27
+ #
28
+ #* It makes the recommendations personalized
29
+ #* Allows the calculation of Actions and Conversions
30
+ # in the graphical user interface,
31
+ # as Recombee can pair the user who got recommendations
32
+ # and who afterwards viewed/purchased an item.
33
+ #
34
+ #If you insist on not specifying the user, pass `null`
35
+ #(`None`, `nil`, `NULL` etc. depending on language) to *targetUserId*.
36
+ #Do not create some special dummy user for getting recommendations,
37
+ #as it could cause mislead the recommendation models,
38
+ #leading to wrong recommendations.
39
+ #
40
+ #For anonymous/unregistered users it is possible to use for example their session ID.
41
+ #
42
+ # - +count+ -> Number of items to be recommended (N for the top-N recommendation).
43
+ #
44
+ # * *Optional arguments (given as hash optional)*
45
+ # - +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`.
46
+ #
47
+ # - +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.
48
+ # - +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.
49
+ # - +cascadeCreate+ -> If item of given *itemId* or user of given *targetUserId* doesn't exist in the database, it creates the missing entity/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.
50
+ # - +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.
51
+ # - +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.
52
+ #
53
+ #Example response:
54
+ #```
55
+ # {
56
+ # "recommId": "8ac80708afe9148130528757ebf6aaba",
57
+ # "recomms":
58
+ # [
59
+ # {
60
+ # "id": "tv-178",
61
+ # "values": {
62
+ # "description": "4K TV with 3D feature",
63
+ # "categories": ["Electronics", "Televisions"],
64
+ # "price": 342,
65
+ # "url": "myshop.com/tv-178"
66
+ # }
67
+ # },
68
+ # {
69
+ # "id": "mixer-42",
70
+ # "values": {
71
+ # "description": "Stainless Steel Mixer",
72
+ # "categories": ["Home & Kitchen"],
73
+ # "price": 39,
74
+ # "url": "myshop.com/mixer-42"
75
+ # }
76
+ # }
77
+ # ]
78
+ # }
79
+ #```
80
+ #
81
+ # - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
82
+ #
83
+ #Example response for `includedProperties=description,price`:
84
+ #```
85
+ # {
86
+ # "recommId": "c7dbfc503d262b80b77b4949ee9855fb",
87
+ # "recomms":
88
+ # [
89
+ # {
90
+ # "id": "tv-178",
91
+ # "values": {
92
+ # "description": "4K TV with 3D feature",
93
+ # "price": 342
94
+ # }
95
+ # },
96
+ # {
97
+ # "id": "mixer-42",
98
+ # "values": {
99
+ # "description": "Stainless Steel Mixer",
100
+ # "price": 39
101
+ # }
102
+ # }
103
+ # ]
104
+ # }
105
+ #```
106
+ #
107
+ # - +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.
108
+ #
109
+ # - +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 relevancy, and may return less than *count* items when there is not enough data to fulfill it.
110
+ #
111
+ # - +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.
112
+ #
113
+ # - +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.
114
+ #
115
+ # - +expertSettings+ -> Dictionary of custom options.
116
+ #
117
+ #
118
+ def initialize(item_id, target_user_id, count, optional = {})
119
+ @item_id = item_id
120
+ @target_user_id = target_user_id
121
+ @count = count
122
+ @user_impact = optional['userImpact']
123
+ @filter = optional['filter']
124
+ @booster = optional['booster']
125
+ @cascade_create = optional['cascadeCreate']
126
+ @scenario = optional['scenario']
127
+ @return_properties = optional['returnProperties']
128
+ @included_properties = optional['includedProperties']
129
+ @diversity = optional['diversity']
130
+ @min_relevance = optional['minRelevance']
131
+ @rotation_rate = optional['rotationRate']
132
+ @rotation_time = optional['rotationTime']
133
+ @expert_settings = optional['expertSettings']
134
+ @optional = optional
135
+ @timeout = 3000
136
+ @ensure_https = false
137
+ @optional.each do |par, _|
138
+ fail UnknownOptionalParameter.new(par) unless ["userImpact","filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
139
+ end
140
+ end
141
+
142
+ # HTTP method
143
+ def method
144
+ :post
145
+ end
146
+
147
+ # Values of body parameters as a Hash
148
+ def body_parameters
149
+ p = Hash.new
150
+ p['targetUserId'] = @target_user_id
151
+ p['count'] = @count
152
+ p['userImpact'] = @optional['userImpact'] if @optional.include? 'userImpact'
153
+ p['filter'] = @optional['filter'] if @optional.include? 'filter'
154
+ p['booster'] = @optional['booster'] if @optional.include? 'booster'
155
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
156
+ p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
157
+ p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
158
+ p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
159
+ p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
160
+ p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
161
+ p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
162
+ p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
163
+ p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
164
+ p
165
+ end
166
+
167
+ # Values of query parameters as a Hash.
168
+ # name of parameter => value of the parameter
169
+ def query_parameters
170
+ params = {}
171
+ params
172
+ end
173
+
174
+ # Relative path to the endpoint
175
+ def path
176
+ "/{databaseId}/recomms/items/#{@item_id}/items/"
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,155 @@
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
+ #This feature is currently in beta.
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 RecommendItemsToUser < ApiRequest
17
+ attr_reader :user_id, :count, :filter, :booster, :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 which 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
+ # - +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.
30
+ # - +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.
31
+ # - +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.
32
+ #
33
+ #Example response:
34
+ #```
35
+ # {
36
+ # "recommId": "1644e7b31759a08480da5f3b0a13045b",
37
+ # "recomms":
38
+ # [
39
+ # {
40
+ # "id": "tv-178",
41
+ # "values": {
42
+ # "description": "4K TV with 3D feature",
43
+ # "categories": ["Electronics", "Televisions"],
44
+ # "price": 342,
45
+ # "url": "myshop.com/tv-178"
46
+ # }
47
+ # },
48
+ # {
49
+ # "id": "mixer-42",
50
+ # "values": {
51
+ # "description": "Stainless Steel Mixer",
52
+ # "categories": ["Home & Kitchen"],
53
+ # "price": 39,
54
+ # "url": "myshop.com/mixer-42"
55
+ # }
56
+ # }
57
+ # ]
58
+ # }
59
+ #```
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.
62
+ #
63
+ #Example response for `includedProperties=description,price`:
64
+ #```
65
+ # {
66
+ # "recommId": "e3ba43af1a4e59dd08a00adced1729a7",
67
+ # "recomms":
68
+ # [
69
+ # {
70
+ # "id": "tv-178",
71
+ # "values": {
72
+ # "description": "4K TV with 3D feature",
73
+ # "price": 342
74
+ # }
75
+ # },
76
+ # {
77
+ # "id": "mixer-42",
78
+ # "values": {
79
+ # "description": "Stainless Steel Mixer",
80
+ # "price": 39
81
+ # }
82
+ # }
83
+ # ]
84
+ # }
85
+ #```
86
+ #
87
+ # - +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.
88
+ #
89
+ # - +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 relevancy, and may return less than *count* items when there is not enough data to fulfill it.
90
+ #
91
+ # - +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.
92
+ #
93
+ # - +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.
94
+ #
95
+ # - +expertSettings+ -> Dictionary of custom options.
96
+ #
97
+ #
98
+ def initialize(user_id, count, optional = {})
99
+ @user_id = user_id
100
+ @count = count
101
+ @filter = optional['filter']
102
+ @booster = optional['booster']
103
+ @cascade_create = optional['cascadeCreate']
104
+ @scenario = optional['scenario']
105
+ @return_properties = optional['returnProperties']
106
+ @included_properties = optional['includedProperties']
107
+ @diversity = optional['diversity']
108
+ @min_relevance = optional['minRelevance']
109
+ @rotation_rate = optional['rotationRate']
110
+ @rotation_time = optional['rotationTime']
111
+ @expert_settings = optional['expertSettings']
112
+ @optional = optional
113
+ @timeout = 3000
114
+ @ensure_https = false
115
+ @optional.each do |par, _|
116
+ fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
117
+ end
118
+ end
119
+
120
+ # HTTP method
121
+ def method
122
+ :post
123
+ end
124
+
125
+ # Values of body parameters as a Hash
126
+ def body_parameters
127
+ p = Hash.new
128
+ p['count'] = @count
129
+ p['filter'] = @optional['filter'] if @optional.include? 'filter'
130
+ p['booster'] = @optional['booster'] if @optional.include? 'booster'
131
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
132
+ p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
133
+ p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
134
+ p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
135
+ p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
136
+ p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
137
+ p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
138
+ p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
139
+ p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
140
+ p
141
+ end
142
+
143
+ # Values of query parameters as a Hash.
144
+ # name of parameter => value of the parameter
145
+ def query_parameters
146
+ params = {}
147
+ params
148
+ end
149
+
150
+ # Relative path to the endpoint
151
+ def path
152
+ "/{databaseId}/recomms/users/#{@user_id}/items/"
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,137 @@
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
+ #This feature is currently in beta.
11
+ #
12
+ #Recommend users that are likely to be interested in a given item.
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 RecommendUsersToItem < ApiRequest
17
+ attr_reader :item_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :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
+ # - +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
+ # - +cascadeCreate+ -> If item of given *itemId* doesn't exist in the database, it creates the missing item.
30
+ # - +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.
31
+ # - +returnProperties+ -> With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying the recommended users.
32
+ #
33
+ #Example response:
34
+ #```
35
+ # {
36
+ # "recommId": "9eeebc318508302529e3241f4570834d",
37
+ # "recomms":
38
+ # [
39
+ # {
40
+ # "id": "user-17",
41
+ # "values": {
42
+ # "country": "US",
43
+ # "sex": "F"
44
+ # }
45
+ # },
46
+ # {
47
+ # "id": "user-2",
48
+ # "values": {
49
+ # "country": "CAN",
50
+ # "sex": "M"
51
+ # }
52
+ # }
53
+ # ]
54
+ # }
55
+ #```
56
+ #
57
+ # - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
58
+ #
59
+ #Example response for `includedProperties=country`:
60
+ #```
61
+ # {
62
+ # "recommId": "d4c826635efc3e01a83470008c5697f1",
63
+ # "recomms":
64
+ # [
65
+ # {
66
+ # "id": "user-17",
67
+ # "values": {
68
+ # "country": "US"
69
+ # }
70
+ # },
71
+ # {
72
+ # "id": "user-2",
73
+ # "values": {
74
+ # "country": "CAN"
75
+ # }
76
+ # }
77
+ # ]
78
+ # }
79
+ #```
80
+ #
81
+ # - +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.
82
+ #
83
+ # - +expertSettings+ -> Dictionary of custom options.
84
+ #
85
+ #
86
+ def initialize(item_id, count, optional = {})
87
+ @item_id = item_id
88
+ @count = count
89
+ @filter = optional['filter']
90
+ @booster = optional['booster']
91
+ @cascade_create = optional['cascadeCreate']
92
+ @scenario = optional['scenario']
93
+ @return_properties = optional['returnProperties']
94
+ @included_properties = optional['includedProperties']
95
+ @diversity = optional['diversity']
96
+ @expert_settings = optional['expertSettings']
97
+ @optional = optional
98
+ @timeout = 3000
99
+ @ensure_https = false
100
+ @optional.each do |par, _|
101
+ fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","expertSettings"].include? par
102
+ end
103
+ end
104
+
105
+ # HTTP method
106
+ def method
107
+ :post
108
+ end
109
+
110
+ # Values of body parameters as a Hash
111
+ def body_parameters
112
+ p = Hash.new
113
+ p['count'] = @count
114
+ p['filter'] = @optional['filter'] if @optional.include? 'filter'
115
+ p['booster'] = @optional['booster'] if @optional.include? 'booster'
116
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
117
+ p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
118
+ p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
119
+ p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
120
+ p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
121
+ p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
122
+ p
123
+ end
124
+
125
+ # Values of query parameters as a Hash.
126
+ # name of parameter => value of the parameter
127
+ def query_parameters
128
+ params = {}
129
+ params
130
+ end
131
+
132
+ # Relative path to the endpoint
133
+ def path
134
+ "/{databaseId}/recomms/items/#{@item_id}/users/"
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,149 @@
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
+ #This feature is currently in beta.
11
+ #
12
+ #Get similar users as some given user, based on the user's past interactions (purchases, ratings, etc.) and values of properties.
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 RecommendUsersToUser < ApiRequest
17
+ attr_reader :user_id, :count, :filter, :booster, :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+ -> User to which we find similar users
24
+ # - +count+ -> Number of users 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 users 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 users based on the values of their attributes.
29
+ # - +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.
30
+ # - +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.
31
+ # - +returnProperties+ -> With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying the recommended users.
32
+ #
33
+ #Example response:
34
+ #```
35
+ # {
36
+ # "recommId": "32fc671480eb29d843e47def43503992",
37
+ # "recomms":
38
+ # [
39
+ # {
40
+ # "id": "user-17",
41
+ # "values": {
42
+ # "country": "US",
43
+ # "sex": "F"
44
+ # }
45
+ # },
46
+ # {
47
+ # "id": "user-2",
48
+ # "values": {
49
+ # "country": "CAN",
50
+ # "sex": "M"
51
+ # }
52
+ # }
53
+ # ]
54
+ # }
55
+ #```
56
+ #
57
+ # - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
58
+ #
59
+ #Example response for `includedProperties=country`:
60
+ #```
61
+ # {
62
+ # "recommId": "27d81ade643621f45cc6ba5d30d7d683",
63
+ # "recomms":
64
+ # [
65
+ # {
66
+ # "id": "user-17",
67
+ # "values": {
68
+ # "country": "US"
69
+ # }
70
+ # },
71
+ # {
72
+ # "id": "user-2",
73
+ # "values": {
74
+ # "country": "CAN"
75
+ # }
76
+ # }
77
+ # ]
78
+ # }
79
+ #```
80
+ #
81
+ # - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended users be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
82
+ #
83
+ # - +minRelevance+ -> **Expert option** Specifies the threshold of how much relevant must the recommended users be. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of users equal to *count* at any cost. If there are not enough data (such as interactions or user 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 users of at least the requested relevancy, and may return less than *count* users when there is not enough data to fulfill it.
84
+ #
85
+ # - +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 user 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 users.
86
+ #
87
+ # - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an user to recover from the penalization. For example, `rotationTime=7200.0` means that users recommended less than 2 hours ago are penalized.
88
+ #
89
+ # - +expertSettings+ -> Dictionary of custom options.
90
+ #
91
+ #
92
+ def initialize(user_id, count, optional = {})
93
+ @user_id = user_id
94
+ @count = count
95
+ @filter = optional['filter']
96
+ @booster = optional['booster']
97
+ @cascade_create = optional['cascadeCreate']
98
+ @scenario = optional['scenario']
99
+ @return_properties = optional['returnProperties']
100
+ @included_properties = optional['includedProperties']
101
+ @diversity = optional['diversity']
102
+ @min_relevance = optional['minRelevance']
103
+ @rotation_rate = optional['rotationRate']
104
+ @rotation_time = optional['rotationTime']
105
+ @expert_settings = optional['expertSettings']
106
+ @optional = optional
107
+ @timeout = 3000
108
+ @ensure_https = false
109
+ @optional.each do |par, _|
110
+ fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
111
+ end
112
+ end
113
+
114
+ # HTTP method
115
+ def method
116
+ :post
117
+ end
118
+
119
+ # Values of body parameters as a Hash
120
+ def body_parameters
121
+ p = Hash.new
122
+ p['count'] = @count
123
+ p['filter'] = @optional['filter'] if @optional.include? 'filter'
124
+ p['booster'] = @optional['booster'] if @optional.include? 'booster'
125
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
126
+ p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
127
+ p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
128
+ p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
129
+ p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
130
+ p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
131
+ p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
132
+ p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
133
+ p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
134
+ p
135
+ end
136
+
137
+ # Values of query parameters as a Hash.
138
+ # name of parameter => value of the parameter
139
+ def query_parameters
140
+ params = {}
141
+ params
142
+ end
143
+
144
+ # Relative path to the endpoint
145
+ def path
146
+ "/{databaseId}/recomms/users/#{@user_id}/users/"
147
+ end
148
+ end
149
+ end
@@ -17,7 +17,7 @@ module RecombeeApiClient
17
17
  ##
18
18
  #
19
19
  def initialize()
20
- @timeout = 239000
20
+ @timeout = 100000
21
21
  @ensure_https = false
22
22
  end
23
23
 
@@ -13,7 +13,7 @@ module RecombeeApiClient
13
13
  #If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.
14
14
  #
15
15
  class SetViewPortion < ApiRequest
16
- attr_reader :user_id, :item_id, :session_id, :timestamp, :portion, :cascade_create
16
+ attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create
17
17
  attr_accessor :timeout
18
18
  attr_accessor :ensure_https
19
19
 
@@ -18,7 +18,7 @@ module RecombeeApiClient
18
18
 
19
19
  ##
20
20
  # * *Required arguments*
21
- # - +user_id+ -> ID of the user whose personalized recommendations are to be generated.
21
+ # - +user_id+ -> ID of the user for which the personalized recommendations are to be generated.
22
22
  # - +count+ -> Number of items to be recommended (N for the top-N recommendation).
23
23
  #
24
24
  # * *Optional arguments (given as hash optional)*
@@ -1,3 +1,3 @@
1
1
  module RecombeeApiClient
2
- VERSION = '1.5.0'
2
+ VERSION = '1.6.0'
3
3
  end
@@ -18,7 +18,7 @@ module RecombeeApiClient
18
18
  include HTTParty
19
19
 
20
20
  BATCH_MAX_SIZE = 10000
21
- USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/1.5.0'}
21
+ USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/1.6.0'}
22
22
 
23
23
  ##
24
24
  # - +account+ -> Name of your account at Recombee
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: 1.5.0
4
+ version: 1.6.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: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -144,6 +144,10 @@ files:
144
144
  - lib/recombee_api_client/api/list_user_view_portions.rb
145
145
  - lib/recombee_api_client/api/list_users.rb
146
146
  - lib/recombee_api_client/api/merge_users.rb
147
+ - lib/recombee_api_client/api/recommend_items_to_item.rb
148
+ - lib/recombee_api_client/api/recommend_items_to_user.rb
149
+ - lib/recombee_api_client/api/recommend_users_to_item.rb
150
+ - lib/recombee_api_client/api/recommend_users_to_user.rb
147
151
  - lib/recombee_api_client/api/remove_from_group.rb
148
152
  - lib/recombee_api_client/api/remove_from_series.rb
149
153
  - lib/recombee_api_client/api/request.rb