recombee_api_client 5.1.0 → 6.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 +4 -4
- data/lib/recombee_api_client/api/add_bookmark.rb +26 -26
- data/lib/recombee_api_client/api/add_cart_addition.rb +28 -28
- data/lib/recombee_api_client/api/add_detail_view.rb +32 -28
- data/lib/recombee_api_client/api/add_item.rb +15 -18
- data/lib/recombee_api_client/api/add_item_property.rb +34 -35
- data/lib/recombee_api_client/api/add_manual_reql_segment.rb +26 -27
- data/lib/recombee_api_client/api/add_purchase.rb +29 -29
- data/lib/recombee_api_client/api/add_rating.rb +27 -27
- data/lib/recombee_api_client/api/add_search_synonym.rb +29 -30
- data/lib/recombee_api_client/api/add_series.rb +20 -21
- data/lib/recombee_api_client/api/add_user.rb +14 -17
- data/lib/recombee_api_client/api/add_user_property.rb +30 -31
- data/lib/recombee_api_client/api/batch.rb +12 -16
- data/lib/recombee_api_client/api/composite_recommendation.rb +132 -0
- data/lib/recombee_api_client/api/create_auto_reql_segmentation.rb +29 -30
- data/lib/recombee_api_client/api/create_manual_reql_segmentation.rb +27 -28
- data/lib/recombee_api_client/api/create_property_based_segmentation.rb +30 -31
- data/lib/recombee_api_client/api/delete_all_search_synonyms.rb +15 -19
- data/lib/recombee_api_client/api/delete_bookmark.rb +21 -22
- data/lib/recombee_api_client/api/delete_cart_addition.rb +21 -22
- data/lib/recombee_api_client/api/delete_detail_view.rb +21 -22
- data/lib/recombee_api_client/api/delete_item.rb +16 -19
- data/lib/recombee_api_client/api/delete_item_property.rb +15 -18
- data/lib/recombee_api_client/api/delete_manual_reql_segment.rb +16 -19
- data/lib/recombee_api_client/api/delete_more_items.rb +18 -19
- data/lib/recombee_api_client/api/delete_purchase.rb +21 -22
- data/lib/recombee_api_client/api/delete_rating.rb +21 -22
- data/lib/recombee_api_client/api/delete_search_synonym.rb +15 -18
- data/lib/recombee_api_client/api/delete_segmentation.rb +15 -18
- data/lib/recombee_api_client/api/delete_series.rb +21 -22
- data/lib/recombee_api_client/api/delete_user.rb +15 -18
- data/lib/recombee_api_client/api/delete_user_property.rb +15 -18
- data/lib/recombee_api_client/api/delete_view_portion.rb +21 -22
- data/lib/recombee_api_client/api/get_item_property_info.rb +14 -17
- data/lib/recombee_api_client/api/get_item_values.rb +15 -18
- data/lib/recombee_api_client/api/get_segmentation.rb +15 -18
- data/lib/recombee_api_client/api/get_user_property_info.rb +15 -18
- data/lib/recombee_api_client/api/get_user_values.rb +15 -18
- data/lib/recombee_api_client/api/insert_to_series.rb +23 -24
- data/lib/recombee_api_client/api/list_item_bookmarks.rb +16 -19
- data/lib/recombee_api_client/api/list_item_cart_additions.rb +16 -19
- data/lib/recombee_api_client/api/list_item_detail_views.rb +16 -19
- data/lib/recombee_api_client/api/list_item_properties.rb +15 -19
- data/lib/recombee_api_client/api/list_item_purchases.rb +16 -19
- data/lib/recombee_api_client/api/list_item_ratings.rb +16 -19
- data/lib/recombee_api_client/api/list_item_view_portions.rb +16 -19
- data/lib/recombee_api_client/api/list_items.rb +62 -62
- data/lib/recombee_api_client/api/list_scenarios.rb +15 -19
- data/lib/recombee_api_client/api/list_search_synonyms.rb +20 -21
- data/lib/recombee_api_client/api/list_segmentations.rb +16 -17
- data/lib/recombee_api_client/api/list_series.rb +15 -19
- data/lib/recombee_api_client/api/list_series_items.rb +15 -18
- data/lib/recombee_api_client/api/list_user_bookmarks.rb +15 -18
- data/lib/recombee_api_client/api/list_user_cart_additions.rb +15 -18
- data/lib/recombee_api_client/api/list_user_detail_views.rb +15 -18
- data/lib/recombee_api_client/api/list_user_properties.rb +15 -19
- data/lib/recombee_api_client/api/list_user_purchases.rb +15 -18
- data/lib/recombee_api_client/api/list_user_ratings.rb +15 -18
- data/lib/recombee_api_client/api/list_user_view_portions.rb +15 -18
- data/lib/recombee_api_client/api/list_users.rb +56 -56
- data/lib/recombee_api_client/api/merge_users.rb +24 -25
- data/lib/recombee_api_client/api/recommend_item_segments_to_item.rb +69 -68
- data/lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb +70 -69
- data/lib/recombee_api_client/api/recommend_item_segments_to_user.rb +51 -50
- data/lib/recombee_api_client/api/recommend_items_to_item.rb +185 -139
- data/lib/recombee_api_client/api/recommend_items_to_item_segment.rb +181 -138
- data/lib/recombee_api_client/api/recommend_items_to_user.rb +165 -122
- data/lib/recombee_api_client/api/recommend_next_items.rb +24 -25
- data/lib/recombee_api_client/api/recommend_users_to_item.rb +151 -105
- data/lib/recombee_api_client/api/recommend_users_to_user.rb +154 -111
- data/lib/recombee_api_client/api/remove_from_series.rb +17 -18
- data/lib/recombee_api_client/api/request.rb +1 -1
- data/lib/recombee_api_client/api/reset_database.rb +15 -19
- data/lib/recombee_api_client/api/search_item_segments.rb +52 -51
- data/lib/recombee_api_client/api/search_items.rb +157 -114
- data/lib/recombee_api_client/api/set_item_values.rb +28 -29
- data/lib/recombee_api_client/api/set_user_values.rb +21 -22
- data/lib/recombee_api_client/api/set_values.rb +28 -28
- data/lib/recombee_api_client/api/set_view_portion.rb +37 -30
- data/lib/recombee_api_client/api/update_auto_reql_segmentation.rb +26 -27
- data/lib/recombee_api_client/api/update_manual_reql_segment.rb +25 -26
- data/lib/recombee_api_client/api/update_manual_reql_segmentation.rb +24 -25
- data/lib/recombee_api_client/api/update_more_items.rb +19 -20
- data/lib/recombee_api_client/api/update_property_based_segmentation.rb +26 -27
- data/lib/recombee_api_client/errors.rb +2 -5
- data/lib/recombee_api_client/inputs/composite_recommendation_stage_parameters.rb +240 -0
- data/lib/recombee_api_client/inputs/input.rb +9 -0
- data/lib/recombee_api_client/inputs/logic.rb +45 -0
- data/lib/recombee_api_client/utils/hash_normalizer.rb +21 -0
- data/lib/recombee_api_client/version.rb +1 -1
- data/lib/recombee_api_client.rb +40 -35
- data/recombee_api_client.gemspec +2 -3
- metadata +14 -10
- data/lib/recombee_api_client/api/hash_normalizer.rb +0 -21
|
@@ -5,131 +5,171 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Based on the user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for the given user.
|
|
10
|
+
# Based on the user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for the given user.
|
|
11
11
|
#
|
|
12
|
-
#The most typical use cases are recommendations on the homepage, in some "Picked just for you" section, or in email.
|
|
12
|
+
# The most typical use cases are recommendations on the homepage, in some "Picked just for you" section, or in email.
|
|
13
13
|
#
|
|
14
|
-
#The returned items are sorted by relevance (the first item being the most relevant).
|
|
14
|
+
# The returned items are sorted by relevance (the first item being the most relevant).
|
|
15
15
|
#
|
|
16
|
-
#Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
|
|
16
|
+
# Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
|
|
17
17
|
#
|
|
18
|
-
|
|
19
|
-
|
|
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#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#recommend-next-items).
|
|
20
20
|
#
|
|
21
|
-
#It is also possible to use POST HTTP method (for example in the case of a very long ReQL filter) - query parameters then become body parameters.
|
|
21
|
+
# It is also possible to use POST HTTP method (for example in the case of a very long ReQL filter) - query parameters then become body parameters.
|
|
22
22
|
#
|
|
23
23
|
class RecommendItemsToUser < ApiRequest
|
|
24
|
-
attr_reader :user_id, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter,
|
|
25
|
-
|
|
26
|
-
attr_accessor :ensure_https
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
24
|
+
attr_reader :user_id, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter,
|
|
25
|
+
:booster, :logic, :reql_expressions, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
|
26
|
+
attr_accessor :timeout, :ensure_https
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# * *Required arguments*
|
|
30
|
+
# - +user_id+ -> ID of the user for whom personalized recommendations are to be generated.
|
|
31
|
+
# - +count+ -> Number of items to be recommended (N for the top-N recommendation).
|
|
32
|
+
#
|
|
33
|
+
#
|
|
34
|
+
# * *Optional arguments (given as hash optional)*
|
|
35
|
+
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
|
36
|
+
#
|
|
37
|
+
# You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
|
38
|
+
#
|
|
39
|
+
# The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
|
40
|
+
#
|
|
41
|
+
# - +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.
|
|
42
|
+
#
|
|
43
|
+
# - +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 to easily display the recommended items to the user.
|
|
44
|
+
#
|
|
45
|
+
# Example response:
|
|
46
|
+
# ```json
|
|
47
|
+
# {
|
|
48
|
+
# "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
49
|
+
# "recomms":
|
|
50
|
+
# [
|
|
51
|
+
# {
|
|
52
|
+
# "id": "tv-178",
|
|
53
|
+
# "values": {
|
|
54
|
+
# "description": "4K TV with 3D feature",
|
|
55
|
+
# "categories": ["Electronics", "Televisions"],
|
|
56
|
+
# "price": 342,
|
|
57
|
+
# "url": "myshop.com/tv-178"
|
|
58
|
+
# }
|
|
59
|
+
# },
|
|
60
|
+
# {
|
|
61
|
+
# "id": "mixer-42",
|
|
62
|
+
# "values": {
|
|
63
|
+
# "description": "Stainless Steel Mixer",
|
|
64
|
+
# "categories": ["Home & Kitchen"],
|
|
65
|
+
# "price": 39,
|
|
66
|
+
# "url": "myshop.com/mixer-42"
|
|
67
|
+
# }
|
|
68
|
+
# }
|
|
69
|
+
# ],
|
|
70
|
+
# "numberNextRecommsCalls": 0
|
|
71
|
+
# }
|
|
72
|
+
# ```
|
|
73
|
+
#
|
|
74
|
+
# - +includedProperties+ -> Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
|
|
75
|
+
#
|
|
76
|
+
# Example response for `includedProperties=description,price`:
|
|
77
|
+
# ```json
|
|
78
|
+
# {
|
|
79
|
+
# "recommId": "a86ee8d5-cd8e-46d1-886c-8b3771d0520b",
|
|
80
|
+
# "recomms":
|
|
81
|
+
# [
|
|
82
|
+
# {
|
|
83
|
+
# "id": "tv-178",
|
|
84
|
+
# "values": {
|
|
85
|
+
# "description": "4K TV with 3D feature",
|
|
86
|
+
# "price": 342
|
|
87
|
+
# }
|
|
88
|
+
# },
|
|
89
|
+
# {
|
|
90
|
+
# "id": "mixer-42",
|
|
91
|
+
# "values": {
|
|
92
|
+
# "description": "Stainless Steel Mixer",
|
|
93
|
+
# "price": 39
|
|
94
|
+
# }
|
|
95
|
+
# }
|
|
96
|
+
# ],
|
|
97
|
+
# "numberNextRecommsCalls": 0
|
|
98
|
+
# }
|
|
99
|
+
# ```
|
|
100
|
+
#
|
|
101
|
+
# - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended items based on the values of their attributes.
|
|
102
|
+
#
|
|
103
|
+
# Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
104
|
+
#
|
|
105
|
+
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
|
|
106
|
+
#
|
|
107
|
+
# Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
108
|
+
#
|
|
109
|
+
# - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
|
110
|
+
# See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
111
|
+
#
|
|
112
|
+
# The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
113
|
+
#
|
|
114
|
+
# Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
115
|
+
#
|
|
116
|
+
# - +reqlExpressions+ -> A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item.
|
|
117
|
+
# This can be used to compute additional properties of the recommended items that are not stored in the database.
|
|
118
|
+
#
|
|
119
|
+
# The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
120
|
+
#
|
|
121
|
+
# Example request:
|
|
122
|
+
# ```json
|
|
123
|
+
# {
|
|
124
|
+
# "reqlExpressions": {
|
|
125
|
+
# "isInUsersCity": "context_user[\"city\"] in 'cities'",
|
|
126
|
+
# "distanceToUser": "earth_distance('location', context_user[\"location\"])"
|
|
127
|
+
# }
|
|
128
|
+
# }
|
|
129
|
+
# ```
|
|
130
|
+
#
|
|
131
|
+
# Example response:
|
|
132
|
+
# ```json
|
|
133
|
+
# {
|
|
134
|
+
# "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
135
|
+
# "recomms":
|
|
136
|
+
# [
|
|
137
|
+
# {
|
|
138
|
+
# "id": "restaurant-178",
|
|
139
|
+
# "reqlEvaluations": {
|
|
140
|
+
# "isInUsersCity": true,
|
|
141
|
+
# "distanceToUser": 5200.2
|
|
142
|
+
# }
|
|
143
|
+
# },
|
|
144
|
+
# {
|
|
145
|
+
# "id": "bar-42",
|
|
146
|
+
# "reqlEvaluations": {
|
|
147
|
+
# "isInUsersCity": false,
|
|
148
|
+
# "distanceToUser": 2516.0
|
|
149
|
+
# }
|
|
150
|
+
# }
|
|
151
|
+
# ],
|
|
152
|
+
# "numberNextRecommsCalls": 0
|
|
153
|
+
# }
|
|
154
|
+
# ```
|
|
155
|
+
#
|
|
156
|
+
# - +diversity+ -> **Expert option:** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended items should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
|
157
|
+
#
|
|
158
|
+
# - +minRelevance+ -> **Expert option:** Specifies the threshold of how 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 a number of items equal to *count* at any cost. If there is 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 a 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.
|
|
159
|
+
#
|
|
160
|
+
# - +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 a 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`.
|
|
161
|
+
#
|
|
162
|
+
# - +rotationTime+ -> **Expert option:** Taking *rotationRate* into account, specifies how long it takes for 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`.
|
|
163
|
+
#
|
|
164
|
+
# - +expertSettings+ -> Dictionary of custom options.
|
|
165
|
+
#
|
|
166
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
|
167
|
+
#
|
|
168
|
+
#
|
|
129
169
|
def initialize(user_id, count, optional = {})
|
|
130
170
|
@user_id = user_id
|
|
131
171
|
@count = count
|
|
132
|
-
optional =
|
|
172
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
133
173
|
@scenario = optional['scenario']
|
|
134
174
|
@cascade_create = optional['cascadeCreate']
|
|
135
175
|
@return_properties = optional['returnProperties']
|
|
@@ -137,6 +177,7 @@ module RecombeeApiClient
|
|
|
137
177
|
@filter = optional['filter']
|
|
138
178
|
@booster = optional['booster']
|
|
139
179
|
@logic = optional['logic']
|
|
180
|
+
@reql_expressions = optional['reqlExpressions']
|
|
140
181
|
@diversity = optional['diversity']
|
|
141
182
|
@min_relevance = optional['minRelevance']
|
|
142
183
|
@rotation_rate = optional['rotationRate']
|
|
@@ -147,18 +188,19 @@ module RecombeeApiClient
|
|
|
147
188
|
@timeout = 3000
|
|
148
189
|
@ensure_https = false
|
|
149
190
|
@optional.each do |par, _|
|
|
150
|
-
|
|
191
|
+
raise UnknownOptionalParameter.new(par) unless %w[scenario cascadeCreate returnProperties
|
|
192
|
+
includedProperties filter booster logic reqlExpressions diversity minRelevance rotationRate rotationTime expertSettings returnAbGroup].include? par
|
|
151
193
|
end
|
|
152
194
|
end
|
|
153
|
-
|
|
195
|
+
|
|
154
196
|
# HTTP method
|
|
155
197
|
def method
|
|
156
198
|
:post
|
|
157
199
|
end
|
|
158
|
-
|
|
200
|
+
|
|
159
201
|
# Values of body parameters as a Hash
|
|
160
202
|
def body_parameters
|
|
161
|
-
p =
|
|
203
|
+
p = {}
|
|
162
204
|
p['count'] = @count
|
|
163
205
|
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
|
164
206
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
|
@@ -167,22 +209,23 @@ module RecombeeApiClient
|
|
|
167
209
|
p['filter'] = @optional['filter'] if @optional.include? 'filter'
|
|
168
210
|
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
|
169
211
|
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
|
212
|
+
p['reqlExpressions'] = @optional['reqlExpressions'] if @optional.include? 'reqlExpressions'
|
|
170
213
|
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
|
171
214
|
p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
|
|
172
215
|
p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
|
|
173
216
|
p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
|
|
174
217
|
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
|
175
218
|
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
|
219
|
+
|
|
176
220
|
p
|
|
177
221
|
end
|
|
178
|
-
|
|
222
|
+
|
|
179
223
|
# Values of query parameters as a Hash.
|
|
180
224
|
# name of parameter => value of the parameter
|
|
181
225
|
def query_parameters
|
|
182
|
-
|
|
183
|
-
params
|
|
226
|
+
{}
|
|
184
227
|
end
|
|
185
|
-
|
|
228
|
+
|
|
186
229
|
# Relative path to the endpoint
|
|
187
230
|
def path
|
|
188
231
|
"/{databaseId}/recomms/users/#{@user_id}/items/"
|
|
@@ -5,63 +5,62 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
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 the next page.
|
|
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 the next page.
|
|
11
11
|
#
|
|
12
|
-
#It accepts `recommId` of a base recommendation request (e.g., request from the first page) and the number of items that shall be returned (`count`).
|
|
13
|
-
#The base request can be one of:
|
|
12
|
+
# It accepts `recommId` of a base recommendation request (e.g., request from the first page) and the number of items that shall be returned (`count`).
|
|
13
|
+
# The base request can be one of:
|
|
14
14
|
# - [Recommend Items to Item](https://docs.recombee.com/api#recommend-items-to-item)
|
|
15
15
|
# - [Recommend Items to User](https://docs.recombee.com/api#recommend-items-to-user)
|
|
16
16
|
# - [Recommend Items to Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment)
|
|
17
17
|
# - [Search Items](https://docs.recombee.com/api#search-items)
|
|
18
18
|
#
|
|
19
|
-
#All the other parameters are inherited from the base request.
|
|
19
|
+
# All the other parameters are inherited from the base request.
|
|
20
20
|
#
|
|
21
|
-
|
|
22
|
-
#The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field.
|
|
21
|
+
# *Recommend next items* can be called many times for a single `recommId` and each call returns different (previously not recommended) items.
|
|
22
|
+
# The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field.
|
|
23
23
|
#
|
|
24
|
-
|
|
24
|
+
# *Recommend next items* can be requested up to 30 minutes after the base request or a previous *Recommend next items* call.
|
|
25
25
|
#
|
|
26
|
-
#For billing purposes, each call to *Recommend next items* is counted as a separate recommendation request.
|
|
26
|
+
# For billing purposes, each call to *Recommend next items* is counted as a separate recommendation request.
|
|
27
27
|
#
|
|
28
28
|
class RecommendNextItems < ApiRequest
|
|
29
29
|
attr_reader :recomm_id, :count
|
|
30
|
-
attr_accessor :timeout
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
#
|
|
30
|
+
attr_accessor :timeout, :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
|
+
#
|
|
39
38
|
def initialize(recomm_id, count)
|
|
40
39
|
@recomm_id = recomm_id
|
|
41
40
|
@count = count
|
|
42
41
|
@timeout = 3000
|
|
43
42
|
@ensure_https = false
|
|
44
43
|
end
|
|
45
|
-
|
|
44
|
+
|
|
46
45
|
# HTTP method
|
|
47
46
|
def method
|
|
48
47
|
:post
|
|
49
48
|
end
|
|
50
|
-
|
|
49
|
+
|
|
51
50
|
# Values of body parameters as a Hash
|
|
52
51
|
def body_parameters
|
|
53
|
-
p =
|
|
52
|
+
p = {}
|
|
54
53
|
p['count'] = @count
|
|
54
|
+
|
|
55
55
|
p
|
|
56
56
|
end
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
# Values of query parameters as a Hash.
|
|
59
59
|
# name of parameter => value of the parameter
|
|
60
60
|
def query_parameters
|
|
61
|
-
|
|
62
|
-
params
|
|
61
|
+
{}
|
|
63
62
|
end
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
# Relative path to the endpoint
|
|
66
65
|
def path
|
|
67
66
|
"/{databaseId}/recomms/next/items/#{@recomm_id}"
|