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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/lib/recombee_api_client/api/add_bookmark.rb +26 -26
  3. data/lib/recombee_api_client/api/add_cart_addition.rb +28 -28
  4. data/lib/recombee_api_client/api/add_detail_view.rb +32 -28
  5. data/lib/recombee_api_client/api/add_item.rb +15 -18
  6. data/lib/recombee_api_client/api/add_item_property.rb +34 -35
  7. data/lib/recombee_api_client/api/add_manual_reql_segment.rb +26 -27
  8. data/lib/recombee_api_client/api/add_purchase.rb +29 -29
  9. data/lib/recombee_api_client/api/add_rating.rb +27 -27
  10. data/lib/recombee_api_client/api/add_search_synonym.rb +29 -30
  11. data/lib/recombee_api_client/api/add_series.rb +20 -21
  12. data/lib/recombee_api_client/api/add_user.rb +14 -17
  13. data/lib/recombee_api_client/api/add_user_property.rb +30 -31
  14. data/lib/recombee_api_client/api/batch.rb +12 -16
  15. data/lib/recombee_api_client/api/composite_recommendation.rb +132 -0
  16. data/lib/recombee_api_client/api/create_auto_reql_segmentation.rb +29 -30
  17. data/lib/recombee_api_client/api/create_manual_reql_segmentation.rb +27 -28
  18. data/lib/recombee_api_client/api/create_property_based_segmentation.rb +30 -31
  19. data/lib/recombee_api_client/api/delete_all_search_synonyms.rb +15 -19
  20. data/lib/recombee_api_client/api/delete_bookmark.rb +21 -22
  21. data/lib/recombee_api_client/api/delete_cart_addition.rb +21 -22
  22. data/lib/recombee_api_client/api/delete_detail_view.rb +21 -22
  23. data/lib/recombee_api_client/api/delete_item.rb +16 -19
  24. data/lib/recombee_api_client/api/delete_item_property.rb +15 -18
  25. data/lib/recombee_api_client/api/delete_manual_reql_segment.rb +16 -19
  26. data/lib/recombee_api_client/api/delete_more_items.rb +18 -19
  27. data/lib/recombee_api_client/api/delete_purchase.rb +21 -22
  28. data/lib/recombee_api_client/api/delete_rating.rb +21 -22
  29. data/lib/recombee_api_client/api/delete_search_synonym.rb +15 -18
  30. data/lib/recombee_api_client/api/delete_segmentation.rb +15 -18
  31. data/lib/recombee_api_client/api/delete_series.rb +21 -22
  32. data/lib/recombee_api_client/api/delete_user.rb +15 -18
  33. data/lib/recombee_api_client/api/delete_user_property.rb +15 -18
  34. data/lib/recombee_api_client/api/delete_view_portion.rb +21 -22
  35. data/lib/recombee_api_client/api/get_item_property_info.rb +14 -17
  36. data/lib/recombee_api_client/api/get_item_values.rb +15 -18
  37. data/lib/recombee_api_client/api/get_segmentation.rb +15 -18
  38. data/lib/recombee_api_client/api/get_user_property_info.rb +15 -18
  39. data/lib/recombee_api_client/api/get_user_values.rb +15 -18
  40. data/lib/recombee_api_client/api/insert_to_series.rb +23 -24
  41. data/lib/recombee_api_client/api/list_item_bookmarks.rb +16 -19
  42. data/lib/recombee_api_client/api/list_item_cart_additions.rb +16 -19
  43. data/lib/recombee_api_client/api/list_item_detail_views.rb +16 -19
  44. data/lib/recombee_api_client/api/list_item_properties.rb +15 -19
  45. data/lib/recombee_api_client/api/list_item_purchases.rb +16 -19
  46. data/lib/recombee_api_client/api/list_item_ratings.rb +16 -19
  47. data/lib/recombee_api_client/api/list_item_view_portions.rb +16 -19
  48. data/lib/recombee_api_client/api/list_items.rb +62 -62
  49. data/lib/recombee_api_client/api/list_scenarios.rb +15 -19
  50. data/lib/recombee_api_client/api/list_search_synonyms.rb +20 -21
  51. data/lib/recombee_api_client/api/list_segmentations.rb +16 -17
  52. data/lib/recombee_api_client/api/list_series.rb +15 -19
  53. data/lib/recombee_api_client/api/list_series_items.rb +15 -18
  54. data/lib/recombee_api_client/api/list_user_bookmarks.rb +15 -18
  55. data/lib/recombee_api_client/api/list_user_cart_additions.rb +15 -18
  56. data/lib/recombee_api_client/api/list_user_detail_views.rb +15 -18
  57. data/lib/recombee_api_client/api/list_user_properties.rb +15 -19
  58. data/lib/recombee_api_client/api/list_user_purchases.rb +15 -18
  59. data/lib/recombee_api_client/api/list_user_ratings.rb +15 -18
  60. data/lib/recombee_api_client/api/list_user_view_portions.rb +15 -18
  61. data/lib/recombee_api_client/api/list_users.rb +56 -56
  62. data/lib/recombee_api_client/api/merge_users.rb +24 -25
  63. data/lib/recombee_api_client/api/recommend_item_segments_to_item.rb +69 -68
  64. data/lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb +70 -69
  65. data/lib/recombee_api_client/api/recommend_item_segments_to_user.rb +51 -50
  66. data/lib/recombee_api_client/api/recommend_items_to_item.rb +185 -139
  67. data/lib/recombee_api_client/api/recommend_items_to_item_segment.rb +181 -138
  68. data/lib/recombee_api_client/api/recommend_items_to_user.rb +165 -122
  69. data/lib/recombee_api_client/api/recommend_next_items.rb +24 -25
  70. data/lib/recombee_api_client/api/recommend_users_to_item.rb +151 -105
  71. data/lib/recombee_api_client/api/recommend_users_to_user.rb +154 -111
  72. data/lib/recombee_api_client/api/remove_from_series.rb +17 -18
  73. data/lib/recombee_api_client/api/request.rb +1 -1
  74. data/lib/recombee_api_client/api/reset_database.rb +15 -19
  75. data/lib/recombee_api_client/api/search_item_segments.rb +52 -51
  76. data/lib/recombee_api_client/api/search_items.rb +157 -114
  77. data/lib/recombee_api_client/api/set_item_values.rb +28 -29
  78. data/lib/recombee_api_client/api/set_user_values.rb +21 -22
  79. data/lib/recombee_api_client/api/set_values.rb +28 -28
  80. data/lib/recombee_api_client/api/set_view_portion.rb +37 -30
  81. data/lib/recombee_api_client/api/update_auto_reql_segmentation.rb +26 -27
  82. data/lib/recombee_api_client/api/update_manual_reql_segment.rb +25 -26
  83. data/lib/recombee_api_client/api/update_manual_reql_segmentation.rb +24 -25
  84. data/lib/recombee_api_client/api/update_more_items.rb +19 -20
  85. data/lib/recombee_api_client/api/update_property_based_segmentation.rb +26 -27
  86. data/lib/recombee_api_client/errors.rb +2 -5
  87. data/lib/recombee_api_client/inputs/composite_recommendation_stage_parameters.rb +240 -0
  88. data/lib/recombee_api_client/inputs/input.rb +9 -0
  89. data/lib/recombee_api_client/inputs/logic.rb +45 -0
  90. data/lib/recombee_api_client/utils/hash_normalizer.rb +21 -0
  91. data/lib/recombee_api_client/version.rb +1 -1
  92. data/lib/recombee_api_client.rb +40 -35
  93. data/recombee_api_client.gemspec +2 -3
  94. metadata +14 -10
  95. data/lib/recombee_api_client/api/hash_normalizer.rb +0 -21
