recombee_api_client 3.2.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/recombee_api_client/api/add_bookmark.rb +1 -1
- data/lib/recombee_api_client/api/add_cart_addition.rb +3 -3
- data/lib/recombee_api_client/api/add_detail_view.rb +1 -1
- data/lib/recombee_api_client/api/add_group.rb +1 -1
- data/lib/recombee_api_client/api/add_item.rb +2 -2
- data/lib/recombee_api_client/api/add_item_property.rb +1 -1
- data/lib/recombee_api_client/api/add_manual_reql_segment.rb +69 -0
- data/lib/recombee_api_client/api/add_purchase.rb +4 -4
- data/lib/recombee_api_client/api/add_rating.rb +1 -1
- data/lib/recombee_api_client/api/add_series.rb +1 -1
- data/lib/recombee_api_client/api/add_user_property.rb +2 -2
- data/lib/recombee_api_client/api/create_auto_reql_segmentation.rb +75 -0
- data/lib/recombee_api_client/api/create_manual_reql_segmentation.rb +71 -0
- data/lib/recombee_api_client/api/create_property_based_segmentation.rb +76 -0
- data/lib/recombee_api_client/api/delete_bookmark.rb +3 -3
- data/lib/recombee_api_client/api/delete_cart_addition.rb +3 -3
- data/lib/recombee_api_client/api/delete_detail_view.rb +3 -3
- data/lib/recombee_api_client/api/delete_group.rb +2 -2
- data/lib/recombee_api_client/api/delete_item.rb +3 -3
- data/lib/recombee_api_client/api/delete_manual_reql_segment.rb +52 -0
- data/lib/recombee_api_client/api/delete_more_items.rb +52 -0
- data/lib/recombee_api_client/api/delete_purchase.rb +3 -3
- data/lib/recombee_api_client/api/delete_rating.rb +2 -2
- data/lib/recombee_api_client/api/delete_search_synonym.rb +1 -1
- data/lib/recombee_api_client/api/delete_segmentation.rb +50 -0
- data/lib/recombee_api_client/api/delete_series.rb +1 -1
- data/lib/recombee_api_client/api/delete_user.rb +2 -2
- data/lib/recombee_api_client/api/delete_user_property.rb +1 -1
- data/lib/recombee_api_client/api/get_item_values.rb +2 -2
- data/lib/recombee_api_client/api/get_segmentation.rb +50 -0
- data/lib/recombee_api_client/api/get_user_values.rb +2 -2
- data/lib/recombee_api_client/api/insert_to_group.rb +2 -2
- data/lib/recombee_api_client/api/insert_to_series.rb +2 -2
- data/lib/recombee_api_client/api/list_group_items.rb +1 -1
- data/lib/recombee_api_client/api/list_item_bookmarks.rb +2 -2
- data/lib/recombee_api_client/api/list_item_cart_additions.rb +2 -2
- data/lib/recombee_api_client/api/list_item_detail_views.rb +2 -2
- data/lib/recombee_api_client/api/list_item_purchases.rb +2 -2
- data/lib/recombee_api_client/api/list_item_ratings.rb +2 -2
- data/lib/recombee_api_client/api/list_item_view_portions.rb +2 -2
- data/lib/recombee_api_client/api/list_items.rb +1 -1
- data/lib/recombee_api_client/api/list_segmentations.rb +51 -0
- data/lib/recombee_api_client/api/list_series_items.rb +2 -2
- data/lib/recombee_api_client/api/list_user_bookmarks.rb +1 -1
- data/lib/recombee_api_client/api/list_user_cart_additions.rb +1 -1
- data/lib/recombee_api_client/api/list_user_detail_views.rb +1 -1
- data/lib/recombee_api_client/api/list_user_purchases.rb +1 -1
- data/lib/recombee_api_client/api/list_user_ratings.rb +1 -1
- data/lib/recombee_api_client/api/list_user_view_portions.rb +1 -1
- data/lib/recombee_api_client/api/list_users.rb +1 -1
- data/lib/recombee_api_client/api/merge_users.rb +2 -2
- data/lib/recombee_api_client/api/recommend_item_segments_to_item.rb +131 -0
- data/lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb +131 -0
- data/lib/recombee_api_client/api/recommend_item_segments_to_user.rb +111 -0
- data/lib/recombee_api_client/api/recommend_items_to_item.rb +26 -26
- data/lib/recombee_api_client/api/recommend_items_to_user.rb +23 -23
- data/lib/recombee_api_client/api/recommend_next_items.rb +2 -2
- data/lib/recombee_api_client/api/recommend_users_to_item.rb +18 -18
- data/lib/recombee_api_client/api/recommend_users_to_user.rb +21 -21
- data/lib/recombee_api_client/api/reset_database.rb +1 -1
- data/lib/recombee_api_client/api/search_item_segments.rb +114 -0
- data/lib/recombee_api_client/api/search_items.rb +17 -17
- data/lib/recombee_api_client/api/set_view_portion.rb +3 -3
- data/lib/recombee_api_client/api/update_auto_reql_segmentation.rb +69 -0
- data/lib/recombee_api_client/api/update_manual_reql_segment.rb +67 -0
- data/lib/recombee_api_client/api/update_manual_reql_segmentation.rb +65 -0
- data/lib/recombee_api_client/api/update_more_items.rb +63 -0
- data/lib/recombee_api_client/api/update_property_based_segmentation.rb +69 -0
- data/lib/recombee_api_client/version.rb +1 -1
- data/lib/recombee_api_client.rb +40 -15
- data/recombee_api_client.gemspec +2 -2
- metadata +24 -8
- data/lib/recombee_api_client/api/item_based_recommendation.rb +0 -159
- data/lib/recombee_api_client/api/user_based_recommendation.rb +0 -143
@@ -0,0 +1,63 @@
|
|
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
|
+
#Updates (some) property values of all the items that pass the filter.
|
11
|
+
#
|
12
|
+
#Example: *Setting all the items that are older than a week as unavailable*
|
13
|
+
#
|
14
|
+
# ```
|
15
|
+
# {
|
16
|
+
# "filter": "'releaseDate' < now() - 7*24*3600",
|
17
|
+
# "changes": {"available": false}
|
18
|
+
# }
|
19
|
+
# ```
|
20
|
+
#
|
21
|
+
class UpdateMoreItems < ApiRequest
|
22
|
+
attr_reader :filter, :changes
|
23
|
+
attr_accessor :timeout
|
24
|
+
attr_accessor :ensure_https
|
25
|
+
|
26
|
+
##
|
27
|
+
# * *Required arguments*
|
28
|
+
# - +filter+ -> A [ReQL](https://docs.recombee.com/reql.html) expression, which returns `true` for the items that shall be updated.
|
29
|
+
# - +changes+ -> A dictionary where the keys are properties that shall be updated.
|
30
|
+
#
|
31
|
+
def initialize(filter, changes)
|
32
|
+
@filter = filter
|
33
|
+
@changes = changes
|
34
|
+
@timeout = 1000
|
35
|
+
@ensure_https = false
|
36
|
+
end
|
37
|
+
|
38
|
+
# HTTP method
|
39
|
+
def method
|
40
|
+
:post
|
41
|
+
end
|
42
|
+
|
43
|
+
# Values of body parameters as a Hash
|
44
|
+
def body_parameters
|
45
|
+
p = Hash.new
|
46
|
+
p['filter'] = @filter
|
47
|
+
p['changes'] = @changes
|
48
|
+
p
|
49
|
+
end
|
50
|
+
|
51
|
+
# Values of query parameters as a Hash.
|
52
|
+
# name of parameter => value of the parameter
|
53
|
+
def query_parameters
|
54
|
+
params = {}
|
55
|
+
params
|
56
|
+
end
|
57
|
+
|
58
|
+
# Relative path to the endpoint
|
59
|
+
def path
|
60
|
+
"/{databaseId}/more-items/"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -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
|
+
#Updates a Property Based Segmentation
|
11
|
+
#
|
12
|
+
class UpdatePropertyBasedSegmentation < ApiRequest
|
13
|
+
attr_reader :segmentation_id, :property_name, :title, :description
|
14
|
+
attr_accessor :timeout
|
15
|
+
attr_accessor :ensure_https
|
16
|
+
|
17
|
+
##
|
18
|
+
# * *Required arguments*
|
19
|
+
# - +segmentation_id+ -> ID of the updated Segmentation
|
20
|
+
#
|
21
|
+
# * *Optional arguments (given as hash optional)*
|
22
|
+
# - +propertyName+ -> Name of the property on which the Segmentation should be based
|
23
|
+
#
|
24
|
+
# - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
|
25
|
+
#
|
26
|
+
# - +description+ -> Description that is shown in the Recombee Admin UI.
|
27
|
+
#
|
28
|
+
#
|
29
|
+
def initialize(segmentation_id, optional = {})
|
30
|
+
@segmentation_id = segmentation_id
|
31
|
+
optional = normalize_optional(optional)
|
32
|
+
@property_name = optional['propertyName']
|
33
|
+
@title = optional['title']
|
34
|
+
@description = optional['description']
|
35
|
+
@optional = optional
|
36
|
+
@timeout = 10000
|
37
|
+
@ensure_https = false
|
38
|
+
@optional.each do |par, _|
|
39
|
+
fail UnknownOptionalParameter.new(par) unless ["propertyName","title","description"].include? par
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# HTTP method
|
44
|
+
def method
|
45
|
+
:post
|
46
|
+
end
|
47
|
+
|
48
|
+
# Values of body parameters as a Hash
|
49
|
+
def body_parameters
|
50
|
+
p = Hash.new
|
51
|
+
p['propertyName'] = @optional['propertyName'] if @optional.include? 'propertyName'
|
52
|
+
p['title'] = @optional['title'] if @optional.include? 'title'
|
53
|
+
p['description'] = @optional['description'] if @optional.include? 'description'
|
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/property-based/#{@segmentation_id}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/recombee_api_client.rb
CHANGED
@@ -18,19 +18,16 @@ module RecombeeApiClient
|
|
18
18
|
include HTTParty
|
19
19
|
|
20
20
|
BATCH_MAX_SIZE = 10000
|
21
|
-
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/
|
21
|
+
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/4.1.0'}
|
22
22
|
|
23
23
|
##
|
24
24
|
# - +account+ -> Name of your account at Recombee
|
25
25
|
# - +token+ -> Secret token obtained from Recombee for signing requests
|
26
|
-
|
27
|
-
def initialize(account, token, protocol = 'https', options = {})
|
26
|
+
def initialize(account, token, options = {})
|
28
27
|
@account = account
|
29
28
|
@token = token
|
30
|
-
@protocol = protocol
|
31
|
-
@base_uri =
|
32
|
-
@base_uri||= options[:base_uri]
|
33
|
-
@base_uri||= 'rapi.recombee.com'
|
29
|
+
@protocol = options[:protocol] || 'https'
|
30
|
+
@base_uri = get_base_uri(options)
|
34
31
|
end
|
35
32
|
|
36
33
|
##
|
@@ -42,7 +39,7 @@ module RecombeeApiClient
|
|
42
39
|
timeout = request.timeout / 1000
|
43
40
|
uri = process_request_uri(request)
|
44
41
|
uri = sign_url(uri)
|
45
|
-
protocol = request.ensure_https ? 'https' : @protocol
|
42
|
+
protocol = request.ensure_https ? 'https' : @protocol.to_s
|
46
43
|
uri = protocol + '://' + @base_uri + uri
|
47
44
|
# puts uri
|
48
45
|
begin
|
@@ -63,10 +60,33 @@ module RecombeeApiClient
|
|
63
60
|
|
64
61
|
private
|
65
62
|
|
63
|
+
def get_regional_base_uri(region)
|
64
|
+
uri = {
|
65
|
+
'ap-se' => 'rapi-ap-se.recombee.com',
|
66
|
+
'ca-east' => 'rapi-ca-east.recombee.com',
|
67
|
+
'eu-west' => 'rapi-eu-west.recombee.com',
|
68
|
+
'us-west' => 'rapi-us-west.recombee.com'
|
69
|
+
}[region.to_s.gsub('_', '-').downcase]
|
70
|
+
raise ArgumentError.new("Region \"#{region}\" is unknown. You may need to update the version of the SDK.") if uri == nil
|
71
|
+
uri
|
72
|
+
end
|
73
|
+
|
74
|
+
def get_base_uri(options)
|
75
|
+
base_uri = ENV['RAPI_URI']
|
76
|
+
base_uri ||= options[:base_uri]
|
77
|
+
|
78
|
+
if options.key? :region
|
79
|
+
raise ArgumentError.new(':base_uri and :region cannot be specified at the same time') if base_uri
|
80
|
+
base_uri = get_regional_base_uri(options[:region])
|
81
|
+
end
|
82
|
+
base_uri||= 'rapi.recombee.com'
|
83
|
+
base_uri
|
84
|
+
end
|
85
|
+
|
66
86
|
def put(request, uri, timeout)
|
67
87
|
response = self.class.put(uri, body: request.body_parameters.to_json,
|
68
|
-
|
69
|
-
|
88
|
+
headers: { 'Content-Type' => 'application/json' }.merge(USER_AGENT),
|
89
|
+
timeout: timeout)
|
70
90
|
check_errors(response, request)
|
71
91
|
response.body
|
72
92
|
end
|
@@ -78,10 +98,9 @@ module RecombeeApiClient
|
|
78
98
|
end
|
79
99
|
|
80
100
|
def post(request, uri, timeout)
|
81
|
-
# pass arguments in body
|
82
101
|
response = self.class.post(uri, body: request.body_parameters.to_json,
|
83
|
-
|
84
|
-
|
102
|
+
headers: { 'Content-Type' => 'application/json' }.merge(USER_AGENT),
|
103
|
+
timeout: timeout)
|
85
104
|
check_errors(response, request)
|
86
105
|
begin
|
87
106
|
return JSON.parse(response.body)
|
@@ -91,9 +110,15 @@ module RecombeeApiClient
|
|
91
110
|
end
|
92
111
|
|
93
112
|
def delete(request, uri, timeout)
|
94
|
-
response = self.class.delete(uri,
|
113
|
+
response = self.class.delete(uri, body: request.body_parameters.to_json,
|
114
|
+
headers: { 'Content-Type' => 'application/json' }.merge(USER_AGENT),
|
115
|
+
timeout: timeout)
|
95
116
|
check_errors(response, request)
|
96
|
-
|
117
|
+
begin
|
118
|
+
return JSON.parse(response.body)
|
119
|
+
rescue JSON::ParserError
|
120
|
+
return response.body
|
121
|
+
end
|
97
122
|
end
|
98
123
|
|
99
124
|
def check_errors(response, request)
|
data/recombee_api_client.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency 'multi_json'
|
21
21
|
spec.add_dependency 'httparty'
|
22
22
|
|
23
|
-
spec.add_development_dependency 'bundler', '~>
|
24
|
-
spec.add_development_dependency 'rake', '~>
|
23
|
+
spec.add_development_dependency 'bundler', '~> 2.2.10'
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
25
25
|
spec.add_development_dependency 'rspec'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recombee_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Fiedler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.2.10
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.2.10
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 12.3.3
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 12.3.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/recombee_api_client/api/add_group.rb
|
99
99
|
- lib/recombee_api_client/api/add_item.rb
|
100
100
|
- lib/recombee_api_client/api/add_item_property.rb
|
101
|
+
- lib/recombee_api_client/api/add_manual_reql_segment.rb
|
101
102
|
- lib/recombee_api_client/api/add_purchase.rb
|
102
103
|
- lib/recombee_api_client/api/add_rating.rb
|
103
104
|
- lib/recombee_api_client/api/add_search_synonym.rb
|
@@ -105,6 +106,9 @@ files:
|
|
105
106
|
- lib/recombee_api_client/api/add_user.rb
|
106
107
|
- lib/recombee_api_client/api/add_user_property.rb
|
107
108
|
- lib/recombee_api_client/api/batch.rb
|
109
|
+
- lib/recombee_api_client/api/create_auto_reql_segmentation.rb
|
110
|
+
- lib/recombee_api_client/api/create_manual_reql_segmentation.rb
|
111
|
+
- lib/recombee_api_client/api/create_property_based_segmentation.rb
|
108
112
|
- lib/recombee_api_client/api/delete_all_search_synonyms.rb
|
109
113
|
- lib/recombee_api_client/api/delete_bookmark.rb
|
110
114
|
- lib/recombee_api_client/api/delete_cart_addition.rb
|
@@ -112,21 +116,24 @@ files:
|
|
112
116
|
- lib/recombee_api_client/api/delete_group.rb
|
113
117
|
- lib/recombee_api_client/api/delete_item.rb
|
114
118
|
- lib/recombee_api_client/api/delete_item_property.rb
|
119
|
+
- lib/recombee_api_client/api/delete_manual_reql_segment.rb
|
120
|
+
- lib/recombee_api_client/api/delete_more_items.rb
|
115
121
|
- lib/recombee_api_client/api/delete_purchase.rb
|
116
122
|
- lib/recombee_api_client/api/delete_rating.rb
|
117
123
|
- lib/recombee_api_client/api/delete_search_synonym.rb
|
124
|
+
- lib/recombee_api_client/api/delete_segmentation.rb
|
118
125
|
- lib/recombee_api_client/api/delete_series.rb
|
119
126
|
- lib/recombee_api_client/api/delete_user.rb
|
120
127
|
- lib/recombee_api_client/api/delete_user_property.rb
|
121
128
|
- lib/recombee_api_client/api/delete_view_portion.rb
|
122
129
|
- lib/recombee_api_client/api/get_item_property_info.rb
|
123
130
|
- lib/recombee_api_client/api/get_item_values.rb
|
131
|
+
- lib/recombee_api_client/api/get_segmentation.rb
|
124
132
|
- lib/recombee_api_client/api/get_user_property_info.rb
|
125
133
|
- lib/recombee_api_client/api/get_user_values.rb
|
126
134
|
- lib/recombee_api_client/api/hash_normalizer.rb
|
127
135
|
- lib/recombee_api_client/api/insert_to_group.rb
|
128
136
|
- lib/recombee_api_client/api/insert_to_series.rb
|
129
|
-
- lib/recombee_api_client/api/item_based_recommendation.rb
|
130
137
|
- lib/recombee_api_client/api/list_group_items.rb
|
131
138
|
- lib/recombee_api_client/api/list_groups.rb
|
132
139
|
- lib/recombee_api_client/api/list_item_bookmarks.rb
|
@@ -138,6 +145,7 @@ files:
|
|
138
145
|
- lib/recombee_api_client/api/list_item_view_portions.rb
|
139
146
|
- lib/recombee_api_client/api/list_items.rb
|
140
147
|
- lib/recombee_api_client/api/list_search_synonyms.rb
|
148
|
+
- lib/recombee_api_client/api/list_segmentations.rb
|
141
149
|
- lib/recombee_api_client/api/list_series.rb
|
142
150
|
- lib/recombee_api_client/api/list_series_items.rb
|
143
151
|
- lib/recombee_api_client/api/list_user_bookmarks.rb
|
@@ -149,6 +157,9 @@ files:
|
|
149
157
|
- lib/recombee_api_client/api/list_user_view_portions.rb
|
150
158
|
- lib/recombee_api_client/api/list_users.rb
|
151
159
|
- lib/recombee_api_client/api/merge_users.rb
|
160
|
+
- lib/recombee_api_client/api/recommend_item_segments_to_item.rb
|
161
|
+
- lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb
|
162
|
+
- lib/recombee_api_client/api/recommend_item_segments_to_user.rb
|
152
163
|
- lib/recombee_api_client/api/recommend_items_to_item.rb
|
153
164
|
- lib/recombee_api_client/api/recommend_items_to_user.rb
|
154
165
|
- lib/recombee_api_client/api/recommend_next_items.rb
|
@@ -158,12 +169,17 @@ files:
|
|
158
169
|
- lib/recombee_api_client/api/remove_from_series.rb
|
159
170
|
- lib/recombee_api_client/api/request.rb
|
160
171
|
- lib/recombee_api_client/api/reset_database.rb
|
172
|
+
- lib/recombee_api_client/api/search_item_segments.rb
|
161
173
|
- lib/recombee_api_client/api/search_items.rb
|
162
174
|
- lib/recombee_api_client/api/set_item_values.rb
|
163
175
|
- lib/recombee_api_client/api/set_user_values.rb
|
164
176
|
- lib/recombee_api_client/api/set_values.rb
|
165
177
|
- lib/recombee_api_client/api/set_view_portion.rb
|
166
|
-
- lib/recombee_api_client/api/
|
178
|
+
- lib/recombee_api_client/api/update_auto_reql_segmentation.rb
|
179
|
+
- lib/recombee_api_client/api/update_manual_reql_segment.rb
|
180
|
+
- lib/recombee_api_client/api/update_manual_reql_segmentation.rb
|
181
|
+
- lib/recombee_api_client/api/update_more_items.rb
|
182
|
+
- lib/recombee_api_client/api/update_property_based_segmentation.rb
|
167
183
|
- lib/recombee_api_client/errors.rb
|
168
184
|
- lib/recombee_api_client/version.rb
|
169
185
|
- recombee_api_client.gemspec
|
@@ -1,159 +0,0 @@
|
|
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
|
-
#Deprecated since version 2.0.0. Use RecommendItemsToItem request instead.
|
11
|
-
#
|
12
|
-
#Recommends set of items that are somehow related to one given item, *X*. Typical scenario for using item-based recommendation is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Item-recommendation request gives you Top-N such items, optionally taking the target user *A* into account.
|
13
|
-
#
|
14
|
-
# It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
15
|
-
#
|
16
|
-
class ItemBasedRecommendation < ApiRequest
|
17
|
-
attr_reader :item_id, :count, :target_user_id, :user_impact, :filter, :booster, :allow_nonexistent, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings
|
18
|
-
attr_accessor :timeout
|
19
|
-
attr_accessor :ensure_https
|
20
|
-
|
21
|
-
##
|
22
|
-
# * *Required arguments*
|
23
|
-
# - +item_id+ -> ID of the item for which the recommendations are to be generated.
|
24
|
-
# - +count+ -> Number of items to be recommended (N for the top-N recommendation).
|
25
|
-
#
|
26
|
-
# * *Optional arguments (given as hash optional)*
|
27
|
-
# - +targetUserId+ -> ID of the user who will see the recommendations.
|
28
|
-
#
|
29
|
-
#Specifying the *targetUserId* is beneficial because:
|
30
|
-
#
|
31
|
-
#* It makes the recommendations personalized
|
32
|
-
#* Allows the calculation of Actions and Conversions in the graphical user interface,
|
33
|
-
# as Recombee can pair the user who got recommendations and who afterwards viewed/purchased an item.
|
34
|
-
#
|
35
|
-
#For the above reasons, we encourage you to set the *targetUserId* even for anonymous/unregistered users (i.e. use their session ID).
|
36
|
-
#
|
37
|
-
# - +userImpact+ -> If *targetUserId* parameter is present, the recommendations are biased towards the user given. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get user-based recommendation. The default value is `0`.
|
38
|
-
#
|
39
|
-
# - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended items based on the values of their attributes.
|
40
|
-
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some items based on the values of their attributes.
|
41
|
-
# - +allowNonexistent+ -> Instead of causing HTTP 404 error, returns some (non-personalized) recommendations if either item of given *itemId* or user of given *targetUserId* does not exist in the database. It creates neither of the missing entities in the database.
|
42
|
-
# - +cascadeCreate+ -> If item of given *itemId* or user of given *targetUserId* doesn't exist in the database, it creates the missing enity/entities and returns some (non-personalized) recommendations. This allows for example rotations in the following recommendations for the user of given *targetUserId*, as the user will be already known to the system.
|
43
|
-
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
|
44
|
-
# - +returnProperties+ -> With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying of the recommended items to the user.
|
45
|
-
#
|
46
|
-
#Example response:
|
47
|
-
#```
|
48
|
-
# [
|
49
|
-
# {
|
50
|
-
# "itemId": "tv-178",
|
51
|
-
# "description": "4K TV with 3D feature",
|
52
|
-
# "categories": ["Electronics", "Televisions"],
|
53
|
-
# "price": 342,
|
54
|
-
# "url": "myshop.com/tv-178"
|
55
|
-
# },
|
56
|
-
# {
|
57
|
-
# "itemId": "mixer-42",
|
58
|
-
# "description": "Stainless Steel Mixer",
|
59
|
-
# "categories": ["Home & Kitchen"],
|
60
|
-
# "price": 39,
|
61
|
-
# "url": "myshop.com/mixer-42"
|
62
|
-
# }
|
63
|
-
# ]
|
64
|
-
#```
|
65
|
-
#
|
66
|
-
# - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
|
67
|
-
#
|
68
|
-
#Example response for `includedProperties=description,price`:
|
69
|
-
#```
|
70
|
-
# [
|
71
|
-
# {
|
72
|
-
# "itemId": "tv-178",
|
73
|
-
# "description": "4K TV with 3D feature",
|
74
|
-
# "price": 342
|
75
|
-
# },
|
76
|
-
# {
|
77
|
-
# "itemId": "mixer-42",
|
78
|
-
# "description": "Stainless Steel Mixer",
|
79
|
-
# "price": 39
|
80
|
-
# }
|
81
|
-
# ]
|
82
|
-
#```
|
83
|
-
#
|
84
|
-
# - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
85
|
-
#
|
86
|
-
# - +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.
|
87
|
-
#
|
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`.
|
89
|
-
#
|
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`.
|
91
|
-
#
|
92
|
-
# - +expertSettings+ -> Dictionary of custom options.
|
93
|
-
#
|
94
|
-
#
|
95
|
-
def initialize(item_id, count, optional = {})
|
96
|
-
@item_id = item_id
|
97
|
-
@count = count
|
98
|
-
optional = normalize_optional(optional)
|
99
|
-
@target_user_id = optional['targetUserId']
|
100
|
-
@user_impact = optional['userImpact']
|
101
|
-
@filter = optional['filter']
|
102
|
-
@booster = optional['booster']
|
103
|
-
@allow_nonexistent = optional['allowNonexistent']
|
104
|
-
@cascade_create = optional['cascadeCreate']
|
105
|
-
@scenario = optional['scenario']
|
106
|
-
@return_properties = optional['returnProperties']
|
107
|
-
@included_properties = optional['includedProperties']
|
108
|
-
@diversity = optional['diversity']
|
109
|
-
@min_relevance = optional['minRelevance']
|
110
|
-
@rotation_rate = optional['rotationRate']
|
111
|
-
@rotation_time = optional['rotationTime']
|
112
|
-
@expert_settings = optional['expertSettings']
|
113
|
-
@optional = optional
|
114
|
-
@timeout = 3000
|
115
|
-
@ensure_https = false
|
116
|
-
@optional.each do |par, _|
|
117
|
-
fail UnknownOptionalParameter.new(par) unless ["targetUserId","userImpact","filter","booster","allowNonexistent","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
# HTTP method
|
122
|
-
def method
|
123
|
-
:post
|
124
|
-
end
|
125
|
-
|
126
|
-
# Values of body parameters as a Hash
|
127
|
-
def body_parameters
|
128
|
-
p = Hash.new
|
129
|
-
p['count'] = @count
|
130
|
-
p['targetUserId'] = @optional['targetUserId'] if @optional.include? 'targetUserId'
|
131
|
-
p['userImpact'] = @optional['userImpact'] if @optional.include? 'userImpact'
|
132
|
-
p['filter'] = @optional['filter'] if @optional.include? 'filter'
|
133
|
-
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
134
|
-
p['allowNonexistent'] = @optional['allowNonexistent'] if @optional.include? 'allowNonexistent'
|
135
|
-
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
136
|
-
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
137
|
-
p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
|
138
|
-
p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
|
139
|
-
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
140
|
-
p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
|
141
|
-
p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
|
142
|
-
p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
|
143
|
-
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
144
|
-
p
|
145
|
-
end
|
146
|
-
|
147
|
-
# Values of query parameters as a Hash.
|
148
|
-
# name of parameter => value of the parameter
|
149
|
-
def query_parameters
|
150
|
-
params = {}
|
151
|
-
params
|
152
|
-
end
|
153
|
-
|
154
|
-
# Relative path to the endpoint
|
155
|
-
def path
|
156
|
-
"/{databaseId}/items/#{@item_id}/recomms/"
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|