recombee_api_client 6.1.0 → 6.3.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: 251fbc7719eb5f880e85cbc68996c563e893c0bc30b304ee75c5b34c19ac6b99
4
- data.tar.gz: 753e1a9f4bf897a7e15a6ddc2127f7ca062193a1c2fce6674815167eed87ce84
3
+ metadata.gz: 322e3294002769557374b46669a1958f70b82f0d0934d0c3591fe2171d6f4339
4
+ data.tar.gz: 454a96ba684ea9cfd9ccfe054dc11a3882c44ea223d791443ebfec60942283d6
5
5
  SHA512:
6
- metadata.gz: 5a83df05802119f4c100a2f63dfd1efa216db575a6c6547fe93c0611a0a0bd509b603d9a20facb57ba829d944b750ae73d061dbce3fa14de11d5a0d2d7381d51
7
- data.tar.gz: 85e6cd1960ebab74f7de00ca4dbf0da42ba001bd9d3f7685d0f43609ebef8323836b04b4cb386aff2519a46c4fd79e39abacaa1bb641704d21d315c6d30d8c89
6
+ metadata.gz: b81694d2b9129008f36176f97549987cc0b6e70e1483c7255f1a96e93212bd031a39e195affa1a983981a5ebb75bd39a7681769f285e59d718cdc46119c4544d
7
+ data.tar.gz: bab1496561a47afc49bf0395848d31a903bf6e6bcaee3c438c5c04957b3833a6b59e67886414f49a7a4b077dd2e4dbfdc1951b443867bf639cc2c5ec308bc0cb
@@ -10,7 +10,7 @@ module RecombeeApiClient
10
10
  # Adding an item property is somewhat equivalent to adding a column to the table of items. The items may be characterized by various properties of different types.
11
11
  #
12
12
  class AddItemProperty < ApiRequest
13
- attr_reader :property_name, :type
13
+ attr_reader :property_name, :type, :role, :metadata
14
14
  attr_accessor :timeout, :ensure_https
15
15
 
16
16
  ##
@@ -19,7 +19,7 @@ module RecombeeApiClient
19
19
  #
20
20
  # - +type+ -> Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
21
21
  #
22
- # * `int`- Signed integer number.
22
+ # * `int` - Signed integer number.
23
23
  #
24
24
  # * `double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).
25
25
  #
@@ -27,7 +27,7 @@ module RecombeeApiClient
27
27
  #
28
28
  # * `boolean` - *true* / *false*
29
29
  #
30
- # * `timestamp` - Value representing date and time.
30
+ # * `timestamp` - Value representing date and time. ISO8601-1 pattern (string) or UTC epoch time (number).
31
31
  #
32
32
  # * `set` - Set of strings.
33
33
  #
@@ -36,11 +36,23 @@ module RecombeeApiClient
36
36
  # * `imageList` - List of URLs that refer to images.
37
37
  #
38
38
  #
39
- def initialize(property_name, type)
39
+ # * *Optional arguments (given as hash optional)*
40
+ # - +role+ -> [Role](https://docs.recombee.com/api/property_roles_metadata#roles) to assign to the property.
41
+ #
42
+ # - +metadata+ -> List of [metadata](https://docs.recombee.com/api/property_roles_metadata#metadata) entries to assign to the property.
43
+ #
44
+ def initialize(property_name, type, optional = {})
40
45
  @property_name = property_name
41
46
  @type = type
47
+ optional = normalize_hash_to_camel_case(optional)
48
+ @role = optional['role']
49
+ @metadata = optional['metadata']
50
+ @optional = optional
42
51
  @timeout = 100_000
43
52
  @ensure_https = false
53
+ @optional.each do |par, _|
54
+ raise UnknownOptionalParameter.new(par) unless %w[role metadata].include? par
55
+ end
44
56
  end
45
57
 
46
58
  # HTTP method
@@ -50,16 +62,18 @@ module RecombeeApiClient
50
62
 
51
63
  # Values of body parameters as a Hash
52
64
  def body_parameters
53
- {}
65
+ p = {}
66
+ p['type'] = @type
67
+ p['role'] = @optional['role'] if @optional.include? 'role'
68
+ p['metadata'] = @optional['metadata'] if @optional.include? 'metadata'
69
+
70
+ p
54
71
  end
55
72
 
56
73
  # Values of query parameters as a Hash.
57
74
  # name of parameter => value of the parameter
58
75
  def query_parameters
59
- params = {}
60
- params['type'] = @type
61
-
62
- params
76
+ {}
63
77
  end
64
78
 
65
79
  # Relative path to the endpoint