@@ -0,0 +1,132 @@
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
+ # 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.
11
+ #
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
+ #
14
+ # See detailed **examples and configuration guidance** in the [Composite Scenarios documentation](https://docs.recombee.com/scenarios#composite-recommendations).
15
+ #
16
+ # **Structure**
17
+ #
18
+ # The endpoint operates in two stages:
19
+ # 1. Recommends the *source* (e.g., an Item Segment or item) to the user.
20
+ # 2. Recommends *results* (items or Item Segments) related to that *source*.
21
+ #
22
+ # For example, *Articles from <category>* can be decomposed into:
23
+ # - [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-item-segments-to-user) to find the category.
24
+ # - [Recommend Items To Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment) to recommend articles from that category.
25
+ #
26
+ # Since the first step uses [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-items-to-user), you must include the `userId` parameter in the *Composite Recommendation* request.
27
+ #
28
+ # Each *Composite Recommendation* counts as a single recommendation API request for billing.
29
+ #
30
+ # **Stage-specific Parameters**
31
+ #
32
+ # Additional parameters can be supplied via [sourceSettings](https://docs.recombee.com/api#composite-recommendation-param-sourceSettings) and [resultSettings](https://docs.recombee.com/api#composite-recommendation-param-resultSettings).
33
+ # In the example above:
34
+ # - `sourceSettings` may include any parameter valid for [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-items-to-user) (e.g., `filter`, `booster`).
35
+ # - `resultSettings` may include any parameter valid for [Recommend Items To Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment).
36
+ #
37
+ # See [this example](https://docs.recombee.com/api#composite-recommendation-example-setting-parameters-for-individual-stages) for more details.
38
+ #
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
42
+ attr_accessor :timeout, :ensure_https
43
+
44
+ ##
45
+ # * *Required arguments*
46
+ # - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
47
+ #
48
+ # You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
49
+ #
50
+ # The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
51
+ #
52
+ # - +count+ -> Number of items to be recommended (N for the top-N recommendation).
53
+ #
54
+ #
55
+ # * *Optional arguments (given as hash optional)*
56
+ # - +itemId+ -> ID of the item for which the recommendations are to be generated.
57
+ #
58
+ # - +userId+ -> ID of the user for which the recommendations are to be generated.
59
+ #
60
+ # - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
61
+ # See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
62
+ #
63
+ # The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
64
+ #
65
+ # Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
66
+ #
67
+ # - +segmentId+ -> ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.
68
+ #
69
+ # - +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
+ #
71
+ # - +sourceSettings+ -> Parameters applied for recommending the *Source* stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the *Source*.
72
+ #
73
+ # - +resultSettings+ -> Parameters applied for recommending the *Result* stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the *Result*.
74
+ #
75
+ # - +expertSettings+ -> Dictionary of custom options.
76
+ #
77
+ #
78
+ def initialize(scenario, count, optional = {})
79
+ @scenario = scenario
80
+ @count = count
81
+ optional = normalize_hash_to_camel_case(optional)
82
+ @item_id = optional['itemId']
83
+ @user_id = optional['userId']
84
+ @logic = optional['logic']
85
+ @segment_id = optional['segmentId']
86
+ @cascade_create = optional['cascadeCreate']
87
+ @source_settings = optional['sourceSettings']
88
+ @result_settings = optional['resultSettings']
89
+ @expert_settings = optional['expertSettings']
90
+ @optional = optional
91
+ @timeout = 3000
92
+ @ensure_https = false
93
+ @optional.each do |par, _|
94
+ raise UnknownOptionalParameter.new(par) unless %w[itemId userId logic segmentId cascadeCreate
95
+ sourceSettings resultSettings expertSettings].include? par
96
+ end
97
+ end
98
+
99
+ # HTTP method
100
+ def method
101
+ :post
102
+ end
103
+
104
+ # Values of body parameters as a Hash
105
+ def body_parameters
106
+ p = {}
107
+ p['scenario'] = @scenario
108
+ p['count'] = @count
109
+ p['itemId'] = @optional['itemId'] if @optional.include? 'itemId'
110
+ p['userId'] = @optional['userId'] if @optional.include? 'userId'
111
+ p['logic'] = @optional['logic'] if @optional.include? 'logic'
112
+ p['segmentId'] = @optional['segmentId'] if @optional.include? 'segmentId'
113
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
114
+ p['sourceSettings'] = @optional['sourceSettings'] if @optional.include? 'sourceSettings'
115
+ p['resultSettings'] = @optional['resultSettings'] if @optional.include? 'resultSettings'
116
+ p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
117
+
118
+ p
119
+ end
120
+
121
+ # Values of query parameters as a Hash.
122
+ # name of parameter => value of the parameter
123
+ def query_parameters
124
+ {}
125
+ end
126
+
127
+ # Relative path to the endpoint
128
+ def path
129
+ '/{databaseId}/recomms/composite/'
130
+ end
131
+ end
132
+ end
@@ -5,68 +5,67 @@
5
5
  module RecombeeApiClient
