recombee_api_client 6.0.0 → 6.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88fa1bd148ace9bb4ddfa4c75037c4242bf693a96e7395de3b0c23dafb325d03
4
- data.tar.gz: c4bbc5474baf87cfaabc58f07b0c4e5161190473e1816e2b6f6ab61b90d32347
3
+ metadata.gz: 946801c5ff87b7b436bdebae1c869bb47adaa63d07f0a779da3da48961fdb704
4
+ data.tar.gz: 14e9ead529eb19b683314182f8cdf2c22f18f208f4d58559a6aa8086e788343f
5
5
  SHA512:
6
- metadata.gz: ba77e029c00f29e3e4ec1d8b7790620d205e13bb4cbcc16b06061f0ce3045b74b39b815706bf0cde69d88964460a6149d8012f976e2563c9f2188464833ebc2b
7
- data.tar.gz: 3a6abbe8a347b15d2fec1ec457a23870c4321839c18f75e344adaf607dcb95b2e379b20057af1d90a3edb023eb97643d2788a35088c853588cfe368e7a9a7abe
6
+ metadata.gz: 41cf5de6569aae7b973a3d03eccd2d819aaadcce8c2afccba7d8b38462c822bb04efbbe033fa96a4ad7d89a7a9891d947c6fe8779fe9732ae2cd59ae1584acae
7
+ data.tar.gz: f8ef99a8dffd542ea917e43a2ae776eeda38308daa9dc12f62155623df2ff633793aa5d5a054c10d48f0065d9633dbe1e382f07fd3fc73d22636e9635b825ebb
@@ -7,7 +7,7 @@ module RecombeeApiClient
7
7
  require_relative '../errors'
8
8
 
9
9
  ##
10
- # Composite Recommendation returns both a *source entity* (e.g., an Item or [Item Segment](https://docs.recombee.com/segmentations.html)) and a list of related recommendations in a single response.
10
+ # Composite Recommendation returns both a *source entity* (e.g., an Item or [Item Segment](https://docs.recombee.com/segmentations)) and a list of related recommendations in a single response.
11
11
  #
12
12
  # It is ideal for use cases such as personalized homepage sections (*Articles from <category>*), *Because You Watched <movie>*, or *Artists Related to Your Favorite Artist <artist>*.
13
13
  #
@@ -37,8 +37,8 @@ module RecombeeApiClient
37
37
  # See [this example](https://docs.recombee.com/api#composite-recommendation-example-setting-parameters-for-individual-stages) for more details.
38
38
  #
39
39
  class CompositeRecommendation < ApiRequest
40
- attr_reader :scenario, :count, :item_id, :user_id, :logic, :segment_id, :cascade_create, :source_settings,
41
- :result_settings, :expert_settings
40
+ attr_reader :scenario, :count, :item_id, :user_id, :logic, :segment_id, :search_query, :cascade_create,
41
+ :source_settings, :result_settings, :expert_settings
42
42
  attr_accessor :timeout, :ensure_https
43
43
 
44
44
  ##
@@ -66,6 +66,8 @@ module RecombeeApiClient
66
66
  #
67
67
  # - +segmentId+ -> ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.
68
68
  #
69
+ # - +searchQuery+ -> Search query provided by the user. It is used for the full-text search. Only applicable if the *scenario* corresponds to a search scenario.
70
+ #
69
71
  # - +cascadeCreate+ -> If the entity for the source recommendation does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows, for example, rotations in the following recommendations for that entity, as the entity will be already known to the system.
70
72
  #
71
73
  # - +sourceSettings+ -> Parameters applied for recommending the *Source* stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the *Source*.
@@ -83,6 +85,7 @@ module RecombeeApiClient
83
85
  @user_id = optional['userId']
84
86
  @logic = optional['logic']
85
87
  @segment_id = optional['segmentId']
88
+ @search_query = optional['searchQuery']
86
89
  @cascade_create = optional['cascadeCreate']
87
90
  @source_settings = optional['sourceSettings']
88
91
  @result_settings = optional['resultSettings']
@@ -91,8 +94,8 @@ module RecombeeApiClient
91
94
  @timeout = 3000
92
95
  @ensure_https = false
