Skip to content

Commit a5fe6d9

Browse files
committed
Support Item Segmentations
1 parent 12b77c9 commit a5fe6d9

File tree

102 files changed

+1898
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1898
-191
lines changed

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/4.0.0'}
21+
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/4.1.0'}
2222

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

lib/recombee_api_client/api/add_bookmark.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#Adds a bookmark of a given item made by a given user.
10+
#Adds a bookmark of the given item made by the given user.
1111
#
1212
class AddBookmark < ApiRequest
1313
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :recomm_id, :additional_data

lib/recombee_api_client/api/add_cart_addition.rb

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

99
##
10-
#Adds a cart addition of a given item made by a given user.
10+
#Adds a cart addition of the given item made by the given user.
1111
#
1212
class AddCartAddition < ApiRequest
1313
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :recomm_id, :additional_data
@@ -22,8 +22,8 @@ class AddCartAddition < ApiRequest
2222
# * *Optional arguments (given as hash optional)*
2323
# - +timestamp+ -> UTC timestamp of the cart addition as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
2424
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
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-
# - +price+ -> Price of the added item. If `amount` is greater than 1, sum of prices of all the items should be given.
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 2.
26+
# - +price+ -> Price of the added item. If `amount` is greater than 1, the sum of prices of all the items should be given.
2727
# - +recommId+ -> If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.
2828
# - +additionalData+ -> A dictionary of additional data for the interaction.
2929
#

lib/recombee_api_client/api/add_detail_view.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#Adds a detail view of a given item made by a given user.
10+
#Adds a detail view of the given item made by the given user.
1111
#
1212
class AddDetailView < ApiRequest
1313
attr_reader :user_id, :item_id, :timestamp, :duration, :cascade_create, :recomm_id, :additional_data

lib/recombee_api_client/api/add_group.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#Creates new group in the database.
10+
#Creates a new group in the database.
1111
class AddGroup < ApiRequest
1212
attr_reader :group_id
1313
attr_accessor :timeout

lib/recombee_api_client/api/add_item.rb

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

99
##
10-
#Adds new item of given `itemId` to the items catalog.
10+
#Adds new item of the given `itemId` to the items catalog.
1111
#
12-
#All the item properties for the newly created items are set null.
12+
#All the item properties for the newly created items are set to null.
1313
#
1414
class AddItem < ApiRequest
1515
attr_reader :item_id

lib/recombee_api_client/api/add_item_property.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AddItemProperty < ApiRequest
1616

1717
##
1818
# * *Required arguments*
19-
# - +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.
19+
# - +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
#
2121
# - +type+ -> Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
2222
#
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Adds a new Segment into a Manual ReQL Segmentation.
11+
#
12+
#The new Segment is defined by a [ReQL](https://docs.recombee.com/reql.html) filter that returns `true` for an item in case that this item belongs to the segment.
13+
#
14+
class AddManualReqlSegment < ApiRequest
15+
attr_reader :segmentation_id, :segment_id, :filter, :title
16+
attr_accessor :timeout
17+
attr_accessor :ensure_https
18+
19+
##
20+
# * *Required arguments*
21+
# - +segmentation_id+ -> ID of the Segmentation to which the new Segment should be added
22+
# - +segment_id+ -> ID of the newly created Segment
23+
# - +filter+ -> ReQL filter that returns `true` for items that belong to this Segment. Otherwise returns `false`.
24+
#
25+
#
26+
# * *Optional arguments (given as hash optional)*
27+
# - +title+ -> Human-readable name of the Segment that is shown in the Recombee Admin UI.
28+
#
29+
#
30+
def initialize(segmentation_id, segment_id, filter, optional = {})
31+
@segmentation_id = segmentation_id
32+
@segment_id = segment_id
33+
@filter = filter
34+
optional = normalize_optional(optional)
35+
@title = optional['title']
36+
@optional = optional
37+
@timeout = 10000
38+
@ensure_https = false
39+
@optional.each do |par, _|
40+
fail UnknownOptionalParameter.new(par) unless ["title"].include? par
41+
end
42+
end
43+
44+
# HTTP method
45+
def method
46+
:put
47+
end
48+
49+
# Values of body parameters as a Hash
50+
def body_parameters
51+
p = Hash.new
52+
p['filter'] = @filter
53+
p['title'] = @optional['title'] if @optional.include? 'title'
54+
p
55+
end
56+
57+
# Values of query parameters as a Hash.
58+
# name of parameter => value of the parameter
59+
def query_parameters
60+
params = {}
61+
params
62+
end
63+
64+
# Relative path to the endpoint
65+
def path
66+
"/{databaseId}/segmentations/manual-reql/#{@segmentation_id}/segments/#{@segment_id}"
67+
end
68+
end
69+
end

lib/recombee_api_client/api/add_purchase.rb

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

99
##
10-
#Adds a purchase of a given item made by a given user.
10+
#Adds a purchase of the given item made by the given user.
1111
#
1212
class AddPurchase < ApiRequest
1313
attr_reader :user_id, :item_id, :timestamp, :cascade_create, :amount, :price, :profit, :recomm_id, :additional_data
@@ -22,9 +22,9 @@ class AddPurchase < ApiRequest
2222
# * *Optional arguments (given as hash optional)*
2323
# - +timestamp+ -> UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
2424
# - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database.
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-
# - +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-
# - +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.
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 2.
26+
# - +price+ -> Price paid by the user for the item. If `amount` is greater than 1, the sum of prices of all the items should be given.
27+
# - +profit+ -> Your profit from the purchased item. The profit is natural in the 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 also applicable in other domains (for example, at a news company it may be income from a displayed advertisement on article page). If `amount` is greater than 1, the sum of profit of all the items should be given.
2828
# - +recommId+ -> If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.
2929
# - +additionalData+ -> A dictionary of additional data for the interaction.
3030
#

lib/recombee_api_client/api/add_rating.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module RecombeeApiClient
77
require_relative '../errors'
88

99
##
10-
#Adds a rating of given item made by a given user.
10+
#Adds a rating of the given item made by the given user.
1111
#
1212
class AddRating < ApiRequest
1313
attr_reader :user_id, :item_id, :timestamp, :rating, :cascade_create, :recomm_id, :additional_data

0 commit comments

Comments
 (0)