6
6
  require_relative 'request'
7
7
  require_relative '../errors'
8
-
8
+
9
9
  ##
10
- #Segment the items using a [ReQL](https://docs.recombee.com/reql) expression.
10
+ # Segment the items using a [ReQL](https://docs.recombee.com/reql) expression.
11
11
  #
12
- #For each item, the expression should return a set that contains IDs of segments to which the item belongs to.
12
+ # For each item, the expression should return a set that contains IDs of segments to which the item belongs to.
13
13
  #
14
14
  class CreateAutoReqlSegmentation < ApiRequest
15
15
  attr_reader :segmentation_id, :source_type, :expression, :title, :description
16
- attr_accessor :timeout
17
- attr_accessor :ensure_https
18
-
19
- ##
20
- # * *Required arguments*
21
- # - +segmentation_id+ -> ID of the newly created Segmentation
22
- # - +source_type+ -> What type of data should be segmented. Currently only `items` are supported.
23
- #
24
- # - +expression+ -> ReQL expression that returns for each item a set with IDs of segments to which the item belongs
25
- #
26
- #
27
- # * *Optional arguments (given as hash optional)*
28
- # - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
29
- #
30
- # - +description+ -> Description that is shown in the Recombee Admin UI.
31
- #
32
- #
16
+ attr_accessor :timeout, :ensure_https
17
+
18
+ ##
19
+ # * *Required arguments*
20
+ # - +segmentation_id+ -> ID of the newly created Segmentation
21
+ # - +source_type+ -> What type of data should be segmented. Currently only `items` are supported.
22
+ #
23
+ # - +expression+ -> ReQL expression that returns for each item a set with IDs of segments to which the item belongs
24
+ #
25
+ #
26
+ # * *Optional arguments (given as hash optional)*
27
+ # - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
28
+ #
29
+ # - +description+ -> Description that is shown in the Recombee Admin UI.
30
+ #
31
+ #
33
32
  def initialize(segmentation_id, source_type, expression, optional = {})
