recombee_api_client 2.1.0 → 2.2.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.rb +1 -1
- 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_item_property.rb +16 -0
- 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/add_user_property.rb +13 -1
- data/lib/recombee_api_client/api/merge_users.rb +1 -1
- data/lib/recombee_api_client/api/set_view_portion.rb +5 -2
- data/lib/recombee_api_client/version.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: 891734600f45e2e25c9a44617f0e2ce033b6e90c
|
4
|
+
data.tar.gz: 6aca79bfa8720f2187f14ec117a60b02a4e18995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc1533bd22417f9ddb1fae6ce533e623854d425b966a72d98f2d994796c3aa909e73ef1a3a5cebb92cabd2397f2e7477f2c09765b8e1dfa498a0e9256da9cd73
|
7
|
+
data.tar.gz: 5a8c325f7bce984ac02e397d9a16dfd21b132178ec836e7dddd509f7ef242c86cc61dc7b5fdabe06239f36e0813682e102d3cd92279e88dd8bd8fb6424799cea
|
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.2.0'}
|
22
22
|
|
23
23
|
##
|
24
24
|
# - +account+ -> Name of your account at Recombee
|
@@ -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
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :recomm_id
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -22,6 +22,7 @@ module RecombeeApiClient
|
|
22
22
|
# * *Optional arguments (given as hash optional)*
|
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
|
+
# - +recommId+ -> If this bookmark is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
25
26
|
#
|
26
27
|
def initialize(user_id, item_id, optional = {})
|
27
28
|
@user_id = user_id
|
@@ -29,11 +30,12 @@ module RecombeeApiClient
|
|
29
30
|
optional = normalize_optional(optional)
|
30
31
|
@timestamp = optional['timestamp']
|
31
32
|
@cascade_create = optional['cascadeCreate']
|
33
|
+
@recomm_id = optional['recommId']
|
32
34
|
@optional = optional
|
33
35
|
@timeout = 1000
|
34
36
|
@ensure_https = false
|
35
37
|
@optional.each do |par, _|
|
36
|
-
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate"].include? par
|
38
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId"].include? par
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -49,6 +51,7 @@ module RecombeeApiClient
|
|
49
51
|
p['itemId'] = @item_id
|
50
52
|
p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
|
51
53
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
54
|
+
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
52
55
|
p
|
53
56
|
end
|
54
57
|
|
@@ -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
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :recomm_id
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -24,6 +24,7 @@ module RecombeeApiClient
|
|
24
24
|
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
|
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
|
+
# - +recommId+ -> If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
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
|
@cascade_create = optional['cascadeCreate']
|
34
35
|
@amount = optional['amount']
|
35
36
|
@price = optional['price']
|
37
|
+
@recomm_id = optional['recommId']
|
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","amount","price"].include? par
|
42
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","recommId"].include? par
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -55,6 +57,7 @@ module RecombeeApiClient
|
|
55
57
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
56
58
|
p['amount'] = @optional['amount'] if @optional.include? 'amount'
|
57
59
|
p['price'] = @optional['price'] if @optional.include? 'price'
|
60
|
+
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
58
61
|
p
|
59
62
|
end
|
60
63
|
|
@@ -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
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :duration, :cascade_create, :recomm_id
|
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 view as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
|
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
|
+
# - +recommId+ -> If this detail view is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
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
|
@duration = optional['duration']
|
33
34
|
@cascade_create = optional['cascadeCreate']
|
35
|
+
@recomm_id = optional['recommId']
|
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","duration","cascadeCreate"].include? par
|
40
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","duration","cascadeCreate","recommId"].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['duration'] = @optional['duration'] if @optional.include? 'duration'
|
54
56
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
57
|
+
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
55
58
|
p
|
56
59
|
end
|
57
60
|
|
@@ -20,6 +20,22 @@ module RecombeeApiClient
|
|
20
20
|
#
|
21
21
|
# - +type+ -> Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
|
22
22
|
#
|
23
|
+
#* `int`- Signed integer number.
|
24
|
+
#
|
25
|
+
#* `double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).
|
26
|
+
#
|
27
|
+
#* `string` - UTF-8 string.
|
28
|
+
#
|
29
|
+
#* `boolean` - *true* / *false*
|
30
|
+
#
|
31
|
+
#* `timestamp` - Value representing date and time.
|
32
|
+
#
|
33
|
+
#* `set` - Set of strings.
|
34
|
+
#
|
35
|
+
#* `image` - URL of an image (`jpeg`, `png` or `gif`).
|
36
|
+
#
|
37
|
+
#* `imageList` - List of URLs that refer to images.
|
38
|
+
#
|
23
39
|
#
|
24
40
|
def initialize(property_name, type)
|
25
41
|
@property_name = property_name
|
@@ -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
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :profit, :recomm_id
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -25,6 +25,7 @@ module RecombeeApiClient
|
|
25
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
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
|
+
# - +recommId+ -> If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
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
|
@profit = optional['profit']
|
39
|
+
@recomm_id = optional['recommId']
|
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","profit"].include? par
|
44
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","profit","recommId"].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['profit'] = @optional['profit'] if @optional.include? 'profit'
|
63
|
+
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
61
64
|
p
|
62
65
|
end
|
63
66
|
|
@@ -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
|
13
|
+
attr_reader :user_id, :item_id, :timestamp, :rating, :cascade_create, :recomm_id
|
14
14
|
attr_accessor :timeout
|
15
15
|
attr_accessor :ensure_https
|
16
16
|
|
@@ -23,6 +23,7 @@ module RecombeeApiClient
|
|
23
23
|
# * *Optional arguments (given as hash optional)*
|
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
|
+
# - +recommId+ -> If this rating is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
26
27
|
#
|
27
28
|
def initialize(user_id, item_id, rating, optional = {})
|
28
29
|
@user_id = user_id
|
@@ -31,11 +32,12 @@ module RecombeeApiClient
|
|
31
32
|
optional = normalize_optional(optional)
|
32
33
|
@timestamp = optional['timestamp']
|
33
34
|
@cascade_create = optional['cascadeCreate']
|
35
|
+
@recomm_id = optional['recommId']
|
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"].include? par
|
40
|
+
fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId"].include? par
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
@@ -52,6 +54,7 @@ module RecombeeApiClient
|
|
52
54
|
p['rating'] = @rating
|
53
55
|
p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
|
54
56
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
57
|
+
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
55
58
|
p
|
56
59
|
end
|
57
60
|
|
@@ -18,7 +18,19 @@ module RecombeeApiClient
|
|
18
18
|
# * *Required arguments*
|
19
19
|
# - +property_name+ -> Name of the user property to be created. Currently, the following names are reserved:`id`, `userid`, case insensitively. Also, the length of the property name must not exceed 63 characters.
|
20
20
|
#
|
21
|
-
# - +type+ -> Value type of the user property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set
|
21
|
+
# - +type+ -> Value type of the user property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`.
|
22
|
+
#
|
23
|
+
#* `int` - Signed integer number.
|
24
|
+
#
|
25
|
+
#* `double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).
|
26
|
+
#
|
27
|
+
#* `string` - UTF-8 string.
|
28
|
+
#
|
29
|
+
#* `boolean` - *true* / *false*
|
30
|
+
#
|
31
|
+
#* `timestamp` - Value representing date and time.
|
32
|
+
#
|
33
|
+
#* `set` - Set of strings.
|
22
34
|
#
|
23
35
|
#
|
24
36
|
def initialize(property_name, type)
|
@@ -10,7 +10,7 @@ module RecombeeApiClient
|
|
10
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
|
-
#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
|
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**.
|
14
14
|
#
|
15
15
|
class MergeUsers < ApiRequest
|
16
16
|
attr_reader :target_user_id, :source_user_id, :cascade_create
|
@@ -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
|
14
|
+
attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create, :recomm_id
|
15
15
|
attr_accessor :timeout
|
16
16
|
attr_accessor :ensure_https
|
17
17
|
|
@@ -25,6 +25,7 @@ module RecombeeApiClient
|
|
25
25
|
# - +sessionId+ -> ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language).
|
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
|
+
# - +recommId+ -> If this view portion is based on a recommendation request, `recommId` is the id of the clicked recommendation.
|
28
29
|
#
|
29
30
|
def initialize(user_id, item_id, portion, optional = {})
|
30
31
|
@user_id = user_id
|
@@ -34,11 +35,12 @@ module RecombeeApiClient
|
|
34
35
|
@session_id = optional['sessionId']
|
35
36
|
@timestamp = optional['timestamp']
|
36
37
|
@cascade_create = optional['cascadeCreate']
|
38
|
+
@recomm_id = optional['recommId']
|
37
39
|
@optional = optional
|
38
40
|
@timeout = 1000
|
39
41
|
@ensure_https = false
|
40
42
|
@optional.each do |par, _|
|
41
|
-
fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate"].include? par
|
43
|
+
fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate","recommId"].include? par
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -56,6 +58,7 @@ module RecombeeApiClient
|
|
56
58
|
p['sessionId'] = @optional['sessionId'] if @optional.include? 'sessionId'
|
57
59
|
p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp'
|
58
60
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
61
|
+
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
59
62
|
p
|
60
63
|
end
|
61
64
|
|
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.2.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: 2018-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|