recombee_api_client 5.1.0 → 6.0.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/api/add_bookmark.rb +26 -26
- data/lib/recombee_api_client/api/add_cart_addition.rb +28 -28
- data/lib/recombee_api_client/api/add_detail_view.rb +32 -28
- data/lib/recombee_api_client/api/add_item.rb +15 -18
- data/lib/recombee_api_client/api/add_item_property.rb +34 -35
- data/lib/recombee_api_client/api/add_manual_reql_segment.rb +26 -27
- data/lib/recombee_api_client/api/add_purchase.rb +29 -29
- data/lib/recombee_api_client/api/add_rating.rb +27 -27
- data/lib/recombee_api_client/api/add_search_synonym.rb +29 -30
- data/lib/recombee_api_client/api/add_series.rb +20 -21
- data/lib/recombee_api_client/api/add_user.rb +14 -17
- data/lib/recombee_api_client/api/add_user_property.rb +30 -31
- data/lib/recombee_api_client/api/batch.rb +12 -16
- data/lib/recombee_api_client/api/composite_recommendation.rb +132 -0
- data/lib/recombee_api_client/api/create_auto_reql_segmentation.rb +29 -30
- data/lib/recombee_api_client/api/create_manual_reql_segmentation.rb +27 -28
- data/lib/recombee_api_client/api/create_property_based_segmentation.rb +30 -31
- data/lib/recombee_api_client/api/delete_all_search_synonyms.rb +15 -19
- data/lib/recombee_api_client/api/delete_bookmark.rb +21 -22
- data/lib/recombee_api_client/api/delete_cart_addition.rb +21 -22
- data/lib/recombee_api_client/api/delete_detail_view.rb +21 -22
- data/lib/recombee_api_client/api/delete_item.rb +16 -19
- data/lib/recombee_api_client/api/delete_item_property.rb +15 -18
- data/lib/recombee_api_client/api/delete_manual_reql_segment.rb +16 -19
- data/lib/recombee_api_client/api/delete_more_items.rb +18 -19
- data/lib/recombee_api_client/api/delete_purchase.rb +21 -22
- data/lib/recombee_api_client/api/delete_rating.rb +21 -22
- data/lib/recombee_api_client/api/delete_search_synonym.rb +15 -18
- data/lib/recombee_api_client/api/delete_segmentation.rb +15 -18
- data/lib/recombee_api_client/api/delete_series.rb +21 -22
- data/lib/recombee_api_client/api/delete_user.rb +15 -18
- data/lib/recombee_api_client/api/delete_user_property.rb +15 -18
- data/lib/recombee_api_client/api/delete_view_portion.rb +21 -22
- data/lib/recombee_api_client/api/get_item_property_info.rb +14 -17
- data/lib/recombee_api_client/api/get_item_values.rb +15 -18
- data/lib/recombee_api_client/api/get_segmentation.rb +15 -18
- data/lib/recombee_api_client/api/get_user_property_info.rb +15 -18
- data/lib/recombee_api_client/api/get_user_values.rb +15 -18
- data/lib/recombee_api_client/api/insert_to_series.rb +23 -24
- data/lib/recombee_api_client/api/list_item_bookmarks.rb +16 -19
- data/lib/recombee_api_client/api/list_item_cart_additions.rb +16 -19
- data/lib/recombee_api_client/api/list_item_detail_views.rb +16 -19
- data/lib/recombee_api_client/api/list_item_properties.rb +15 -19
- data/lib/recombee_api_client/api/list_item_purchases.rb +16 -19
- data/lib/recombee_api_client/api/list_item_ratings.rb +16 -19
- data/lib/recombee_api_client/api/list_item_view_portions.rb +16 -19
- data/lib/recombee_api_client/api/list_items.rb +62 -62
- data/lib/recombee_api_client/api/list_scenarios.rb +15 -19
- data/lib/recombee_api_client/api/list_search_synonyms.rb +20 -21
- data/lib/recombee_api_client/api/list_segmentations.rb +16 -17
- data/lib/recombee_api_client/api/list_series.rb +15 -19
- data/lib/recombee_api_client/api/list_series_items.rb +15 -18
- data/lib/recombee_api_client/api/list_user_bookmarks.rb +15 -18
- data/lib/recombee_api_client/api/list_user_cart_additions.rb +15 -18
- data/lib/recombee_api_client/api/list_user_detail_views.rb +15 -18
- data/lib/recombee_api_client/api/list_user_properties.rb +15 -19
- data/lib/recombee_api_client/api/list_user_purchases.rb +15 -18
- data/lib/recombee_api_client/api/list_user_ratings.rb +15 -18
- data/lib/recombee_api_client/api/list_user_view_portions.rb +15 -18
- data/lib/recombee_api_client/api/list_users.rb +56 -56
- data/lib/recombee_api_client/api/merge_users.rb +24 -25
- data/lib/recombee_api_client/api/recommend_item_segments_to_item.rb +69 -68
- data/lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb +70 -69
- data/lib/recombee_api_client/api/recommend_item_segments_to_user.rb +51 -50
- data/lib/recombee_api_client/api/recommend_items_to_item.rb +185 -139
- data/lib/recombee_api_client/api/recommend_items_to_item_segment.rb +181 -138
- data/lib/recombee_api_client/api/recommend_items_to_user.rb +165 -122
- data/lib/recombee_api_client/api/recommend_next_items.rb +24 -25
- data/lib/recombee_api_client/api/recommend_users_to_item.rb +151 -105
- data/lib/recombee_api_client/api/recommend_users_to_user.rb +154 -111
- data/lib/recombee_api_client/api/remove_from_series.rb +17 -18
- data/lib/recombee_api_client/api/request.rb +1 -1
- data/lib/recombee_api_client/api/reset_database.rb +15 -19
- data/lib/recombee_api_client/api/search_item_segments.rb +52 -51
- data/lib/recombee_api_client/api/search_items.rb +157 -114
- data/lib/recombee_api_client/api/set_item_values.rb +28 -29
- data/lib/recombee_api_client/api/set_user_values.rb +21 -22
- data/lib/recombee_api_client/api/set_values.rb +28 -28
- data/lib/recombee_api_client/api/set_view_portion.rb +37 -30
- data/lib/recombee_api_client/api/update_auto_reql_segmentation.rb +26 -27
- data/lib/recombee_api_client/api/update_manual_reql_segment.rb +25 -26
- data/lib/recombee_api_client/api/update_manual_reql_segmentation.rb +24 -25
- data/lib/recombee_api_client/api/update_more_items.rb +19 -20
- data/lib/recombee_api_client/api/update_property_based_segmentation.rb +26 -27
- data/lib/recombee_api_client/errors.rb +2 -5
- data/lib/recombee_api_client/inputs/composite_recommendation_stage_parameters.rb +240 -0
- data/lib/recombee_api_client/inputs/input.rb +9 -0
- data/lib/recombee_api_client/inputs/logic.rb +45 -0
- data/lib/recombee_api_client/utils/hash_normalizer.rb +21 -0
- data/lib/recombee_api_client/version.rb +1 -1
- data/lib/recombee_api_client.rb +40 -35
- data/recombee_api_client.gemspec +2 -3
- metadata +14 -10
- data/lib/recombee_api_client/api/hash_normalizer.rb +0 -21
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
module RecombeeApiClient
|
|
2
2
|
require_relative 'set_values'
|
|
3
3
|
require_relative '../errors'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
##
|
|
6
|
-
#Set/update (some) property values of a given item. The properties (columns) must be previously created by [Add item property](https://docs.recombee.com/api#add-item-property).
|
|
6
|
+
# Set/update (some) property values of a given item. The properties (columns) must be previously created by [Add item property](https://docs.recombee.com/api#add-item-property).
|
|
7
7
|
#
|
|
8
8
|
class SetItemValues < SetValues
|
|
9
9
|
attr_reader :item_id
|
|
10
|
-
attr_accessor :timeout
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
#
|
|
10
|
+
attr_accessor :timeout, :ensure_https
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
# * *Required arguments*
|
|
14
|
+
# - +item_id+ -> ID of the item which will be modified.
|
|
15
|
+
#
|
|
16
|
+
# - +values+ -> The values for the individual properties.
|
|
17
|
+
#
|
|
18
|
+
# Example of body:
|
|
19
|
+
# ```
|
|
20
|
+
# {
|
|
21
|
+
# "product_description": "4K TV with 3D feature",
|
|
22
|
+
# "categories": ["Electronics", "Televisions"],
|
|
23
|
+
# "price_usd": 342,
|
|
24
|
+
# "in_stock_from": "2016-11-16T08:00Z",
|
|
25
|
+
# "!cascadeCreate": true
|
|
26
|
+
# }
|
|
27
|
+
# ```
|
|
28
|
+
#
|
|
29
|
+
# Special parameter `!cascadeCreate` may be used. It indicates that the item of the given itemId should be created if it does not exist in the database, as if the corresponding PUT method was used. Note the exclamation mark (!) at the beginning of the parameter's name to distinguish it from item property names.
|
|
30
|
+
#
|
|
31
|
+
#
|
|
32
|
+
# * *Optional arguments (given as hash optional)*
|
|
33
|
+
# - +cascadeCreate+ -> Sets whether the item should be created if not present in the database.
|
|
34
|
+
#
|
|
36
35
|
def initialize(item_id, values, optional = {})
|
|
37
36
|
super(values, optional)
|
|
38
37
|
@item_id = item_id
|
|
39
38
|
@timeout = 1000
|
|
40
39
|
@ensure_https = false
|
|
41
40
|
end
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
# Relative path to the endpoint
|
|
44
43
|
def path
|
|
45
44
|
"/{databaseId}/items/#{@item_id}"
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
module RecombeeApiClient
|
|
2
2
|
require_relative 'set_values'
|
|
3
3
|
require_relative '../errors'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
##
|
|
6
|
-
#Set/update (some) property values of a given user. The properties (columns) must be previously created by [Add user property](https://docs.recombee.com/api#add-user-property).
|
|
6
|
+
# Set/update (some) property values of a given user. The properties (columns) must be previously created by [Add user property](https://docs.recombee.com/api#add-user-property).
|
|
7
7
|
#
|
|
8
8
|
class SetUserValues < SetValues
|
|
9
9
|
attr_reader :user_id
|
|
10
|
-
attr_accessor :timeout
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
10
|
+
attr_accessor :timeout, :ensure_https
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
# * *Required arguments*
|
|
14
|
+
# - +user_id+ -> ID of the user which will be modified.
|
|
15
|
+
#
|
|
16
|
+
# - +values+ -> The values for the individual properties.
|
|
17
|
+
#
|
|
18
|
+
# Example of body:
|
|
19
|
+
# ```
|
|
20
|
+
# {
|
|
21
|
+
# "country": "US",
|
|
22
|
+
# "sex": "F",
|
|
23
|
+
# }
|
|
24
|
+
# ```
|
|
25
|
+
#
|
|
26
|
+
# * *Optional arguments (given as hash optional)*
|
|
27
|
+
# - +cascadeCreate+ -> Sets whether the item should be created if not present in the database.
|
|
28
|
+
#
|
|
30
29
|
def initialize(user_id, values, optional = {})
|
|
31
30
|
super(values, optional)
|
|
32
31
|
@user_id = user_id
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
module RecombeeApiClient
|
|
2
2
|
require_relative 'request'
|
|
3
3
|
require_relative '../errors'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
##
|
|
6
|
-
#Set/update (some) property values of a given entity.
|
|
6
|
+
# Set/update (some) property values of a given entity.
|
|
7
7
|
#
|
|
8
8
|
class SetValues < ApiRequest
|
|
9
9
|
attr_reader :cascade_create, :values
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def initialize(
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# * *Required arguments*
|
|
13
|
+
# - +values+ -> The values for the individual properties.
|
|
14
|
+
#
|
|
15
|
+
# Example of body:
|
|
16
|
+
# ```
|
|
17
|
+
# {
|
|
18
|
+
# "product_description": "4K TV with 3D feature",
|
|
19
|
+
# "categories": ["Electronics", "Televisions"],
|
|
20
|
+
# "price_usd": 342,
|
|
21
|
+
# "in_stock_from": "2016-11-16T08:00Z",
|
|
22
|
+
# }
|
|
23
|
+
# ```
|
|
24
|
+
#
|
|
25
|
+
# * *Optional arguments (given as hash optional)*
|
|
26
|
+
# - +cascadeCreate+ -> Sets whether the item should be created if not present in the database.
|
|
27
|
+
#
|
|
28
|
+
def initialize(values, optional = {})
|
|
29
29
|
@values = values
|
|
30
|
-
optional =
|
|
30
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
31
31
|
@cascade_create = optional['cascadeCreate']
|
|
32
32
|
@optional = optional
|
|
33
33
|
@optional.each do |par, _|
|
|
34
|
-
|
|
34
|
+
raise UnknownOptionalParameter.new(par) unless ['cascadeCreate'].include? par
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
# HTTP method
|
|
39
39
|
def method
|
|
40
40
|
:post
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
# Values of body parameters as a Hash
|
|
44
44
|
def body_parameters
|
|
45
|
-
result =
|
|
45
|
+
result = {}
|
|
46
46
|
result = result.merge(@values)
|
|
47
47
|
result['!cascadeCreate'] = true if @cascade_create
|
|
48
48
|
result
|
|
49
49
|
end
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
# Values of query parameters as a Hash.
|
|
52
52
|
# name of parameter => value of the parameter
|
|
53
53
|
def query_parameters
|
|
54
|
-
|
|
54
|
+
{}
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
end
|
|
@@ -5,55 +5,60 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Sets viewed portion of an item (for example a video or article) by a user (at a session).
|
|
11
|
-
#If you send a new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.
|
|
10
|
+
# Sets viewed portion of an item (for example a video or article) by a user (at a session).
|
|
11
|
+
# If you send a 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, :additional_data
|
|
15
|
-
|
|
16
|
-
attr_accessor :ensure_https
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
attr_reader :user_id, :item_id, :portion, :session_id, :timestamp, :cascade_create, :recomm_id, :additional_data,
|
|
15
|
+
:auto_presented, :time_spent
|
|
16
|
+
attr_accessor :timeout, :ensure_https
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
# * *Required arguments*
|
|
20
|
+
# - +user_id+ -> User who viewed a portion of the item
|
|
21
|
+
# - +item_id+ -> Viewed item
|
|
22
|
+
# - +portion+ -> Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the actual viewed part of the item, no matter the seeking. 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`.
|
|
23
|
+
#
|
|
24
|
+
# * *Optional arguments (given as hash optional)*
|
|
25
|
+
# - +sessionId+ -> ID of the session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc., depending on the language).
|
|
26
|
+
# - +timestamp+ -> UTC timestamp of the view portion as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
|
|
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.
|
|
29
|
+
# - +additionalData+ -> A dictionary of additional data for the interaction.
|
|
30
|
+
# - +autoPresented+ -> Indicates whether the item was automatically presented to the user (e.g., in a swiping feed) or explicitly requested by the user (e.g., by clicking on a link). Defaults to `false`.
|
|
31
|
+
# - +timeSpent+ -> The duration (in seconds) that the user viewed the item. In update requests, this value may only increase and is required only if it has changed.
|
|
32
|
+
#
|
|
31
33
|
def initialize(user_id, item_id, portion, optional = {})
|
|
32
34
|
@user_id = user_id
|
|
33
35
|
@item_id = item_id
|
|
34
36
|
@portion = portion
|
|
35
|
-
optional =
|
|
37
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
36
38
|
@session_id = optional['sessionId']
|
|
37
39
|
@timestamp = optional['timestamp']
|
|
38
40
|
@cascade_create = optional['cascadeCreate']
|
|
39
41
|
@recomm_id = optional['recommId']
|
|
40
42
|
@additional_data = optional['additionalData']
|
|
43
|
+
@auto_presented = optional['autoPresented']
|
|
44
|
+
@time_spent = optional['timeSpent']
|
|
41
45
|
@optional = optional
|
|
42
46
|
@timeout = 3000
|
|
43
47
|
@ensure_https = false
|
|
44
48
|
@optional.each do |par, _|
|
|
45
|
-
|
|
49
|
+
raise UnknownOptionalParameter.new(par) unless %w[sessionId timestamp cascadeCreate recommId
|
|
50
|
+
additionalData autoPresented timeSpent].include? par
|
|
46
51
|
end
|
|
47
52
|
end
|
|
48
|
-
|
|
53
|
+
|
|
49
54
|
# HTTP method
|
|
50
55
|
def method
|
|
51
56
|
:post
|
|
52
57
|
end
|
|
53
|
-
|
|
58
|
+
|
|
54
59
|
# Values of body parameters as a Hash
|
|
55
60
|
def body_parameters
|
|
56
|
-
p =
|
|
61
|
+
p = {}
|
|
57
62
|
p['userId'] = @user_id
|
|
58
63
|
p['itemId'] = @item_id
|
|
59
64
|
p['portion'] = @portion
|
|
@@ -62,19 +67,21 @@ module RecombeeApiClient
|
|
|
62
67
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
|
63
68
|
p['recommId'] = @optional['recommId'] if @optional.include? 'recommId'
|
|
64
69
|
p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData'
|
|
70
|
+
p['autoPresented'] = @optional['autoPresented'] if @optional.include? 'autoPresented'
|
|
71
|
+
p['timeSpent'] = @optional['timeSpent'] if @optional.include? 'timeSpent'
|
|
72
|
+
|
|
65
73
|
p
|
|
66
74
|
end
|
|
67
|
-
|
|
75
|
+
|
|
68
76
|
# Values of query parameters as a Hash.
|
|
69
77
|
# name of parameter => value of the parameter
|
|
70
78
|
def query_parameters
|
|
71
|
-
|
|
72
|
-
params
|
|
79
|
+
{}
|
|
73
80
|
end
|
|
74
|
-
|
|
81
|
+
|
|
75
82
|
# Relative path to the endpoint
|
|
76
83
|
def path
|
|
77
|
-
|
|
84
|
+
'/{databaseId}/viewportions/'
|
|
78
85
|
end
|
|
79
86
|
end
|
|
80
87
|
end
|
|
@@ -5,62 +5,61 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Update an existing Segmentation.
|
|
10
|
+
# Update an existing Segmentation.
|
|
11
11
|
#
|
|
12
12
|
class UpdateAutoReqlSegmentation < ApiRequest
|
|
13
13
|
attr_reader :segmentation_id, :expression, :title, :description
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +segmentation_id+ -> ID of the updated Segmentation
|
|
19
|
+
#
|
|
20
|
+
# * *Optional arguments (given as hash optional)*
|
|
21
|
+
# - +expression+ -> ReQL expression that returns for each item a set with IDs of segments to which the item belongs
|
|
22
|
+
#
|
|
23
|
+
# - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
|
|
24
|
+
#
|
|
25
|
+
# - +description+ -> Description that is shown in the Recombee Admin UI.
|
|
26
|
+
#
|
|
27
|
+
#
|
|
29
28
|
def initialize(segmentation_id, optional = {})
|
|
30
29
|
@segmentation_id = segmentation_id
|
|
31
|
-
optional =
|
|
30
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
32
31
|
@expression = optional['expression']
|
|
33
32
|
@title = optional['title']
|
|
34
33
|
@description = optional['description']
|
|
35
34
|
@optional = optional
|
|
36
|
-
@timeout =
|
|
35
|
+
@timeout = 10_000
|
|
37
36
|
@ensure_https = false
|
|
38
37
|
@optional.each do |par, _|
|
|
39
|
-
|
|
38
|
+
raise UnknownOptionalParameter.new(par) unless %w[expression title description].include? par
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
# HTTP method
|
|
44
43
|
def method
|
|
45
44
|
:post
|
|
46
45
|
end
|
|
47
|
-
|
|
46
|
+
|
|
48
47
|
# Values of body parameters as a Hash
|
|
49
48
|
def body_parameters
|
|
50
|
-
p =
|
|
49
|
+
p = {}
|
|
51
50
|
p['expression'] = @optional['expression'] if @optional.include? 'expression'
|
|
52
51
|
p['title'] = @optional['title'] if @optional.include? 'title'
|
|
53
52
|
p['description'] = @optional['description'] if @optional.include? 'description'
|
|
53
|
+
|
|
54
54
|
p
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
# Values of query parameters as a Hash.
|
|
58
58
|
# name of parameter => value of the parameter
|
|
59
59
|
def query_parameters
|
|
60
|
-
|
|
61
|
-
params
|
|
60
|
+
{}
|
|
62
61
|
end
|
|
63
|
-
|
|
62
|
+
|
|
64
63
|
# Relative path to the endpoint
|
|
65
64
|
def path
|
|
66
65
|
"/{databaseId}/segmentations/auto-reql/#{@segmentation_id}"
|
|
@@ -5,60 +5,59 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Update definition of the Segment.
|
|
10
|
+
# Update definition of the Segment.
|
|
11
11
|
#
|
|
12
12
|
class UpdateManualReqlSegment < ApiRequest
|
|
13
13
|
attr_reader :segmentation_id, :segment_id, :filter, :title
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +segmentation_id+ -> ID of the Segmentation to which the updated Segment belongs
|
|
19
|
+
# - +segment_id+ -> ID of the Segment that will be updated
|
|
20
|
+
# - +filter+ -> ReQL filter that returns `true` for items that belong to this Segment. Otherwise returns `false`.
|
|
21
|
+
#
|
|
22
|
+
#
|
|
23
|
+
# * *Optional arguments (given as hash optional)*
|
|
24
|
+
# - +title+ -> Human-readable name of the Segment that is shown in the Recombee Admin UI.
|
|
25
|
+
#
|
|
26
|
+
#
|
|
28
27
|
def initialize(segmentation_id, segment_id, filter, optional = {})
|
|
29
28
|
@segmentation_id = segmentation_id
|
|
30
29
|
@segment_id = segment_id
|
|
31
30
|
@filter = filter
|
|
32
|
-
optional =
|
|
31
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
33
32
|
@title = optional['title']
|
|
34
33
|
@optional = optional
|
|
35
|
-
@timeout =
|
|
34
|
+
@timeout = 10_000
|
|
36
35
|
@ensure_https = false
|
|
37
36
|
@optional.each do |par, _|
|
|
38
|
-
|
|
37
|
+
raise UnknownOptionalParameter.new(par) unless ['title'].include? par
|
|
39
38
|
end
|
|
40
39
|
end
|
|
41
|
-
|
|
40
|
+
|
|
42
41
|
# HTTP method
|
|
43
42
|
def method
|
|
44
43
|
:post
|
|
45
44
|
end
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
# Values of body parameters as a Hash
|
|
48
47
|
def body_parameters
|
|
49
|
-
p =
|
|
48
|
+
p = {}
|
|
50
49
|
p['filter'] = @filter
|
|
51
50
|
p['title'] = @optional['title'] if @optional.include? 'title'
|
|
51
|
+
|
|
52
52
|
p
|
|
53
53
|
end
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
# Values of query parameters as a Hash.
|
|
56
56
|
# name of parameter => value of the parameter
|
|
57
57
|
def query_parameters
|
|
58
|
-
|
|
59
|
-
params
|
|
58
|
+
{}
|
|
60
59
|
end
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
# Relative path to the endpoint
|
|
63
62
|
def path
|
|
64
63
|
"/{databaseId}/segmentations/manual-reql/#{@segmentation_id}/segments/#{@segment_id}"
|
|
@@ -5,58 +5,57 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Update an existing Segmentation.
|
|
10
|
+
# Update an existing Segmentation.
|
|
11
11
|
#
|
|
12
12
|
class UpdateManualReqlSegmentation < ApiRequest
|
|
13
13
|
attr_reader :segmentation_id, :title, :description
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +segmentation_id+ -> ID of the updated Segmentation
|
|
19
|
+
#
|
|
20
|
+
# * *Optional arguments (given as hash optional)*
|
|
21
|
+
# - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
|
|
22
|
+
#
|
|
23
|
+
# - +description+ -> Description that is shown in the Recombee Admin UI.
|
|
24
|
+
#
|
|
25
|
+
#
|
|
27
26
|
def initialize(segmentation_id, optional = {})
|
|
28
27
|
@segmentation_id = segmentation_id
|
|
29
|
-
optional =
|
|
28
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
30
29
|
@title = optional['title']
|
|
31
30
|
@description = optional['description']
|
|
32
31
|
@optional = optional
|
|
33
|
-
@timeout =
|
|
32
|
+
@timeout = 10_000
|
|
34
33
|
@ensure_https = false
|
|
35
34
|
@optional.each do |par, _|
|
|
36
|
-
|
|
35
|
+
raise UnknownOptionalParameter.new(par) unless %w[title description].include? par
|
|
37
36
|
end
|
|
38
37
|
end
|
|
39
|
-
|
|
38
|
+
|
|
40
39
|
# HTTP method
|
|
41
40
|
def method
|
|
42
41
|
:post
|
|
43
42
|
end
|
|
44
|
-
|
|
43
|
+
|
|
45
44
|
# Values of body parameters as a Hash
|
|
46
45
|
def body_parameters
|
|
47
|
-
p =
|
|
46
|
+
p = {}
|
|
48
47
|
p['title'] = @optional['title'] if @optional.include? 'title'
|
|
49
48
|
p['description'] = @optional['description'] if @optional.include? 'description'
|
|
49
|
+
|
|
50
50
|
p
|
|
51
51
|
end
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
# Values of query parameters as a Hash.
|
|
54
54
|
# name of parameter => value of the parameter
|
|
55
55
|
def query_parameters
|
|
56
|
-
|
|
57
|
-
params
|
|
56
|
+
{}
|
|
58
57
|
end
|
|
59
|
-
|
|
58
|
+
|
|
60
59
|
# Relative path to the endpoint
|
|
61
60
|
def path
|
|
62
61
|
"/{databaseId}/segmentations/manual-reql/#{@segmentation_id}"
|