@@ -10,7 +10,7 @@ module RecombeeApiClient
10
10
  # Adding a user property is somewhat equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.
11
11
  #
12
12
  class AddUserProperty < ApiRequest
13
- attr_reader :property_name, :type
13
+ attr_reader :property_name, :type, :role, :metadata
14
14
  attr_accessor :timeout, :ensure_https
15
15
 
16
16
  ##
@@ -27,16 +27,28 @@ module RecombeeApiClient
27
27
  #
28
28
  # * `boolean` - *true* / *false*
29
29
  #
30
- # * `timestamp` - Value representing date and time.
30
+ # * `timestamp` - Value representing date and time. ISO8601-1 pattern (string) or UTC epoch time (number).
31
31
  #
32
32
  # * `set` - Set of strings.
33
33
  #
34
34
  #
35
- def initialize(property_name, type)
35
+ # * *Optional arguments (given as hash optional)*
36
+ # - +role+ -> [Role](https://docs.recombee.com/api/property_roles_metadata#roles) to assign to the property.
37
+ #
38
+ # - +metadata+ -> List of [metadata](https://docs.recombee.com/api/property_roles_metadata#metadata) entries to assign to the property.
39
+ #
40
+ def initialize(property_name, type, optional = {})
36
41
  @property_name = property_name
37
42
  @type = type
43
+ optional = normalize_hash_to_camel_case(optional)
44
+ @role = optional['role']
45
+ @metadata = optional['metadata']
46
+ @optional = optional
38
47
  @timeout = 100_000
39
48
  @ensure_https = false
49
+ @optional.each do |par, _|
50
+ raise UnknownOptionalParameter.new(par) unless %w[role metadata].include? par
51
+ end
40
52
  end
41
53
 
42
54
  # HTTP method
@@ -46,16 +58,18 @@ module RecombeeApiClient
46
58
 
47
59
  # Values of body parameters as a Hash
48
60
  def body_parameters
49
- {}
61
+ p = {}
62
+ p['type'] = @type
63
+ p['role'] = @optional['role'] if @optional.include? 'role'
64
+ p['metadata'] = @optional['metadata'] if @optional.include? 'metadata'
65
+
66
+ p
50
67
  end
51
68
 
52
69
  # Values of query parameters as a Hash.
53
70
  # name of parameter => value of the parameter
54
71
  def query_parameters
55
- params = {}
56
- params['type'] = @type
57
-
58
- params
72
+ {}
59
73
  end
60
74
 
61
75
  # Relative path to the endpoint
