recombee_api_client 2.2.0 → 2.3.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/README.md +2 -2
- data/lib/recombee_api_client/api/add_bookmark.rb +5 -2
- data/lib/recombee_api_client/api/add_cart_addition.rb +5 -2
- data/lib/recombee_api_client/api/add_detail_view.rb +5 -2
- data/lib/recombee_api_client/api/add_purchase.rb +5 -2
- data/lib/recombee_api_client/api/add_rating.rb +5 -2
- data/lib/recombee_api_client/api/recommend_items_to_item.rb +8 -2
- data/lib/recombee_api_client/api/recommend_items_to_user.rb +8 -2
- data/lib/recombee_api_client/api/recommend_users_to_item.rb +8 -2
- data/lib/recombee_api_client/api/recommend_users_to_user.rb +8 -2
- data/lib/recombee_api_client/api/set_view_portion.rb +5 -2
- data/lib/recombee_api_client/version.rb +1 -1
- data/lib/recombee_api_client.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bde99964e32a23c23cd61d005f599603129f2e2
|
4
|
+
data.tar.gz: 96d02fc53a32d47ae4e16d30a2d5b8a6843856e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e98d77bf0f8cd3ced9173cfc8de8f64f011bd7b56fd3a80ff77c6a9761e2d752039914b51450afd00ef9842cd67fa5f96804b1f3803fd39cb53524da5cd1e4d2
|
7
|
+
data.tar.gz: aff19ee2b7da7ea02110fcebf964ae076fb9ef2d21812904d6bf51deab4b9c327d5aa588befee6f867687dcc1f01b2ed4cdc21387f421dc5f565d8f61b09df1e
|
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--', '--
|
32
|
+
client = RecombeeClient('--my-database-id--', '--db-private-token--')
|
33
33
|
|
34
34
|
# Generate some random purchases of items by users
|
35
35
|
NUM = 100
|
@@ -71,7 +71,7 @@ include RecombeeApiClient
|
|
71
71
|
NUM = 100
|
72
72
|
PROBABILITY_PURCHASED = 0.1
|
73
73
|
|
74
|
-
client = RecombeeClient('--my-database-id--', '--
|
74
|
+
client = RecombeeClient('--my-database-id--', '--db-private-token--')
|
75
75
|
client.send(ResetDatabase.new) # Clear everything from the database
|
76
76
|
|
77
77
|
# We will use computers as items in this example
|
@@ -10,7 +10,7 @@ module RecombeeApiClient
|
|
10
10
|
#Adds a bookmark of a given item made by a given user.
|
11
11
|
#
|
12
12
|
class AddBookmark < ApiRequest
|
13
|
-
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :recomm_id
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :recomm_id, :additional_data
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -23,6 +23,7 @@ module RecombeeApiClient
|
|
23
23
|
# - +timestamp+ -> UTC timestamp of the bookmark 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
25
|
# - +recommId+ -> If this bookmark is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
26
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
26
27
|
#
|
27
28
|
def initialize(user_id, item_id, optional = {})
|
28
29
|
@user_id = user_id
|
@@ -31,11 +32,12 @@ module RecombeeApiClient
|
|
31
32
|
@timestamp = optional['timestamp']
|
32
33
|
@cascade_create = optional['cascadeCreate']
|
33
34
|
@recomm_id = optional['recommId']
|
35
|
+
@additional_data = optional['additionalData']
|
34
36
|
@optional = optional
|
35
37
|
@timeout = 1000
|
36
38
|
@ensure_https = false
|
37
39
|
@optional.each do |par, _|
|
38
|
-
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId"].include? par
|
40
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId","additionalData"].include? par
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
@@ -52,6 +54,7 @@ module RecombeeApiClient
|
|
52
54
|
p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
|
53
55
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
54
56
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
57
|
+
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
55
58
|
p
|
56
59
|
end
|
57
60
|
|
@@ -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, :amount, :price, :recomm_id
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :recomm_id, :additional_data
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -25,6 +25,7 @@ module RecombeeApiClient
|
|
25
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
26
|
# - +price+ -> Price of the added item. If `amount` is greater than 1, sum of prices of all the items should be given.
|
27
27
|
# - +recommId+ -> If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
28
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
28
29
|
#
|
29
30
|
def initialize(user_id, item_id, optional = {})
|
30
31
|
@user_id = user_id
|
@@ -35,11 +36,12 @@ module RecombeeApiClient
|
|
35
36
|
@amount = optional['amount']
|
36
37
|
@price = optional['price']
|
37
38
|
@recomm_id = optional['recommId']
|
39
|
+
@additional_data = optional['additionalData']
|
38
40
|
@optional = optional
|
39
41
|
@timeout = 1000
|
40
42
|
@ensure_https = false
|
41
43
|
@optional.each do |par, _|
|
42
|
-
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","recommId"].include? par
|
44
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","recommId","additionalData"].include? par
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
@@ -58,6 +60,7 @@ module RecombeeApiClient
|
|
58
60
|
p['amount'] = @optional['amount'] if @optional.include? 'amount'
|
59
61
|
p['price'] = @optional['price'] if @optional.include? 'price'
|
60
62
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
63
|
+
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
61
64
|
p
|
62
65
|
end
|
63
66
|
|
@@ -10,7 +10,7 @@ module RecombeeApiClient
|
|
10
10
|
#Adds a detail view of a given item made by a given user.
|
11
11
|
#
|
12
12
|
class AddDetailView < ApiRequest
|
13
|
-
attr_reader :user_id, :item_id, :timestamp, :duration, :cascade_create, :recomm_id
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :duration, :cascade_create, :recomm_id, :additional_data
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -24,6 +24,7 @@ module RecombeeApiClient
|
|
24
24
|
# - +duration+ -> Duration of the view
|
25
25
|
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
|
26
26
|
# - +recommId+ -> If this detail view is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
27
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
27
28
|
#
|
28
29
|
def initialize(user_id, item_id, optional = {})
|
29
30
|
@user_id = user_id
|
@@ -33,11 +34,12 @@ module RecombeeApiClient
|
|
33
34
|
@duration = optional['duration']
|
34
35
|
@cascade_create = optional['cascadeCreate']
|
35
36
|
@recomm_id = optional['recommId']
|
37
|
+
@additional_data = optional['additionalData']
|
36
38
|
@optional = optional
|
37
39
|
@timeout = 1000
|
38
40
|
@ensure_https = false
|
39
41
|
@optional.each do |par, _|
|
40
|
-
fail UnknownOptionalParameter.new(par) unless ["timestamp","duration","cascadeCreate","recommId"].include? par
|
42
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","duration","cascadeCreate","recommId","additionalData"].include? par
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -55,6 +57,7 @@ module RecombeeApiClient
|
|
55
57
|
p['duration'] = @optional['duration'] if @optional.include? 'duration'
|
56
58
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
57
59
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
60
|
+
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
58
61
|
p
|
59
62
|
end
|
60
63
|
|
@@ -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, :amount, :price, :profit, :recomm_id
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :profit, :recomm_id, :additional_data
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -26,6 +26,7 @@ module RecombeeApiClient
|
|
26
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
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.
|
28
28
|
# - +recommId+ -> If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
29
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
29
30
|
#
|
30
31
|
def initialize(user_id, item_id, optional = {})
|
31
32
|
@user_id = user_id
|
@@ -37,11 +38,12 @@ module RecombeeApiClient
|
|
37
38
|
@price = optional['price']
|
38
39
|
@profit = optional['profit']
|
39
40
|
@recomm_id = optional['recommId']
|
41
|
+
@additional_data = optional['additionalData']
|
40
42
|
@optional = optional
|
41
43
|
@timeout = 1000
|
42
44
|
@ensure_https = false
|
43
45
|
@optional.each do |par, _|
|
44
|
-
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","profit","recommId"].include? par
|
46
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","profit","recommId","additionalData"].include? par
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -61,6 +63,7 @@ module RecombeeApiClient
|
|
61
63
|
p['price'] = @optional['price'] if @optional.include? 'price'
|
62
64
|
p['profit'] = @optional['profit'] if @optional.include? 'profit'
|
63
65
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
66
|
+
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
64
67
|
p
|
65
68
|
end
|
66
69
|
|
@@ -10,7 +10,7 @@ module RecombeeApiClient
|
|
10
10
|
#Adds a rating of given item made by a given user.
|
11
11
|
#
|
12
12
|
class AddRating < ApiRequest
|
13
|
-
attr_reader :user_id, :item_id, :timestamp, :rating, :cascade_create, :recomm_id
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :rating, :cascade_create, :recomm_id, :additional_data
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -24,6 +24,7 @@ module RecombeeApiClient
|
|
24
24
|
# - +timestamp+ -> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
|
25
25
|
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
|
26
26
|
# - +recommId+ -> If this rating is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
27
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
27
28
|
#
|
28
29
|
def initialize(user_id, item_id, rating, optional = {})
|
29
30
|
@user_id = user_id
|
@@ -33,11 +34,12 @@ module RecombeeApiClient
|
|
33
34
|
@timestamp = optional['timestamp']
|
34
35
|
@cascade_create = optional['cascadeCreate']
|
35
36
|
@recomm_id = optional['recommId']
|
37
|
+
@additional_data = optional['additionalData']
|
36
38
|
@optional = optional
|
37
39
|
@timeout = 1000
|
38
40
|
@ensure_https = false
|
39
41
|
@optional.each do |par, _|
|
40
|
-
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId"].include? par
|
42
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId","additionalData"].include? par
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -55,6 +57,7 @@ module RecombeeApiClient
|
|
55
57
|
p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
|
56
58
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
57
59
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
60
|
+
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
58
61
|
p
|
59
62
|
end
|
60
63
|
|
@@ -11,8 +11,10 @@ module RecombeeApiClient
|
|
11
11
|
#
|
12
12
|
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
13
13
|
#
|
14
|
+
#The returned items are sorted by relevancy (first item being the most relevant).
|
15
|
+
#
|
14
16
|
class RecommendItemsToItem < ApiRequest
|
15
|
-
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
|
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, :return_ab_group
|
16
18
|
attr_accessor :timeout
|
17
19
|
attr_accessor :ensure_https
|
18
20
|
|
@@ -112,6 +114,8 @@ module RecombeeApiClient
|
|
112
114
|
#
|
113
115
|
# - +expertSettings+ -> Dictionary of custom options.
|
114
116
|
#
|
117
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return name of group to which the request belongs.
|
118
|
+
#
|
115
119
|
#
|
116
120
|
def initialize(item_id, target_user_id, count, optional = {})
|
117
121
|
@item_id = item_id
|
@@ -130,11 +134,12 @@ module RecombeeApiClient
|
|
130
134
|
@rotation_rate = optional['rotationRate']
|
131
135
|
@rotation_time = optional['rotationTime']
|
132
136
|
@expert_settings = optional['expertSettings']
|
137
|
+
@return_ab_group = optional['returnAbGroup']
|
133
138
|
@optional = optional
|
134
139
|
@timeout = 3000
|
135
140
|
@ensure_https = false
|
136
141
|
@optional.each do |par, _|
|
137
|
-
fail UnknownOptionalParameter.new(par) unless ["userImpact","filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
|
142
|
+
fail UnknownOptionalParameter.new(par) unless ["userImpact","filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
138
143
|
end
|
139
144
|
end
|
140
145
|
|
@@ -160,6 +165,7 @@ module RecombeeApiClient
|
|
160
165
|
p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
|
161
166
|
p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
|
162
167
|
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
168
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
163
169
|
p
|
164
170
|
end
|
165
171
|
|
@@ -11,8 +11,10 @@ module RecombeeApiClient
|
|
11
11
|
#
|
12
12
|
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
13
13
|
#
|
14
|
+
#The returned items are sorted by relevancy (first item being the most relevant).
|
15
|
+
#
|
14
16
|
class RecommendItemsToUser < ApiRequest
|
15
|
-
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings
|
17
|
+
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
16
18
|
attr_accessor :timeout
|
17
19
|
attr_accessor :ensure_https
|
18
20
|
|
@@ -92,6 +94,8 @@ module RecombeeApiClient
|
|
92
94
|
#
|
93
95
|
# - +expertSettings+ -> Dictionary of custom options.
|
94
96
|
#
|
97
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return name of group to which the request belongs.
|
98
|
+
#
|
95
99
|
#
|
96
100
|
def initialize(user_id, count, optional = {})
|
97
101
|
@user_id = user_id
|
@@ -108,11 +112,12 @@ module RecombeeApiClient
|
|
108
112
|
@rotation_rate = optional['rotationRate']
|
109
113
|
@rotation_time = optional['rotationTime']
|
110
114
|
@expert_settings = optional['expertSettings']
|
115
|
+
@return_ab_group = optional['returnAbGroup']
|
111
116
|
@optional = optional
|
112
117
|
@timeout = 3000
|
113
118
|
@ensure_https = false
|
114
119
|
@optional.each do |par, _|
|
115
|
-
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
|
120
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
116
121
|
end
|
117
122
|
end
|
118
123
|
|
@@ -136,6 +141,7 @@ module RecombeeApiClient
|
|
136
141
|
p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
|
137
142
|
p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
|
138
143
|
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
144
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
139
145
|
p
|
140
146
|
end
|
141
147
|
|
@@ -11,8 +11,10 @@ module RecombeeApiClient
|
|
11
11
|
#
|
12
12
|
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
13
13
|
#
|
14
|
+
#The returned users are sorted by predicted interest in the item (first user being the most interested).
|
15
|
+
#
|
14
16
|
class RecommendUsersToItem < ApiRequest
|
15
|
-
attr_reader :item_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :expert_settings
|
17
|
+
attr_reader :item_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :expert_settings, :return_ab_group
|
16
18
|
attr_accessor :timeout
|
17
19
|
attr_accessor :ensure_https
|
18
20
|
|
@@ -80,6 +82,8 @@ module RecombeeApiClient
|
|
80
82
|
#
|
81
83
|
# - +expertSettings+ -> Dictionary of custom options.
|
82
84
|
#
|
85
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return name of group to which the request belongs.
|
86
|
+
#
|
83
87
|
#
|
84
88
|
def initialize(item_id, count, optional = {})
|
85
89
|
@item_id = item_id
|
@@ -93,11 +97,12 @@ module RecombeeApiClient
|
|
93
97
|
@included_properties = optional['includedProperties']
|
94
98
|
@diversity = optional['diversity']
|
95
99
|
@expert_settings = optional['expertSettings']
|
100
|
+
@return_ab_group = optional['returnAbGroup']
|
96
101
|
@optional = optional
|
97
102
|
@timeout = 50000
|
98
103
|
@ensure_https = false
|
99
104
|
@optional.each do |par, _|
|
100
|
-
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","expertSettings"].include? par
|
105
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","expertSettings","returnAbGroup"].include? par
|
101
106
|
end
|
102
107
|
end
|
103
108
|
|
@@ -118,6 +123,7 @@ module RecombeeApiClient
|
|
118
123
|
p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
|
119
124
|
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
120
125
|
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
126
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
121
127
|
p
|
122
128
|
end
|
123
129
|
|
@@ -11,8 +11,10 @@ module RecombeeApiClient
|
|
11
11
|
#
|
12
12
|
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
13
13
|
#
|
14
|
+
#The returned users are sorted by similarity (first user being the most similar).
|
15
|
+
#
|
14
16
|
class RecommendUsersToUser < ApiRequest
|
15
|
-
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings
|
17
|
+
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
16
18
|
attr_accessor :timeout
|
17
19
|
attr_accessor :ensure_https
|
18
20
|
|
@@ -86,6 +88,8 @@ module RecombeeApiClient
|
|
86
88
|
#
|
87
89
|
# - +expertSettings+ -> Dictionary of custom options.
|
88
90
|
#
|
91
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return name of group to which the request belongs.
|
92
|
+
#
|
89
93
|
#
|
90
94
|
def initialize(user_id, count, optional = {})
|
91
95
|
@user_id = user_id
|
@@ -102,11 +106,12 @@ module RecombeeApiClient
|
|
102
106
|
@rotation_rate = optional['rotationRate']
|
103
107
|
@rotation_time = optional['rotationTime']
|
104
108
|
@expert_settings = optional['expertSettings']
|
109
|
+
@return_ab_group = optional['returnAbGroup']
|
105
110
|
@optional = optional
|
106
111
|
@timeout = 50000
|
107
112
|
@ensure_https = false
|
108
113
|
@optional.each do |par, _|
|
109
|
-
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
|
114
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
110
115
|
end
|
111
116
|
end
|
112
117
|
|
@@ -130,6 +135,7 @@ module RecombeeApiClient
|
|
130
135
|
p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
|
131
136
|
p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
|
132
137
|
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
138
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
133
139
|
p
|
134
140
|
end
|
135
141
|
|
@@ -11,7 +11,7 @@ module RecombeeApiClient
|
|
11
11
|
#If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.
|
12
12
|
#
|
13
13
|
class SetViewPortion < ApiRequest
|
14
|
-
attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create, :recomm_id
|
14
|
+
attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create, :recomm_id, :additional_data
|
15
15
|
attr_accessor :timeout
|
16
16
|
attr_accessor :ensure_https
|
17
17
|
|
@@ -26,6 +26,7 @@ module RecombeeApiClient
|
|
26
26
|
# - +timestamp+ -> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
|
27
27
|
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
|
28
28
|
# - +recommId+ -> If this view portion is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
29
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
29
30
|
#
|
30
31
|
def initialize(user_id, item_id, portion, optional = {})
|
31
32
|
@user_id = user_id
|
@@ -36,11 +37,12 @@ module RecombeeApiClient
|
|
36
37
|
@timestamp = optional['timestamp']
|
37
38
|
@cascade_create = optional['cascadeCreate']
|
38
39
|
@recomm_id = optional['recommId']
|
40
|
+
@additional_data = optional['additionalData']
|
39
41
|
@optional = optional
|
40
42
|
@timeout = 1000
|
41
43
|
@ensure_https = false
|
42
44
|
@optional.each do |par, _|
|
43
|
-
fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate","recommId"].include? par
|
45
|
+
fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate","recommId","additionalData"].include? par
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -59,6 +61,7 @@ module RecombeeApiClient
|
|
59
61
|
p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
|
60
62
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
61
63
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
64
|
+
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
62
65
|
p
|
63
66
|
end
|
64
67
|
|
data/lib/recombee_api_client.rb
CHANGED
@@ -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/2.
|
21
|
+
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.3.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: 2.
|
4
|
+
version: 2.3.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: 2019-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|