34
33
  @segmentation_id = segmentation_id
35
34
  @source_type = source_type
36
35
  @expression = expression
37
- optional = normalize_optional(optional)
36
+ optional = normalize_hash_to_camel_case(optional)
38
37
  @title = optional['title']
39
38
  @description = optional['description']
40
39
  @optional = optional
41
- @timeout = 10000
40
+ @timeout = 10_000
42
41
  @ensure_https = false
43
42
  @optional.each do |par, _|
44
- fail UnknownOptionalParameter.new(par) unless ["title","description"].include? par
43
+ raise UnknownOptionalParameter.new(par) unless %w[title description].include? par
45
44
  end
46
45
  end
47
-
46
+
48
47
  # HTTP method
49
48
  def method
50
49
  :put
51
50
  end
52
-
51
+
53
52
  # Values of body parameters as a Hash
54
53
  def body_parameters
55
- p = Hash.new
54
+ p = {}
56
55
  p['sourceType'] = @source_type
57
56
  p['expression'] = @expression
58
57
  p['title'] = @optional['title'] if @optional.include? 'title'
59
58
  p['description'] = @optional['description'] if @optional.include? 'description'
59
+
60
60
  p
61
61
  end
62
-
62
+
63
63
  # Values of query parameters as a Hash.
64
64
  # name of parameter => value of the parameter
65
65
  def query_parameters
66
- params = {}
67
- params
66
+ {}
68
67
  end