@@ -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'
@@ -0,0 +1,70 @@
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](https://docs.recombee.com/segmentations) to be shown as the next recommendations when a user scrolls (e.g., within a carousel or feed of Item Segments such as brands, artists, topics, or categories).
11
+ #
12
+ # The request requires the `recommId` of a base recommendation request and the number of Segments to return (`count`).
13
+ #
14
+ # The base request can be one of:
15
+ # - [Recommend Item Segments to Item](https://docs.recombee.com/api#recommend-item-segments-to-item)
16
+ # - [Recommend Item Segments to User](https://docs.recombee.com/api#recommend-item-segments-to-user)
17
+ # - [Recommend Item Segments to Item Segment](https://docs.recombee.com/api#recommend-item-segments-to-item-segment)
18
+ # - [Search Item Segments](https://docs.recombee.com/api#search-item-segments)
19
+ #
20
+ # All other parameters are inherited from the base request associated with the provided `recommId`.
21
+ #
22
+ # This endpoint can be called multiple times for a single `recommId`. Each call returns different Item Segments that have not been recommended in previous calls.
23
+ # The number of calls made so far is returned in the `numberNextRecommsCalls` field.
24
+ #
25
+ # Requests can be made up to 30 minutes after the base request or the most recent Recommend Next Item Segments call.
26
+ #
27
+ # For billing purposes, each call to this endpoint is counted as a separate recommendation request.
28
+ #
29
+ class RecommendNextItemSegments < ApiRequest
30
+ attr_reader :recomm_id, :count
31
+ attr_accessor :timeout, :ensure_https
32
+
33
+ ##
34
+ # * *Required arguments*
35
+ # - +recomm_id+ -> ID of the base recommendation request for which next recommendations should be returned
36
+ # - +count+ -> Number of item segments to be recommended
37
+ #
38
+ #
39
+ def initialize(recomm_id, count)
40
+ @recomm_id = recomm_id
41
+ @count = count
42
+ @timeout = 3000
43
+ @ensure_https = false
44
+ end
45
+
46
+ # HTTP method
47
+ def method
48
+ :post
49
+ end
50
+
51
+ # Values of body parameters as a Hash
52
+ def body_parameters
53
+ p = {}
54
+ p['count'] = @count
55
+
56
+ p
57
+ end
58
+
59
+ # Values of query parameters as a Hash.
60
+ # name of parameter => value of the parameter
61
+ def query_parameters
62
+ {}
63
+ end
64
+
65
+ # Relative path to the endpoint
66
+ def path
67
+ "/{databaseId}/recomms/next/item-segments/#{@recomm_id}"
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # This file is auto-generated, do not edit
3
+ #
4
+
5
+ require 'json'
6
+
7
+ module RecombeeApiClient
8
+ require_relative 'input'
9
+ require_relative '../errors'
10
+
11
+ ##
12
+ # Initializes PropertyMetadata input#
13
+ class PropertyMetadata < Input
14
+ attr_reader :name, :settings
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +name+ -> Name of the [metadata](https://docs.recombee.com/api/property_roles_metadata#metadata) assigned to the property.
19
+ #
20
+ # * *Optional arguments (given as hash optional)*
21
+ # - +settings+ -> Optional configuration for this metadata entry.
22
+ #
23
+ def initialize(name, optional = {})
24
+ @name = name
25
+ optional = normalize_hash_to_camel_case(optional)
26
+ @settings = optional['settings']
27
+ @optional = optional
28
+ @optional.each do |par, _|
29
+ raise UnknownOptionalParameter.new(par) unless ['settings'].include? par
30
+ end
31
+ end
32
+
33
+ # Return only JSON-serializable primitives.
34
+ def as_json(_options = {})
35
+ res = {}
36
+ res['name'] = @name
37
+ res['settings'] = @optional['settings'] if @optional['settings']
38
+
39
+ res
40
+ end
41
+
42
+ def to_json(*args)
43
+ as_json.to_json(*args)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # This file is auto-generated, do not edit
3
+ #
4
+
5
+ require 'json'
6
+
7
+ module RecombeeApiClient
8
+ require_relative 'input'
9
+ require_relative '../errors'
10
+
11
+ ##
12
+ # Initializes PropertyRole input#
13
+ class PropertyRole < Input
14
+ attr_reader :name, :settings
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +name+ -> Name of the [role](https://docs.recombee.com/api/property_roles_metadata#roles) assigned to the property.
19
+ #
20
+ # * *Optional arguments (given as hash optional)*
21
+ # - +settings+ -> Optional configuration specific to the selected role.
22
+ #
23
+ def initialize(name, optional = {})
24
+ @name = name
25
+ optional = normalize_hash_to_camel_case(optional)
26
+ @settings = optional['settings']
27
+ @optional = optional
28
+ @optional.each do |par, _|
29
+ raise UnknownOptionalParameter.new(par) unless ['settings'].include? par
30
+ end
31
+ end
32
+
33
+ # Return only JSON-serializable primitives.
34
+ def as_json(_options = {})
35
+ res = {}
36
+ res['name'] = @name
37
+ res['settings'] = @optional['settings'] if @optional['settings']
38
+
39
+ res
40
+ end
41
+
42
+ def to_json(*args)
43
+ as_json.to_json(*args)
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,3 @@
1
1
  module RecombeeApiClient
2
- VERSION = '6.1.0'
2
+ VERSION = '6.3.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.1.0' }
22
+ USER_AGENT = { 'User-Agent' => 'recombee-ruby-api-client/6.3.0' }
23
23
 
24
24
  ##
25
25
  # - +account+ -> Name of your account at Recombee
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recombee_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Fiedler
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-06-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: httparty
@@ -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
@@ -180,6 +181,8 @@ files:
180
181
  - lib/recombee_api_client/inputs/composite_recommendation_stage_parameters.rb
181
182
  - lib/recombee_api_client/inputs/input.rb
182
183
  - lib/recombee_api_client/inputs/logic.rb
184
+ - lib/recombee_api_client/inputs/property_metadata.rb
185
+ - lib/recombee_api_client/inputs/property_role.rb
183
186
  - lib/recombee_api_client/utils/hash_normalizer.rb
184
187
  - lib/recombee_api_client/version.rb
185
188
  - recombee_api_client.gemspec
@@ -201,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
204
  - !ruby/object:Gem::Version
202
205
  version: '0'
203
206
  requirements: []
204
- rubygems_version: 3.7.2
207
+ rubygems_version: 3.6.2
205
208
  specification_version: 4
206
209
  summary: Client for Recombee recommendation API
207
210
  test_files: []