93
96
  @optional.each do |par, _|
94
- raise UnknownOptionalParameter.new(par) unless %w[itemId userId logic segmentId cascadeCreate
95
- sourceSettings resultSettings expertSettings].include? par
97
+ raise UnknownOptionalParameter.new(par) unless %w[itemId userId logic segmentId searchQuery
98
+ cascadeCreate sourceSettings resultSettings expertSettings].include? par
96
99
  end
97
100
  end
98
101
 
@@ -110,6 +113,7 @@ module RecombeeApiClient
110
113
  p['userId'] = @optional['userId'] if @optional.include? 'userId'
111
114
  p['logic'] = @optional['logic'] if @optional.include? 'logic'
112
115
  p['segmentId'] = @optional['segmentId'] if @optional.include? 'segmentId'
116
+ p['searchQuery'] = @optional['searchQuery'] if @optional.include? 'searchQuery'
113
117
  p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
114
118
  p['sourceSettings'] = @optional['sourceSettings'] if @optional.include? 'sourceSettings'
115
119
  p['resultSettings'] = @optional['resultSettings'] if @optional.include? 'resultSettings'
@@ -24,7 +24,7 @@ module RecombeeApiClient
24
24
  #
25
25
  class RecommendItemSegmentsToItem < ApiRequest
26
26
  attr_reader :item_id, :target_user_id, :count, :scenario, :cascade_create, :filter, :booster, :logic,
27
- :expert_settings, :return_ab_group
27
+ :expert_settings, :return_ab_group, :reql_expressions
28
28
  attr_accessor :timeout, :ensure_https
29
29
 
30
30
  ##
@@ -75,6 +75,43 @@ module RecombeeApiClient
75
75
  #
76
76
  # - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
77
77
  #
78
+ # - +reqlExpressions+ -> A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
79
+ # This can be used to compute additional properties of the recommended Item Segments.
80
+ #
81
+ # The keys are the names of the expressions, and the values are the actual ReQL expressions.
82
+ #
83
+ # Example request:
84
+ # ```json
85
+ # {
86
+ # "reqlExpressions": {
87
+ # "countItems": "size(segment_items(\"categories\", 'segmentId'))"
88
+ # }
89
+ # }
90
+ # ```
91
+ #
92
+ # Example response:
93
+ # ```json
94
+ # {
95
+ # "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
96
+ # "recomms":
97
+ # [
98
+ # {
99
+ # "id": "category-fantasy-books",
100
+ # "reqlEvaluations": {
101
+ # "countItems": 486
102
+ # }
103
+ # },
104
+ # {
105
+ # "id": "category-sci-fi-costumes",
106
+ # "reqlEvaluations": {
107
+ # "countItems": 19
108
+ # }
109
+ # }
110
+ # ],
111
+ # "numberNextRecommsCalls": 0
112
+ # }
113
+ # ```
114
+ #
78
115
  #
79
116
  def initialize(item_id, target_user_id, count, optional = {})
80
117
  @item_id = item_id
@@ -88,12 +125,13 @@ module RecombeeApiClient
88
125
  @logic = optional['logic']
89
126
  @expert_settings = optional['expertSettings']
90
127
  @return_ab_group = optional['returnAbGroup']
128
+ @reql_expressions = optional['reqlExpressions']
91
129
  @optional = optional
92
130
  @timeout = 3000
93
131
  @ensure_https = false
94
132
  @optional.each do |par, _|
95
133
  raise UnknownOptionalParameter.new(par) unless %w[scenario cascadeCreate filter booster logic
96
- expertSettings returnAbGroup].include? par
134
+ expertSettings returnAbGroup reqlExpressions].include? par
97
135
  end
98
136
  end
99
137
 
@@ -114,6 +152,7 @@ module RecombeeApiClient
114
152
  p['logic'] = @optional['logic'] if @optional.include? 'logic'
115
153
  p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
116
154
  p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
155
+ p['reqlExpressions'] = @optional['reqlExpressions'] if @optional.include? 'reqlExpressions'
117
156
 
118
157
  p
119
158
  end
@@ -23,7 +23,7 @@ module RecombeeApiClient
23
23
  #