69
-
68
+
70
69
  # Relative path to the endpoint
71
70
  def path
72
71
  "/{databaseId}/segmentations/auto-reql/#{@segmentation_id}"
@@ -5,64 +5,63 @@
5
5
  module RecombeeApiClient
6
6
  require_relative 'request'
7
7
  require_relative '../errors'
8
-
8
+
9
9
  ##
10
- #Segment the items using multiple [ReQL](https://docs.recombee.com/reql) filters.
10
+ # Segment the items using multiple [ReQL](https://docs.recombee.com/reql) filters.
11
11
  #
12
- #Use the Add Manual ReQL Items Segment endpoint to create the individual segments.
12
+ # Use the Add Manual ReQL Items Segment endpoint to create the individual segments.
13
13
  #
14
14
  class CreateManualReqlSegmentation < ApiRequest
15
15
  attr_reader :segmentation_id, :source_type, :title, :description
16
- attr_accessor :timeout
17
- attr_accessor :ensure_https
18
-
19
- ##
20
- # * *Required arguments*
21
- # - +segmentation_id+ -> ID of the newly created Segmentation
22
- # - +source_type+ -> What type of data should be segmented. Currently only `items` are supported.
23
- #
24
- #
25
- # * *Optional arguments (given as hash optional)*
26
- # - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
27
- #
28
- # - +description+ -> Description that is shown in the Recombee Admin UI.
29
- #
30
- #
16
+ attr_accessor :timeout, :ensure_https
17
+
18
+ ##
19
+ # * *Required arguments*
20
+ # - +segmentation_id+ -> ID of the newly created Segmentation
21
+ # - +source_type+ -> What type of data should be segmented. Currently only `items` are supported.
22
+ #
23
+ #
24
+ # * *Optional arguments (given as hash optional)*
25
+ # - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
26
+ #
27
+ # - +description+ -> Description that is shown in the Recombee Admin UI.
28
+ #
29
+ #
31
30
  def initialize(segmentation_id, source_type, optional = {})
32
31
  @segmentation_id = segmentation_id
33
32
  @source_type = source_type
34
- optional = normalize_optional(optional)
33
+ optional = normalize_hash_to_camel_case(optional)
35
34
  @title = optional['title']
36
35
  @description = optional['description']
37
36
  @optional = optional
38
- @timeout = 10000
37
+ @timeout = 10_000
39
38
  @ensure_https = false
40
39
  @optional.each do |par, _|
41
- fail UnknownOptionalParameter.new(par) unless ["title","description"].include? par
40
+ raise UnknownOptionalParameter.new(par) unless %w[title description].include? par
42
41
  end
43
42
  end
44
-
43
+
45
44
  # HTTP method
46
45
  def method
47
46
  :put
48
47
  end
49
-
48
+
50
49
  # Values of body parameters as a Hash
51
50
  def body_parameters
52
- p = Hash.new
51
+ p = {}
53
52
  p['sourceType'] = @source_type
54
53
  p['title'] = @optional['title'] if @optional.include? 'title'
55
54
  p['description'] = @optional['description'] if @optional.include? 'description'
55
+
56
56
  p
57
57
  end
58
-
58
+
59
59
  # Values of query parameters as a Hash.
60
60
  # name of parameter => value of the parameter
61
61
  def query_parameters
62
- params = {}
63
- params
62
+ {}
64
63
  end
65
-
64
+
66
65
  # Relative path to the endpoint
67
66
  def path
68
67
  "/{databaseId}/segmentations/manual-reql/#{@segmentation_id}"
@@ -5,69 +5,68 @@
5
5
  module RecombeeApiClient
6
6
  require_relative 'request'
7
7
  require_relative '../errors'
8
-
8
+
9
9
  ##
10
- #Creates a Segmentation that splits the items into segments based on values of a particular item property.
10
+ # Creates a Segmentation that splits the items into segments based on values of a particular item property.
11
11
  #
