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
|
@@ -5,47 +5,45 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deletes an existing detail view uniquely specified by (`userId`, `itemId`, and `timestamp`) or all the detail views with the given `userId` and `itemId` if `timestamp` is omitted.
|
|
10
|
+
# Deletes an existing detail view uniquely specified by (`userId`, `itemId`, and `timestamp`) or all the detail views with the given `userId` and `itemId` if `timestamp` is omitted.
|
|
11
11
|
#
|
|
12
12
|
class DeleteDetailView < ApiRequest
|
|
13
13
|
attr_reader :user_id, :item_id, :timestamp
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +user_id+ -> ID of the user who made the detail view.
|
|
19
|
+
# - +item_id+ -> ID of the item whose details were viewed.
|
|
20
|
+
#
|
|
21
|
+
# * *Optional arguments (given as hash optional)*
|
|
22
|
+
# - +timestamp+ -> Unix timestamp of the detail view. If the `timestamp` is omitted, then all the detail views with the given `userId` and `itemId` are deleted.
|
|
23
|
+
#
|
|
25
24
|
def initialize(user_id, item_id, optional = {})
|
|
26
25
|
@user_id = user_id
|
|
27
26
|
@item_id = item_id
|
|
28
|
-
optional =
|
|
27
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
29
28
|
@timestamp = optional['timestamp']
|
|
30
29
|
@optional = optional
|
|
31
30
|
@timeout = 3000
|
|
32
31
|
@ensure_https = false
|
|
33
32
|
@optional.each do |par, _|
|
|
34
|
-
|
|
33
|
+
raise UnknownOptionalParameter.new(par) unless ['timestamp'].include? par
|
|
35
34
|
end
|
|
36
35
|
end
|
|
37
|
-
|
|
36
|
+
|
|
38
37
|
# HTTP method
|
|
39
38
|
def method
|
|
40
39
|
:delete
|
|
41
40
|
end
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
# Values of body parameters as a Hash
|
|
44
43
|
def body_parameters
|
|
45
|
-
|
|
46
|
-
p
|
|
44
|
+
{}
|
|
47
45
|
end
|
|
48
|
-
|
|
46
|
+
|
|
49
47
|
# Values of query parameters as a Hash.
|
|
50
48
|
# name of parameter => value of the parameter
|
|
51
49
|
def query_parameters
|
|
@@ -53,12 +51,13 @@ module RecombeeApiClient
|
|
|
53
51
|
params['userId'] = @user_id
|
|
54
52
|
params['itemId'] = @item_id
|
|
55
53
|
params['timestamp'] = @optional['timestamp'] if @optional['timestamp']
|
|
54
|
+
|
|
56
55
|
params
|
|
57
56
|
end
|
|
58
|
-
|
|
57
|
+
|
|
59
58
|
# Relative path to the endpoint
|
|
60
59
|
def path
|
|
61
|
-
|
|
60
|
+
'/{databaseId}/detailviews/'
|
|
62
61
|
end
|
|
63
62
|
end
|
|
64
63
|
end
|
|
@@ -5,47 +5,44 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deletes an item of the given `itemId` from the catalog.
|
|
10
|
+
# Deletes an item of the given `itemId` from the catalog.
|
|
11
11
|
#
|
|
12
|
-
#If there are any *purchases*, *ratings*, *bookmarks*, *cart additions*, or *detail views* of the item present in the database, they will be deleted in cascade as well. Also, if the item is present in some *series*, it will be removed from all the *series* where present.
|
|
12
|
+
# If there are any *purchases*, *ratings*, *bookmarks*, *cart additions*, or *detail views* of the item present in the database, they will be deleted in cascade as well. Also, if the item is present in some *series*, it will be removed from all the *series* where present.
|
|
13
13
|
#
|
|
14
|
-
#If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.
|
|
14
|
+
# If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.
|
|
15
15
|
#
|
|
16
16
|
class DeleteItem < ApiRequest
|
|
17
17
|
attr_reader :item_id
|
|
18
|
-
attr_accessor :timeout
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
18
|
+
attr_accessor :timeout, :ensure_https
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# * *Required arguments*
|
|
22
|
+
# - +item_id+ -> ID of the item to be deleted.
|
|
23
|
+
#
|
|
25
24
|
def initialize(item_id)
|
|
26
25
|
@item_id = item_id
|
|
27
26
|
@timeout = 3000
|
|
28
27
|
@ensure_https = false
|
|
29
28
|
end
|
|
30
|
-
|
|
29
|
+
|
|
31
30
|
# HTTP method
|
|
32
31
|
def method
|
|
33
32
|
:delete
|
|
34
33
|
end
|
|
35
|
-
|
|
34
|
+
|
|
36
35
|
# Values of body parameters as a Hash
|
|
37
36
|
def body_parameters
|
|
38
|
-
|
|
39
|
-
p
|
|
37
|
+
{}
|
|
40
38
|
end
|
|
41
|
-
|
|
39
|
+
|
|
42
40
|
# Values of query parameters as a Hash.
|
|
43
41
|
# name of parameter => value of the parameter
|
|
44
42
|
def query_parameters
|
|
45
|
-
|
|
46
|
-
params
|
|
43
|
+
{}
|
|
47
44
|
end
|
|
48
|
-
|
|
45
|
+
|
|
49
46
|
# Relative path to the endpoint
|
|
50
47
|
def path
|
|
51
48
|
"/{databaseId}/items/#{@item_id}"
|
|
@@ -5,43 +5,40 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deleting an item property is roughly equivalent to removing a column from the table of items.
|
|
10
|
+
# Deleting an item property is roughly equivalent to removing a column from the table of items.
|
|
11
11
|
#
|
|
12
12
|
class DeleteItemProperty < ApiRequest
|
|
13
13
|
attr_reader :property_name
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +property_name+ -> Name of the property to be deleted.
|
|
19
|
+
#
|
|
21
20
|
def initialize(property_name)
|
|
22
21
|
@property_name = property_name
|
|
23
|
-
@timeout =
|
|
22
|
+
@timeout = 100_000
|
|
24
23
|
@ensure_https = false
|
|
25
24
|
end
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
# HTTP method
|
|
28
27
|
def method
|
|
29
28
|
:delete
|
|
30
29
|
end
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
# Values of body parameters as a Hash
|
|
33
32
|
def body_parameters
|
|
34
|
-
|
|
35
|
-
p
|
|
33
|
+
{}
|
|
36
34
|
end
|
|
37
|
-
|
|
35
|
+
|
|
38
36
|
# Values of query parameters as a Hash.
|
|
39
37
|
# name of parameter => value of the parameter
|
|
40
38
|
def query_parameters
|
|
41
|
-
|
|
42
|
-
params
|
|
39
|
+
{}
|
|
43
40
|
end
|
|
44
|
-
|
|
41
|
+
|
|
45
42
|
# Relative path to the endpoint
|
|
46
43
|
def path
|
|
47
44
|
"/{databaseId}/items/properties/#{@property_name}"
|
|
@@ -5,45 +5,42 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Delete a Segment from a Manual ReQL Segmentation.
|
|
10
|
+
# Delete a Segment from a Manual ReQL Segmentation.
|
|
11
11
|
#
|
|
12
12
|
class DeleteManualReqlSegment < ApiRequest
|
|
13
13
|
attr_reader :segmentation_id, :segment_id
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +segmentation_id+ -> ID of the Segmentation from which the Segment should be deleted
|
|
19
|
+
# - +segment_id+ -> ID of the Segment that should be deleted
|
|
20
|
+
#
|
|
22
21
|
def initialize(segmentation_id, segment_id)
|
|
23
22
|
@segmentation_id = segmentation_id
|
|
24
23
|
@segment_id = segment_id
|
|
25
|
-
@timeout =
|
|
24
|
+
@timeout = 10_000
|
|
26
25
|
@ensure_https = false
|
|
27
26
|
end
|
|
28
|
-
|
|
27
|
+
|
|
29
28
|
# HTTP method
|
|
30
29
|
def method
|
|
31
30
|
:delete
|
|
32
31
|
end
|
|
33
|
-
|
|
32
|
+
|
|
34
33
|
# Values of body parameters as a Hash
|
|
35
34
|
def body_parameters
|
|
36
|
-
|
|
37
|
-
p
|
|
35
|
+
{}
|
|
38
36
|
end
|
|
39
|
-
|
|
37
|
+
|
|
40
38
|
# Values of query parameters as a Hash.
|
|
41
39
|
# name of parameter => value of the parameter
|
|
42
40
|
def query_parameters
|
|
43
|
-
|
|
44
|
-
params
|
|
41
|
+
{}
|
|
45
42
|
end
|
|
46
|
-
|
|
43
|
+
|
|
47
44
|
# Relative path to the endpoint
|
|
48
45
|
def path
|
|
49
46
|
"/{databaseId}/segmentations/manual-reql/#{@segmentation_id}/segments/#{@segment_id}"
|
|
@@ -5,48 +5,47 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deletes all the items that pass the filter.
|
|
10
|
+
# Deletes all the items that pass the filter.
|
|
11
11
|
#
|
|
12
|
-
#If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful) and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely
|
|
12
|
+
# If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful) and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.#
|
|
13
13
|
class DeleteMoreItems < ApiRequest
|
|
14
14
|
attr_reader :filter
|
|
15
|
-
attr_accessor :timeout
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
15
|
+
attr_accessor :timeout, :ensure_https
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
# * *Required arguments*
|
|
19
|
+
# - +filter+ -> A [ReQL](https://docs.recombee.com/reql) expression, which returns `true` for the items that shall be updated.
|
|
20
|
+
#
|
|
22
21
|
def initialize(filter)
|
|
23
22
|
@filter = filter
|
|
24
|
-
@timeout =
|
|
23
|
+
@timeout = 100_000
|
|
25
24
|
@ensure_https = false
|
|
26
25
|
end
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
# HTTP method
|
|
29
28
|
def method
|
|
30
29
|
:delete
|
|
31
30
|
end
|
|
32
|
-
|
|
31
|
+
|
|
33
32
|
# Values of body parameters as a Hash
|
|
34
33
|
def body_parameters
|
|
35
|
-
p =
|
|
34
|
+
p = {}
|
|
36
35
|
p['filter'] = @filter
|
|
36
|
+
|
|
37
37
|
p
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
# Values of query parameters as a Hash.
|
|
41
41
|
# name of parameter => value of the parameter
|
|
42
42
|
def query_parameters
|
|
43
|
-
|
|
44
|
-
params
|
|
43
|
+
{}
|
|
45
44
|
end
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
# Relative path to the endpoint
|
|
48
47
|
def path
|
|
49
|
-
|
|
48
|
+
'/{databaseId}/more-items/'
|
|
50
49
|
end
|
|
51
50
|
end
|
|
52
51
|
end
|
|
@@ -5,47 +5,45 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deletes an existing purchase uniquely specified by `userId`, `itemId`, and `timestamp` or all the purchases with the given `userId` and `itemId` if `timestamp` is omitted.
|
|
10
|
+
# Deletes an existing purchase uniquely specified by `userId`, `itemId`, and `timestamp` or all the purchases with the given `userId` and `itemId` if `timestamp` is omitted.
|
|
11
11
|
#
|
|
12
12
|
class DeletePurchase < ApiRequest
|
|
13
13
|
attr_reader :user_id, :item_id, :timestamp
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +user_id+ -> ID of the user who made the purchase.
|
|
19
|
+
# - +item_id+ -> ID of the item which was purchased.
|
|
20
|
+
#
|
|
21
|
+
# * *Optional arguments (given as hash optional)*
|
|
22
|
+
# - +timestamp+ -> Unix timestamp of the purchase. If the `timestamp` is omitted, then all the purchases with the given `userId` and `itemId` are deleted.
|
|
23
|
+
#
|
|
25
24
|
def initialize(user_id, item_id, optional = {})
|
|
26
25
|
@user_id = user_id
|
|
27
26
|
@item_id = item_id
|
|
28
|
-
optional =
|
|
27
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
29
28
|
@timestamp = optional['timestamp']
|
|
30
29
|
@optional = optional
|
|
31
30
|
@timeout = 3000
|
|
32
31
|
@ensure_https = false
|
|
33
32
|
@optional.each do |par, _|
|
|
34
|
-
|
|
33
|
+
raise UnknownOptionalParameter.new(par) unless ['timestamp'].include? par
|
|
35
34
|
end
|
|
36
35
|
end
|
|
37
|
-
|
|
36
|
+
|
|
38
37
|
# HTTP method
|
|
39
38
|
def method
|
|
40
39
|
:delete
|
|
41
40
|
end
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
# Values of body parameters as a Hash
|
|
44
43
|
def body_parameters
|
|
45
|
-
|
|
46
|
-
p
|
|
44
|
+
{}
|
|
47
45
|
end
|
|
48
|
-
|
|
46
|
+
|
|
49
47
|
# Values of query parameters as a Hash.
|
|
50
48
|
# name of parameter => value of the parameter
|
|
51
49
|
def query_parameters
|
|
@@ -53,12 +51,13 @@ module RecombeeApiClient
|
|
|
53
51
|
params['userId'] = @user_id
|
|
54
52
|
params['itemId'] = @item_id
|
|
55
53
|
params['timestamp'] = @optional['timestamp'] if @optional['timestamp']
|
|
54
|
+
|
|
56
55
|
params
|
|
57
56
|
end
|
|
58
|
-
|
|
57
|
+
|
|
59
58
|
# Relative path to the endpoint
|
|
60
59
|
def path
|
|
61
|
-
|
|
60
|
+
'/{databaseId}/purchases/'
|
|
62
61
|
end
|
|
63
62
|
end
|
|
64
63
|
end
|
|
@@ -5,47 +5,45 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deletes an existing rating specified by (`userId`, `itemId`, `timestamp`) from the database or all the ratings with the given `userId` and `itemId` if `timestamp` is omitted.
|
|
10
|
+
# Deletes an existing rating specified by (`userId`, `itemId`, `timestamp`) from the database or all the ratings with the given `userId` and `itemId` if `timestamp` is omitted.
|
|
11
11
|
#
|
|
12
12
|
class DeleteRating < ApiRequest
|
|
13
13
|
attr_reader :user_id, :item_id, :timestamp
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +user_id+ -> ID of the user who rated the item.
|
|
19
|
+
# - +item_id+ -> ID of the item which was rated.
|
|
20
|
+
#
|
|
21
|
+
# * *Optional arguments (given as hash optional)*
|
|
22
|
+
# - +timestamp+ -> Unix timestamp of the rating. If the `timestamp` is omitted, then all the ratings with the given `userId` and `itemId` are deleted.
|
|
23
|
+
#
|
|
25
24
|
def initialize(user_id, item_id, optional = {})
|
|
26
25
|
@user_id = user_id
|
|
27
26
|
@item_id = item_id
|
|
28
|
-
optional =
|
|
27
|
+
optional = normalize_hash_to_camel_case(optional)
|
|
29
28
|
@timestamp = optional['timestamp']
|
|
30
29
|
@optional = optional
|
|
31
30
|
@timeout = 3000
|
|
32
31
|
@ensure_https = false
|
|
33
32
|
@optional.each do |par, _|
|
|
34
|
-
|
|
33
|
+
raise UnknownOptionalParameter.new(par) unless ['timestamp'].include? par
|
|
35
34
|
end
|
|
36
35
|
end
|
|
37
|
-
|
|
36
|
+
|
|
38
37
|
# HTTP method
|
|
39
38
|
def method
|
|
40
39
|
:delete
|
|
41
40
|
end
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
# Values of body parameters as a Hash
|
|
44
43
|
def body_parameters
|
|
45
|
-
|
|
46
|
-
p
|
|
44
|
+
{}
|
|
47
45
|
end
|
|
48
|
-
|
|
46
|
+
|
|
49
47
|
# Values of query parameters as a Hash.
|
|
50
48
|
# name of parameter => value of the parameter
|
|
51
49
|
def query_parameters
|
|
@@ -53,12 +51,13 @@ module RecombeeApiClient
|
|
|
53
51
|
params['userId'] = @user_id
|
|
54
52
|
params['itemId'] = @item_id
|
|
55
53
|
params['timestamp'] = @optional['timestamp'] if @optional['timestamp']
|
|
54
|
+
|
|
56
55
|
params
|
|
57
56
|
end
|
|
58
|
-
|
|
57
|
+
|
|
59
58
|
# Relative path to the endpoint
|
|
60
59
|
def path
|
|
61
|
-
|
|
60
|
+
'/{databaseId}/ratings/'
|
|
62
61
|
end
|
|
63
62
|
end
|
|
64
63
|
end
|
|
@@ -5,43 +5,40 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Deletes synonym of the given `id`. This synonym is no longer taken into account in the [Search items](https://docs.recombee.com/api#search-items).
|
|
10
|
+
# Deletes synonym of the given `id`. This synonym is no longer taken into account in the [Search items](https://docs.recombee.com/api#search-items).
|
|
11
11
|
#
|
|
12
12
|
class DeleteSearchSynonym < ApiRequest
|
|
13
13
|
attr_reader :id
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +id+ -> ID of the synonym that should be deleted.
|
|
19
|
+
#
|
|
21
20
|
def initialize(id)
|
|
22
21
|
@id = id
|
|
23
|
-
@timeout =
|
|
22
|
+
@timeout = 10_000
|
|
24
23
|
@ensure_https = false
|
|
25
24
|
end
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
# HTTP method
|
|
28
27
|
def method
|
|
29
28
|
:delete
|
|
30
29
|
end
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
# Values of body parameters as a Hash
|
|
33
32
|
def body_parameters
|
|
34
|
-
|
|
35
|
-
p
|
|
33
|
+
{}
|
|
36
34
|
end
|
|
37
|
-
|
|
35
|
+
|
|
38
36
|
# Values of query parameters as a Hash.
|
|
39
37
|
# name of parameter => value of the parameter
|
|
40
38
|
def query_parameters
|
|
41
|
-
|
|
42
|
-
params
|
|
39
|
+
{}
|
|
43
40
|
end
|
|
44
|
-
|
|
41
|
+
|
|
45
42
|
# Relative path to the endpoint
|
|
46
43
|
def path
|
|
47
44
|
"/{databaseId}/synonyms/items/#{@id}"
|
|
@@ -5,43 +5,40 @@
|
|
|
5
5
|
module RecombeeApiClient
|
|
6
6
|
require_relative 'request'
|
|
7
7
|
require_relative '../errors'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
##
|
|
10
|
-
#Delete existing Segmentation.
|
|
10
|
+
# Delete existing Segmentation.
|
|
11
11
|
#
|
|
12
12
|
class DeleteSegmentation < ApiRequest
|
|
13
13
|
attr_reader :segmentation_id
|
|
14
|
-
attr_accessor :timeout
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
#
|
|
14
|
+
attr_accessor :timeout, :ensure_https
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# * *Required arguments*
|
|
18
|
+
# - +segmentation_id+ -> ID of the Segmentation that should be deleted
|
|
19
|
+
#
|
|
21
20
|
def initialize(segmentation_id)
|
|
22
21
|
@segmentation_id = segmentation_id
|
|
23
|
-
@timeout =
|
|
22
|
+
@timeout = 10_000
|
|
24
23
|
@ensure_https = false
|
|
25
24
|
end
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
# HTTP method
|
|
28
27
|
def method
|
|
29
28
|
:delete
|
|
30
29
|
end
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
# Values of body parameters as a Hash
|
|
33
32
|
def body_parameters
|
|
34
|
-
|
|
35
|
-
p
|
|
33
|
+
{}
|
|
36
34
|
end
|
|
37
|
-
|
|
35
|
+
|
|
38
36
|
# Values of query parameters as a Hash.
|
|
39
37
|
# name of parameter => value of the parameter
|
|
40
38
|
def query_parameters
|
|
41
|
-
|
|
42
|
-
params
|
|
39
|
+
{}
|
|
43
40
|
end
|
|
44
|
-
|
|
41
|
+
|
|
45
42
|
# Relative path to the endpoint
|
|
46
43
|
def path
|
|
47
44
|
"/{databaseId}/segmentations/#{@segmentation_id}"
|