24
24
  class RecommendItemSegmentsToItemSegment < ApiRequest
25
25
  attr_reader :context_segment_id, :target_user_id, :count, :scenario, :cascade_create, :filter, :booster, :logic,
26
- :expert_settings, :return_ab_group
26
+ :expert_settings, :return_ab_group, :reql_expressions
27
27
  attr_accessor :timeout, :ensure_https
28
28
 
29
29
  ##
@@ -74,6 +74,43 @@ module RecombeeApiClient
74
74
  #
75
75
  # - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
76
76
  #
77
+ # - +reqlExpressions+ -> A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
78
+ # This can be used to compute additional properties of the recommended Item Segments.
79
+ #
80
+ # The keys are the names of the expressions, and the values are the actual ReQL expressions.
81
+ #
82
+ # Example request:
83
+ # ```json
84
+ # {
85
+ # "reqlExpressions": {
86
+ # "countItems": "size(segment_items(\"categories\", 'segmentId'))"
87
+ # }
88
+ # }
89
+ # ```
90
+ #
91
+ # Example response:
92
+ # ```json
93
+ # {
94
+ # "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
95
+ # "recomms":
96
+ # [
97
+ # {
98
+ # "id": "category-fantasy-books",
99
+ # "reqlEvaluations": {
100
+ # "countItems": 486
101
+ # }
102
+ # },
103
+ # {
104
+ # "id": "category-sci-fi-costumes",
105
+ # "reqlEvaluations": {
106
+ # "countItems": 19
107
+ # }
108
+ # }
109
+ # ],
110
+ # "numberNextRecommsCalls": 0
111
+ # }
112
+ # ```
113
+ #
77
114
  #
78
115
  def initialize(context_segment_id, target_user_id, count, optional = {})
79
116
  @context_segment_id = context_segment_id
@@ -87,12 +124,13 @@ module RecombeeApiClient
87
124
  @logic = optional['logic']
88
125
  @expert_settings = optional['expertSettings']
89
126
  @return_ab_group = optional['returnAbGroup']
127
+ @reql_expressions = optional['reqlExpressions']
90
128
  @optional = optional
91
129
  @timeout = 3000
92
130
  @ensure_https = false
93
131
  @optional.each do |par, _|
94
132
  raise UnknownOptionalParameter.new(par) unless %w[scenario cascadeCreate filter booster logic
95
- expertSettings returnAbGroup].include? par
133
+ expertSettings returnAbGroup reqlExpressions].include? par
96
134
  end
97
135
  end
98
136
 
@@ -114,6 +152,7 @@ module RecombeeApiClient
114
152
  p['logic'] = @optional['logic'] if @optional.include? 'logic'
115
153
  p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
116
154
  p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
155
+ p['reqlExpressions'] = @optional['reqlExpressions'] if @optional.include? 'reqlExpressions'
117
156
 
118
157
  p
119
158
  end
@@ -24,7 +24,7 @@ module RecombeeApiClient
24
24
  #
25
25
  class RecommendItemSegmentsToUser < ApiRequest
26
26
  attr_reader :user_id, :count, :scenario, :cascade_create, :filter, :booster, :logic, :expert_settings,
27
- :return_ab_group
27
+ :return_ab_group, :reql_expressions
28
28
  attr_accessor :timeout, :ensure_https
29
29
 
30
30
  ##
@@ -57,6 +57,43 @@ module RecombeeApiClient
57
57
  #
58
58
  # - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
59
59
  #
60
+ # - +reqlExpressions+ -> A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
61
+ # This can be used to compute additional properties of the recommended Item Segments.
62
+ #
63
+ # The keys are the names of the expressions, and the values are the actual ReQL expressions.
64
+ #
65
+ # Example request:
66
+ # ```json
67
+ # {
68
+ # "reqlExpressions": {
69
+ # "countItems": "size(segment_items(\"categories\", 'segmentId'))"
70
+ # }
71
+ # }
72
+ # ```
73
+ #
74
+ # Example response:
75
+ # ```json
76
+ # {
77
+ # "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
78
+ # "recomms":
79
+ # [
80
+ # {
81
+ # "id": "category-fantasy-books",
82
+ # "reqlEvaluations": {
83
+ # "countItems": 486
84
+ # }
85
+ # },
86
+ # {
87
+ # "id": "category-sci-fi-costumes",
88
+ # "reqlEvaluations": {
89
+ # "countItems": 19
90
+ # }
91
+ # }
92
+ # ],
93
+ # "numberNextRecommsCalls": 0
94
+ # }
95
+ # ```
96
+ #
60
97
  #