12
- #A segment is created for each unique value of the property.
13
- #In case of `set` properties, a segment is created for each value in the set. Item belongs to all these segments.
12
+ # A segment is created for each unique value of the property.
13
+ # In case of `set` properties, a segment is created for each value in the set. Item belongs to all these segments.
14
14
  #
15
15
  class CreatePropertyBasedSegmentation < ApiRequest
16
16
  attr_reader :segmentation_id, :source_type, :property_name, :title, :description
17
- attr_accessor :timeout
18
- attr_accessor :ensure_https
19
-
20
- ##
21
- # * *Required arguments*
22
- # - +segmentation_id+ -> ID of the newly created Segmentation
23
- # - +source_type+ -> What type of data should be segmented. Currently only `items` are supported.
24
- #
25
- # - +property_name+ -> Name of the property on which the Segmentation should be based
26
- #
27
- #
28
- # * *Optional arguments (given as hash optional)*
29
- # - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
30
- #
31
- # - +description+ -> Description that is shown in the Recombee Admin UI.
32
- #
33
- #
17
+ attr_accessor :timeout, :ensure_https
18
+
19
+ ##
20
+ # * *Required arguments*
21
+ # - +segmentation_id+ -> ID of the newly created Segmentation
22
+ # - +source_type+ -> What type of data should be segmented. Currently only `items` are supported.
23
+ #
24
+ # - +property_name+ -> Name of the property on which the Segmentation should be based
25
+ #
26
+ #
27
+ # * *Optional arguments (given as hash optional)*
28
+ # - +title+ -> Human-readable name that is shown in the Recombee Admin UI.
29
+ #
30
+ # - +description+ -> Description that is shown in the Recombee Admin UI.
31
+ #
32
+ #
34
33
  def initialize(segmentation_id, source_type, property_name, optional = {})
35
34
  @segmentation_id = segmentation_id
36
35
  @source_type = source_type
37
36
  @property_name = property_name
38
- optional = normalize_optional(optional)
37
+ optional = normalize_hash_to_camel_case(optional)
39
38
  @title = optional['title']
40
39
  @description = optional['description']
41
40
  @optional = optional
42
- @timeout = 10000
41
+ @timeout = 10_000
43
42
  @ensure_https = false
44
43
  @optional.each do |par, _|
45
- fail UnknownOptionalParameter.new(par) unless ["title","description"].include? par
44
+ raise UnknownOptionalParameter.new(par) unless %w[title description].include? par
46
45
  end
47
46
  end
48
-
47
+
49
48
  # HTTP method
50
49
  def method
51
50
  :put
52
51
  end
53
-
52
+
54
53
  # Values of body parameters as a Hash
55
54
  def body_parameters
56
- p = Hash.new
55
+ p = {}
57
56
  p['sourceType'] = @source_type
58
57
  p['propertyName'] = @property_name
59
58
  p['title'] = @optional['title'] if @optional.include? 'title'
60
59
  p['description'] = @optional['description'] if @optional.include? 'description'
60
+
61
61
  p
62
62
  end
63
-
63
+
64
64
  # Values of query parameters as a Hash.
65
65
  # name of parameter => value of the parameter
66
66
  def query_parameters
67
- params = {}
68
- params
67
+ {}
69
68
  end
70
-
69
+
71
70
  # Relative path to the endpoint
72
71
  def path
73
72
  "/{databaseId}/segmentations/property-based/#{@segmentation_id}"
@@ -5,43 +5,39 @@
5
5
  module RecombeeApiClient
6
6
  require_relative 'request'
7
7
  require_relative '../errors'
8
-
8
+
9
9
  ##
10
- #Deletes all synonyms defined in the database.
10
+ # Deletes all synonyms defined in the database.
11
11
  #
12
12
  class DeleteAllSearchSynonyms < ApiRequest
13
-
14
- attr_accessor :timeout
15
- attr_accessor :ensure_https
16
-
17
- ##
18
- #
19
- def initialize()
20
- @timeout = 10000
13
+ attr_accessor :timeout, :ensure_https
14
+
15
+ ##
16
+ #
17
+ def initialize
18
+ @timeout = 10_000
21
19
  @ensure_https = false
22
20
  end
