Skip to content

Commit 255f5f4

Browse files
committed
Support image and imageList item property types
1 parent 30a42dd commit 255f5f4

11 files changed

+18
-22
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,19 @@ client = RecombeeClient('--my-database-id--', '--my-secret-token--')
7575
client.send(ResetDatabase.new) # Clear everything from the database
7676

7777
# We will use computers as items in this example
78-
# Computers have three properties
78+
# Computers have five properties
7979
# - price (floating point number)
8080
# - number of processor cores (integer number)
8181
# - description (string)
82+
# - date from which it is in stock (timestamp)
83+
# - image (url of computer's photo)
8284

8385
# Add properties of items
8486
client.send(AddItemProperty.new('price', 'double'))
8587
client.send(AddItemProperty.new('num-cores', 'int'))
8688
client.send(AddItemProperty.new('description', 'string'))
87-
client.send(AddItemProperty.new('time', 'timestamp'))
89+
client.send(AddItemProperty.new('in_stock_from', 'timestamp'))
90+
client.send(AddItemProperty.new('image', 'image'))
8891

8992
# Prepare requests for setting a catalog of computers
9093
requests = (1..NUM).map do |i|
@@ -95,7 +98,8 @@ requests = (1..NUM).map do |i|
9598
'price' => rand(15000.0 .. 25000.0),
9699
'num-cores' => rand(1..8),
97100
'description' => 'Great computer',
98-
'time' => DateTime.now
101+
'in_stock_from' => DateTime.now,
102+
'image' => "http://examplesite.com/products/computer-#{i}.jpg"
99103
},
100104
#optional parameters:
101105
{

lib/recombee_api_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RecombeeClient
1818
include HTTParty
1919

2020
BATCH_MAX_SIZE = 10000
21-
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.0.1'}
21+
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.1.0'}
2222

2323
##
2424
# - +account+ -> Name of your account at Recombee

lib/recombee_api_client/api/add_item_property.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AddItemProperty < ApiRequest
1818
# * *Required arguments*
1919
# - +property_name+ -> Name of the item property to be created. Currently, the following names are reserved:`id`, `itemid`, case insensitively. Also, the length of the property name must not exceed 63 characters.
2020
#
21-
# - +type+ -> Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`
21+
# - +type+ -> Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
2222
#
2323
#
2424
def initialize(property_name, type)

lib/recombee_api_client/api/delete_view_portion.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#The view portions feature is currently experimental.
11-
#
1210
#Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database.
1311
#
1412
class DeleteViewPortion < ApiRequest

lib/recombee_api_client/api/item_based_recommendation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ class ItemBasedRecommendation < ApiRequest
8585
#
8686
# - +minRelevance+ -> **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested qualit, and may return less than *count* items when there is not enough data to fulfill it.
8787
#
88-
# - +rotationRate+ -> **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items.
88+
# - +rotationRate+ -> **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.01`.
8989
#
90-
# - +rotationTime+ -> **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
90+
# - +rotationTime+ -> **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
9191
#
9292
# - +expertSettings+ -> Dictionary of custom options.
9393
#

lib/recombee_api_client/api/list_item_view_portions.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#The view portions feature is currently experimental.
11-
#
1210
#List all the view portions of an item ever submitted by different users.
1311
#
1412
class ListItemViewPortions < ApiRequest

lib/recombee_api_client/api/list_user_view_portions.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#The view portions feature is currently experimental.
11-
#
1210
#List all the view portions ever submitted by a given user.
1311
#
1412
class ListUserViewPortions < ApiRequest

lib/recombee_api_client/api/recommend_items_to_user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ class RecommendItemsToUser < ApiRequest
8686
#
8787
# - +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.
8888
#
89-
# - +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.
89+
# - +rotationRate+ -> **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`.
9090
#
91-
# - +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.
91+
# - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
9292
#
9393
# - +expertSettings+ -> Dictionary of custom options.
9494
#

lib/recombee_api_client/api/set_view_portion.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#The view portions feature is currently experimental.
11-
#
1210
#Sets viewed portion of an item (for example a video or article) by a user (at a session).
1311
#If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.
1412
#
@@ -21,10 +19,10 @@ class SetViewPortion < ApiRequest
2119
# * *Required arguments*
2220
# - +user_id+ -> User who viewed a portion of the item
2321
# - +item_id+ -> Viewed item
24-
# - +portion+ -> Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ).
22+
# - +portion+ -> Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the really viewed part of the item, no matter seeking, so for example if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`.
2523
#
2624
# * *Optional arguments (given as hash optional)*
27-
# - +sessionId+ -> Id of session in which the user viewed the item
25+
# - +sessionId+ -> ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language).
2826
# - +timestamp+ -> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
2927
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
3028
#

lib/recombee_api_client/api/user_based_recommendation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ class UserBasedRecommendation < ApiRequest
7373
#
7474
# - +minRelevance+ -> **Expert option** Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested qualit, and may return less than *count* items when there is not enough data to fulfill it.
7575
#
76-
# - +rotationRate+ -> **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items.
76+
# - +rotationRate+ -> **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`.
7777
#
78-
# - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
78+
# - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
7979
#
8080
# - +expertSettings+ -> Dictionary of custom options.
8181
#

0 commit comments

Comments
 (0)