61
98
  def initialize(user_id, count, optional = {})
62
99
  @user_id = user_id
@@ -69,12 +106,13 @@ module RecombeeApiClient
69
106
  @logic = optional['logic']
70
107
  @expert_settings = optional['expertSettings']
71
108
  @return_ab_group = optional['returnAbGroup']
109
+ @reql_expressions = optional['reqlExpressions']
72
110
  @optional = optional
73
111
  @timeout = 3000
74
112
  @ensure_https = false
75
113
  @optional.each do |par, _|
76
114
  raise UnknownOptionalParameter.new(par) unless %w[scenario cascadeCreate filter booster logic
77
- expertSettings returnAbGroup].include? par
115
+ expertSettings returnAbGroup reqlExpressions].include? par
78
116
  end
79
117
  end
80
118
 
@@ -94,6 +132,7 @@ module RecombeeApiClient
94
132
  p['logic'] = @optional['logic'] if @optional.include? 'logic'
95
133
  p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
96
134
  p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
135
+ p['reqlExpressions'] = @optional['reqlExpressions'] if @optional.include? 'reqlExpressions'
97
136
 
98
137
  p
99
138
  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
+ # Returns Item segments that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (*infinite scroll*) or goes to the next page.
11
+ #
12
+ # It accepts `recommId` of a base recommendation request (e.g., request from the first page) and the number of segments that shall be returned (`count`).
13
+ # The base request can be one of:
14
+ # - [Recommend Item Segments to Item](https://docs.recombee.com/api#recommend-item-segments-to-item)
15
+ # - [Recommend Item Segments to User](https://docs.recombee.com/api#recommend-item-segments-to-user)
16
+ # - [Recommend Item Segments to Item Segment](https://docs.recombee.com/api#recommend-item-segments-to-item-segment)
17
+ # - [Search Item Segments](https://docs.recombee.com/api#search-item-segments)
18
+ #
19
+ # All the other parameters are inherited from the base request.
20
+ #
21
+ # *Recommend next Item segments* can be called many times for a single `recommId` and each call returns different (previously not recommended) segments.
22
+ # The number of *Recommend next Item segments* calls performed so far is returned in the `numberNextRecommsCalls` field.
23
+ #
24
+ # *Recommend next Item segments* can be requested up to 30 minutes after the base request or a previous *Recommend next Item segments* call.
25
+ #
26
+ # For billing purposes, each call to *Recommend next Item segments* is counted as a separate recommendation request.
27
+ #
28
+ class RecommendNextItemSegments < ApiRequest
29
+ attr_reader :recomm_id, :count
30
+ attr_accessor :timeout, :ensure_https
31
+
32
+ ##
33
+ # * *Required arguments*
34
+ # - +recomm_id+ -> ID of the base recommendation request for which next recommendations should be returned
35
+ # - +count+ -> Number of item segments to be recommended
36
+ #
37
+ #
38
+ def initialize(recomm_id, count)
39
+ @recomm_id = recomm_id
40
+ @count = count
41
+ @timeout = 3000
42
+ @ensure_https = false
43
+ end
44
+
45
+ # HTTP method
46
+ def method
47
+ :post
48
+ end
49
+
50
+ # Values of body parameters as a Hash
51
+ def body_parameters
52
+ p = {}
53
+ p['count'] = @count
54
+
55
+ p
56
+ end
57
+
58
+ # Values of query parameters as a Hash.
59
+ # name of parameter => value of the parameter
60
+ def query_parameters
61
+ {}
62
+ end
63
+
64
+ # Relative path to the endpoint
65
+ def path
66
+ "/{databaseId}/recomms/next/item-segments/#{@recomm_id}"
67
+ end
68
+ end
69
+ end
@@ -24,7 +24,7 @@ module RecombeeApiClient
24
24
  #