23
-
21
+
24
22
  # HTTP method
25
23
  def method
26
24
  :delete
27
25
  end
28
-
26
+
29
27
  # Values of body parameters as a Hash
30
28
  def body_parameters
31
- p = Hash.new
32
- p
29
+ {}
33
30
  end
34
-
31
+
35
32
  # Values of query parameters as a Hash.
36
33
  # name of parameter => value of the parameter
37
34
  def query_parameters
38
- params = {}
39
- params
35
+ {}
40
36
  end
41
-
37
+
42
38
  # Relative path to the endpoint
43
39
  def path
44
- "/{databaseId}/synonyms/items/"
40
+ '/{databaseId}/synonyms/items/'
45
41
  end
46
42
  end
47
43
  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 a bookmark uniquely specified by `userId`, `itemId`, and `timestamp` or all the bookmarks with the given `userId` and `itemId` if `timestamp` is omitted.
10
+ # Deletes a bookmark uniquely specified by `userId`, `itemId`, and `timestamp` or all the bookmarks with the given `userId` and `itemId` if `timestamp` is omitted.
11
11
  #
12
12
  class DeleteBookmark < ApiRequest
13
13
  attr_reader :user_id, :item_id, :timestamp
14
- attr_accessor :timeout
15
- attr_accessor :ensure_https
16
-
17
- ##
18
- # * *Required arguments*
19
- # - +user_id+ -> ID of the user who made the bookmark.
20
- # - +item_id+ -> ID of the item which was bookmarked.
21
- #
22
- # * *Optional arguments (given as hash optional)*
23
- # - +timestamp+ -> Unix timestamp of the bookmark. If the `timestamp` is omitted, then all the bookmarks with the given `userId` and `itemId` are deleted.
24
- #
14
+ attr_accessor :timeout, :ensure_https
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +user_id+ -> ID of the user who made the bookmark.
19
+ # - +item_id+ -> ID of the item which was bookmarked.
20
+ #
21
+ # * *Optional arguments (given as hash optional)*
22
+ # - +timestamp+ -> Unix timestamp of the bookmark. If the `timestamp` is omitted, then all the bookmarks 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 = normalize_optional(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
- fail UnknownOptionalParameter.new(par) unless ["timestamp"].include? par
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
- p = Hash.new
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
- "/{databaseId}/bookmarks/"
60
+ '/{databaseId}/bookmarks/'
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 cart addition uniquely specified by `userId`, `itemId`, and `timestamp` or all the cart additions with the given `userId` and `itemId` if `timestamp` is omitted.
10
+ # Deletes an existing cart addition uniquely specified by `userId`, `itemId`, and `timestamp` or all the cart additions with the given `userId` and `itemId` if `timestamp` is omitted.
11
11
  #
12
12
  class DeleteCartAddition < ApiRequest
13
13
  attr_reader :user_id, :item_id, :timestamp
14
- attr_accessor :timeout
15
- attr_accessor :ensure_https
16
-
17
- ##
18
- # * *Required arguments*
19
- # - +user_id+ -> ID of the user who made the cart addition.
20
- # - +item_id+ -> ID of the item which was added to the cart.
21
- #
22
- # * *Optional arguments (given as hash optional)*
23
- # - +timestamp+ -> Unix timestamp of the cart addition. If the `timestamp` is omitted, then all the cart additions with the given `userId` and `itemId` are deleted.
24
- #
14
+ attr_accessor :timeout, :ensure_https
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +user_id+ -> ID of the user who made the cart addition.
19
+ # - +item_id+ -> ID of the item which was added to the cart.
20
+ #
21
+ # * *Optional arguments (given as hash optional)*
22
+ # - +timestamp+ -> Unix timestamp of the cart addition. If the `timestamp` is omitted, then all the cart additions 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 = normalize_optional(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
- fail UnknownOptionalParameter.new(par) unless ["timestamp"].include? par
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
- p = Hash.new
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
- "/{databaseId}/cartadditions/"
60
+ '/{databaseId}/cartadditions/'
62
61
  end
63
62
  end
64
63
  end