diff --git a/lib/recombee_api_client.rb b/lib/recombee_api_client.rb index 244f238..2929bd0 100644 --- a/lib/recombee_api_client.rb +++ b/lib/recombee_api_client.rb @@ -18,7 +18,7 @@ class RecombeeClient include HTTParty BATCH_MAX_SIZE = 10000 - USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.1.0'} + USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.2.0'} ## # - +account+ -> Name of your account at Recombee diff --git a/lib/recombee_api_client/api/add_bookmark.rb b/lib/recombee_api_client/api/add_bookmark.rb index 114b2bb..446cf99 100644 --- a/lib/recombee_api_client/api/add_bookmark.rb +++ b/lib/recombee_api_client/api/add_bookmark.rb @@ -10,7 +10,7 @@ module RecombeeApiClient #Adds a bookmark of a given item made by a given user. # class AddBookmark < ApiRequest - attr_reader :user_id, :item_id, :timestamp, :cascade_create + attr_reader :user_id, :item_id, :timestamp, :cascade_create, :recomm_id attr_accessor :timeout attr_accessor :ensure_https @@ -22,6 +22,7 @@ class AddBookmark < ApiRequest # * *Optional arguments (given as hash optional)* # - +timestamp+ -> UTC timestamp of the bookmark as ISO8601-1 pattern or UTC epoch time. The default value is the current time. # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database. + # - +recommId+ -> If this bookmark is based on a recommendation request, `recommId` is the id of the clicked recommendation. # def initialize(user_id, item_id, optional = {}) @user_id = user_id @@ -29,11 +30,12 @@ def initialize(user_id, item_id, optional = {}) optional = normalize_optional(optional) @timestamp = optional['timestamp'] @cascade_create = optional['cascadeCreate'] + @recomm_id = optional['recommId'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| - fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate"].include? par + fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId"].include? par end end @@ -49,6 +51,7 @@ def body_parameters p['itemId'] = @item_id p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' + p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p end diff --git a/lib/recombee_api_client/api/add_cart_addition.rb b/lib/recombee_api_client/api/add_cart_addition.rb index 7b178a1..49cd285 100644 --- a/lib/recombee_api_client/api/add_cart_addition.rb +++ b/lib/recombee_api_client/api/add_cart_addition.rb @@ -10,7 +10,7 @@ module RecombeeApiClient #Adds a cart addition of a given item made by a given user. # class AddCartAddition < ApiRequest - attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price + attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :recomm_id attr_accessor :timeout attr_accessor :ensure_https @@ -24,6 +24,7 @@ class AddCartAddition < ApiRequest # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database. # - +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. # - +price+ -> Price of the added item. If `amount` is greater than 1, sum of prices of all the items should be given. + # - +recommId+ -> If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation. # def initialize(user_id, item_id, optional = {}) @user_id = user_id @@ -33,11 +34,12 @@ def initialize(user_id, item_id, optional = {}) @cascade_create = optional['cascadeCreate'] @amount = optional['amount'] @price = optional['price'] + @recomm_id = optional['recommId'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| - fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price"].include? par + fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","recommId"].include? par end end @@ -55,6 +57,7 @@ def body_parameters p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' p['amount'] = @optional['amount'] if @optional.include? 'amount' p['price'] = @optional['price'] if @optional.include? 'price' + p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p end diff --git a/lib/recombee_api_client/api/add_detail_view.rb b/lib/recombee_api_client/api/add_detail_view.rb index ffc22e3..fd3c3c5 100644 --- a/lib/recombee_api_client/api/add_detail_view.rb +++ b/lib/recombee_api_client/api/add_detail_view.rb @@ -10,7 +10,7 @@ module RecombeeApiClient #Adds a detail view of a given item made by a given user. # class AddDetailView < ApiRequest - attr_reader :user_id, :item_id, :timestamp, :duration, :cascade_create + attr_reader :user_id, :item_id, :timestamp, :duration, :cascade_create, :recomm_id attr_accessor :timeout attr_accessor :ensure_https @@ -23,6 +23,7 @@ class AddDetailView < ApiRequest # - +timestamp+ -> UTC timestamp of the view as ISO8601-1 pattern or UTC epoch time. The default value is the current time. # - +duration+ -> Duration of the view # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database. + # - +recommId+ -> If this detail view is based on a recommendation request, `recommId` is the id of the clicked recommendation. # def initialize(user_id, item_id, optional = {}) @user_id = user_id @@ -31,11 +32,12 @@ def initialize(user_id, item_id, optional = {}) @timestamp = optional['timestamp'] @duration = optional['duration'] @cascade_create = optional['cascadeCreate'] + @recomm_id = optional['recommId'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| - fail UnknownOptionalParameter.new(par) unless ["timestamp","duration","cascadeCreate"].include? par + fail UnknownOptionalParameter.new(par) unless ["timestamp","duration","cascadeCreate","recommId"].include? par end end @@ -52,6 +54,7 @@ def body_parameters p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' p['duration'] = @optional['duration'] if @optional.include? 'duration' p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' + p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p end diff --git a/lib/recombee_api_client/api/add_item_property.rb b/lib/recombee_api_client/api/add_item_property.rb index 4ad494b..c5233a2 100644 --- a/lib/recombee_api_client/api/add_item_property.rb +++ b/lib/recombee_api_client/api/add_item_property.rb @@ -20,6 +20,22 @@ class AddItemProperty < ApiRequest # # - +type+ -> Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`. # + #* `int`- Signed integer number. + # + #* `double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard). + # + #* `string` - UTF-8 string. + # + #* `boolean` - *true* / *false* + # + #* `timestamp` - Value representing date and time. + # + #* `set` - Set of strings. + # + #* `image` - URL of an image (`jpeg`, `png` or `gif`). + # + #* `imageList` - List of URLs that refer to images. + # # def initialize(property_name, type) @property_name = property_name diff --git a/lib/recombee_api_client/api/add_purchase.rb b/lib/recombee_api_client/api/add_purchase.rb index f643c79..89ae8b2 100644 --- a/lib/recombee_api_client/api/add_purchase.rb +++ b/lib/recombee_api_client/api/add_purchase.rb @@ -10,7 +10,7 @@ module RecombeeApiClient #Adds a purchase of a given item made by a given user. # class AddPurchase < ApiRequest - attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :profit + attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :profit, :recomm_id attr_accessor :timeout attr_accessor :ensure_https @@ -25,6 +25,7 @@ class AddPurchase < ApiRequest # - +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. # - +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. # - +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. + # - +recommId+ -> If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation. # def initialize(user_id, item_id, optional = {}) @user_id = user_id @@ -35,11 +36,12 @@ def initialize(user_id, item_id, optional = {}) @amount = optional['amount'] @price = optional['price'] @profit = optional['profit'] + @recomm_id = optional['recommId'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| - fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","profit"].include? par + fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","amount","price","profit","recommId"].include? par end end @@ -58,6 +60,7 @@ def body_parameters p['amount'] = @optional['amount'] if @optional.include? 'amount' p['price'] = @optional['price'] if @optional.include? 'price' p['profit'] = @optional['profit'] if @optional.include? 'profit' + p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p end diff --git a/lib/recombee_api_client/api/add_rating.rb b/lib/recombee_api_client/api/add_rating.rb index c3937f8..291af40 100644 --- a/lib/recombee_api_client/api/add_rating.rb +++ b/lib/recombee_api_client/api/add_rating.rb @@ -10,7 +10,7 @@ module RecombeeApiClient #Adds a rating of given item made by a given user. # class AddRating < ApiRequest - attr_reader :user_id, :item_id, :timestamp, :rating, :cascade_create + attr_reader :user_id, :item_id, :timestamp, :rating, :cascade_create, :recomm_id attr_accessor :timeout attr_accessor :ensure_https @@ -23,6 +23,7 @@ class AddRating < ApiRequest # * *Optional arguments (given as hash optional)* # - +timestamp+ -> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time. # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database. + # - +recommId+ -> If this rating is based on a recommendation request, `recommId` is the id of the clicked recommendation. # def initialize(user_id, item_id, rating, optional = {}) @user_id = user_id @@ -31,11 +32,12 @@ def initialize(user_id, item_id, rating, optional = {}) optional = normalize_optional(optional) @timestamp = optional['timestamp'] @cascade_create = optional['cascadeCreate'] + @recomm_id = optional['recommId'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| - fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate"].include? par + fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId"].include? par end end @@ -52,6 +54,7 @@ def body_parameters p['rating'] = @rating p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' + p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p end diff --git a/lib/recombee_api_client/api/add_user_property.rb b/lib/recombee_api_client/api/add_user_property.rb index ba34cf7..04b63db 100644 --- a/lib/recombee_api_client/api/add_user_property.rb +++ b/lib/recombee_api_client/api/add_user_property.rb @@ -18,7 +18,19 @@ class AddUserProperty < ApiRequest # * *Required arguments* # - +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. # - # - +type+ -> Value type of the user property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set` + # - +type+ -> Value type of the user property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`. + # + #* `int` - Signed integer number. + # + #* `double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard). + # + #* `string` - UTF-8 string. + # + #* `boolean` - *true* / *false* + # + #* `timestamp` - Value representing date and time. + # + #* `set` - Set of strings. # # def initialize(property_name, type) diff --git a/lib/recombee_api_client/api/merge_users.rb b/lib/recombee_api_client/api/merge_users.rb index 3608287..3daceec 100644 --- a/lib/recombee_api_client/api/merge_users.rb +++ b/lib/recombee_api_client/api/merge_users.rb @@ -10,7 +10,7 @@ module RecombeeApiClient #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. # # - #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`. + #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**. # class MergeUsers < ApiRequest attr_reader :target_user_id, :source_user_id, :cascade_create diff --git a/lib/recombee_api_client/api/set_view_portion.rb b/lib/recombee_api_client/api/set_view_portion.rb index 9133d1c..e2b3541 100644 --- a/lib/recombee_api_client/api/set_view_portion.rb +++ b/lib/recombee_api_client/api/set_view_portion.rb @@ -11,7 +11,7 @@ module RecombeeApiClient #If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated. # class SetViewPortion < ApiRequest - attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create + attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create, :recomm_id attr_accessor :timeout attr_accessor :ensure_https @@ -25,6 +25,7 @@ class SetViewPortion < ApiRequest # - +sessionId+ -> ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language). # - +timestamp+ -> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time. # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database. + # - +recommId+ -> If this view portion is based on a recommendation request, `recommId` is the id of the clicked recommendation. # def initialize(user_id, item_id, portion, optional = {}) @user_id = user_id @@ -34,11 +35,12 @@ def initialize(user_id, item_id, portion, optional = {}) @session_id = optional['sessionId'] @timestamp = optional['timestamp'] @cascade_create = optional['cascadeCreate'] + @recomm_id = optional['recommId'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| - fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate"].include? par + fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate","recommId"].include? par end end @@ -56,6 +58,7 @@ def body_parameters p['sessionId'] = @optional['sessionId'] if @optional.include? 'sessionId' p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' + p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p end diff --git a/lib/recombee_api_client/version.rb b/lib/recombee_api_client/version.rb index 355951d..cf30425 100644 --- a/lib/recombee_api_client/version.rb +++ b/lib/recombee_api_client/version.rb @@ -1,3 +1,3 @@ module RecombeeApiClient - VERSION = '2.1.0' + VERSION = '2.2.0' end