25
25
  class SearchItemSegments < ApiRequest
26
26
  attr_reader :user_id, :search_query, :count, :scenario, :cascade_create, :filter, :booster, :logic,
27
- :expert_settings, :return_ab_group
27
+ :expert_settings, :return_ab_group, :reql_expressions
28
28
  attr_accessor :timeout, :ensure_https
29
29
 
30
30
  ##
@@ -57,6 +57,43 @@ module RecombeeApiClient
57
57
  #
58
58
  # - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
59
59
  #
60
+ # - +reqlExpressions+ -> A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
61
+ # This can be used to compute additional properties of the recommended Item Segments.
62
+ #
63
+ # The keys are the names of the expressions, and the values are the actual ReQL expressions.
64
+ #
65
+ # Example request:
66
+ # ```json
67
+ # {
68
+ # "reqlExpressions": {
69
+ # "countItems": "size(segment_items(\"categories\", 'segmentId'))"
70
+ # }
71
+ # }
72
+ # ```
73
+ #
74
+ # Example response:
75
+ # ```json
76
+ # {
77
+ # "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
78
+ # "recomms":
79
+ # [
80
+ # {
81
+ # "id": "category-fantasy-books",
82
+ # "reqlEvaluations": {
83
+ # "countItems": 486
84
+ # }
85
+ # },
86
+ # {
87
+ # "id": "category-sci-fi-costumes",
88
+ # "reqlEvaluations": {
89
+ # "countItems": 19
90
+ # }
91
+ # }
92
+ # ],
93
+ # "numberNextRecommsCalls": 0
94
+ # }
95
+ # ```
96
+ #
60
97
  #
61
98
  def initialize(user_id, search_query, count, optional = {})
62
99
  @user_id = user_id
@@ -70,12 +107,13 @@ module RecombeeApiClient
70
107
  @logic = optional['logic']
71
108
  @expert_settings = optional['expertSettings']
72
109
  @return_ab_group = optional['returnAbGroup']
110
+ @reql_expressions = optional['reqlExpressions']
73
111
  @optional = optional
74
112
  @timeout = 3000
75
113
  @ensure_https = false
76
114
  @optional.each do |par, _|
77
115
  raise UnknownOptionalParameter.new(par) unless %w[scenario cascadeCreate filter booster logic
78
- expertSettings returnAbGroup].include? par
116
+ expertSettings returnAbGroup reqlExpressions].include? par
79
117
  end
80
118
  end
81
119
 
@@ -96,6 +134,7 @@ module RecombeeApiClient
96
134
  p['logic'] = @optional['logic'] if @optional.include? 'logic'
97
135
  p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
98
136
  p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
137
+ p['reqlExpressions'] = @optional['reqlExpressions'] if @optional.include? 'reqlExpressions'
99
138
 
100
139
  p
101
140
  end
@@ -1,3 +1,3 @@
1
1
  module RecombeeApiClient
2
- VERSION = '6.0.0'
2
+ VERSION = '6.2.0'
3
3
  end
@@ -19,7 +19,7 @@ module RecombeeApiClient
19
19
  include HTTParty
20
20
 
21
21
  BATCH_MAX_SIZE = 10_000
22
- USER_AGENT = { 'User-Agent' => 'recombee-ruby-api-client/6.0.0' }
22
+ USER_AGENT = { 'User-Agent' => 'recombee-ruby-api-client/6.2.0' }
23
23
 
24
24
  ##
25
25
  # - +account+ -> Name of your account at Recombee
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recombee_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Fiedler
@@ -159,6 +159,7 @@ files:
159
159
  - lib/recombee_api_client/api/recommend_items_to_item.rb
160
160
  - lib/recombee_api_client/api/recommend_items_to_item_segment.rb
161
161
  - lib/recombee_api_client/api/recommend_items_to_user.rb
162
+ - lib/recombee_api_client/api/recommend_next_item_segments.rb
162
163
  - lib/recombee_api_client/api/recommend_next_items.rb
163
164
  - lib/recombee_api_client/api/recommend_users_to_item.rb
164
165
  - lib/recombee_api_client/api/recommend_users_to_user.rb