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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/recombee_api_client/api/add_bookmark.rb +1 -1
  4. data/lib/recombee_api_client/api/add_cart_addition.rb +3 -3
  5. data/lib/recombee_api_client/api/add_detail_view.rb +1 -1
  6. data/lib/recombee_api_client/api/add_group.rb +1 -1
  7. data/lib/recombee_api_client/api/add_item.rb +2 -2
  8. data/lib/recombee_api_client/api/add_item_property.rb +1 -1
  9. data/lib/recombee_api_client/api/add_manual_reql_segment.rb +69 -0
  10. data/lib/recombee_api_client/api/add_purchase.rb +4 -4
  11. data/lib/recombee_api_client/api/add_rating.rb +1 -1
  12. data/lib/recombee_api_client/api/add_series.rb +1 -1
  13. data/lib/recombee_api_client/api/add_user_property.rb +2 -2
  14. data/lib/recombee_api_client/api/create_auto_reql_segmentation.rb +75 -0
  15. data/lib/recombee_api_client/api/create_manual_reql_segmentation.rb +71 -0
  16. data/lib/recombee_api_client/api/create_property_based_segmentation.rb +76 -0
  17. data/lib/recombee_api_client/api/delete_bookmark.rb +3 -3
  18. data/lib/recombee_api_client/api/delete_cart_addition.rb +3 -3
  19. data/lib/recombee_api_client/api/delete_detail_view.rb +3 -3
  20. data/lib/recombee_api_client/api/delete_group.rb +2 -2
  21. data/lib/recombee_api_client/api/delete_item.rb +3 -3
  22. data/lib/recombee_api_client/api/delete_manual_reql_segment.rb +52 -0
  23. data/lib/recombee_api_client/api/delete_more_items.rb +52 -0
  24. data/lib/recombee_api_client/api/delete_purchase.rb +3 -3
  25. data/lib/recombee_api_client/api/delete_rating.rb +2 -2
  26. data/lib/recombee_api_client/api/delete_search_synonym.rb +1 -1
  27. data/lib/recombee_api_client/api/delete_segmentation.rb +50 -0
  28. data/lib/recombee_api_client/api/delete_series.rb +1 -1
  29. data/lib/recombee_api_client/api/delete_user.rb +2 -2
  30. data/lib/recombee_api_client/api/delete_user_property.rb +1 -1
  31. data/lib/recombee_api_client/api/get_item_values.rb +2 -2
  32. data/lib/recombee_api_client/api/get_segmentation.rb +50 -0
  33. data/lib/recombee_api_client/api/get_user_values.rb +2 -2
  34. data/lib/recombee_api_client/api/insert_to_group.rb +2 -2
  35. data/lib/recombee_api_client/api/insert_to_series.rb +2 -2
  36. data/lib/recombee_api_client/api/list_group_items.rb +1 -1
  37. data/lib/recombee_api_client/api/list_item_bookmarks.rb +2 -2
  38. data/lib/recombee_api_client/api/list_item_cart_additions.rb +2 -2
  39. data/lib/recombee_api_client/api/list_item_detail_views.rb +2 -2
  40. data/lib/recombee_api_client/api/list_item_purchases.rb +2 -2
  41. data/lib/recombee_api_client/api/list_item_ratings.rb +2 -2
  42. data/lib/recombee_api_client/api/list_item_view_portions.rb +2 -2
  43. data/lib/recombee_api_client/api/list_items.rb +1 -1
  44. data/lib/recombee_api_client/api/list_segmentations.rb +51 -0
  45. data/lib/recombee_api_client/api/list_series_items.rb +2 -2
  46. data/lib/recombee_api_client/api/list_user_bookmarks.rb +1 -1
  47. data/lib/recombee_api_client/api/list_user_cart_additions.rb +1 -1
  48. data/lib/recombee_api_client/api/list_user_detail_views.rb +1 -1
  49. data/lib/recombee_api_client/api/list_user_purchases.rb +1 -1
  50. data/lib/recombee_api_client/api/list_user_ratings.rb +1 -1
  51. data/lib/recombee_api_client/api/list_user_view_portions.rb +1 -1
  52. data/lib/recombee_api_client/api/list_users.rb +1 -1
  53. data/lib/recombee_api_client/api/merge_users.rb +2 -2
  54. data/lib/recombee_api_client/api/recommend_item_segments_to_item.rb +131 -0
  55. data/lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb +131 -0
  56. data/lib/recombee_api_client/api/recommend_item_segments_to_user.rb +111 -0
  57. data/lib/recombee_api_client/api/recommend_items_to_item.rb +26 -26
  58. data/lib/recombee_api_client/api/recommend_items_to_user.rb +23 -23
  59. data/lib/recombee_api_client/api/recommend_next_items.rb +2 -2
  60. data/lib/recombee_api_client/api/recommend_users_to_item.rb +18 -18
  61. data/lib/recombee_api_client/api/recommend_users_to_user.rb +21 -21
  62. data/lib/recombee_api_client/api/reset_database.rb +1 -1
  63. data/lib/recombee_api_client/api/search_item_segments.rb +114 -0
  64. data/lib/recombee_api_client/api/search_items.rb +17 -17
  65. data/lib/recombee_api_client/api/set_view_portion.rb +3 -3
  66. data/lib/recombee_api_client/api/update_auto_reql_segmentation.rb +69 -0
  67. data/lib/recombee_api_client/api/update_manual_reql_segment.rb +67 -0
  68. data/lib/recombee_api_client/api/update_manual_reql_segmentation.rb +65 -0
  69. data/lib/recombee_api_client/api/update_more_items.rb +63 -0
  70. data/lib/recombee_api_client/api/update_property_based_segmentation.rb +69 -0
  71. data/lib/recombee_api_client/version.rb +1 -1
  72. data/lib/recombee_api_client.rb +40 -15
  73. data/recombee_api_client.gemspec +2 -2
  74. metadata +24 -8
  75. data/lib/recombee_api_client/api/item_based_recommendation.rb +0 -159
  76. data/lib/recombee_api_client/api/user_based_recommendation.rb +0 -143
@@ -1,143 +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 RecommendItemsToUser request instead.
11
- #
12
- #Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user.
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 UserBasedRecommendation < ApiRequest
17
- attr_reader :user_id, :count, :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
- # - +user_id+ -> ID of the user for whom the personalized 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
- # - +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.
28
- # - +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.
29
- # - +allowNonexistent+ -> If the user does not exist in the database, returns a list of non-personalized recommendations instead of causing HTTP 404 error. It doesn't create the user in the database.
30
- # - +cascadeCreate+ -> If the user 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 user, as the user will be already known to the system.
31
- # - +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.
32
- # - +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.
33
- #
34
- #Example response:
35
- #```
36
- # [
37
- # {
38
- # "itemId": "tv-178",
39
- # "description": "4K TV with 3D feature",
40
- # "categories": ["Electronics", "Televisions"],
41
- # "price": 342,
42
- # "url": "myshop.com/tv-178"
43
- # },
44
- # {
45
- # "itemId": "mixer-42",
46
- # "description": "Stainless Steel Mixer",
47
- # "categories": ["Home & Kitchen"],
48
- # "price": 39,
49
- # "url": "myshop.com/mixer-42"
50
- # }
51
- # ]
52
- #```
53
- #
54
- # - +includedProperties+ -> Allows to specify, which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
55
- #
56
- #Example response for `includedProperties=description,price`:
57
- #```
58
- # [
59
- # {
60
- # "itemId": "tv-178",
61
- # "description": "4K TV with 3D feature",
62
- # "price": 342
63
- # },
64
- # {
65
- # "itemId": "mixer-42",
66
- # "description": "Stainless Steel Mixer",
67
- # "price": 39
68
- # }
69
- # ]
70
- #```
71
- #
72
- # - +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.
73
- #
74
- # - +minRelevance+ -> **Expert option** 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.
75
- #
76
- # - +rotationRate+ -> **Expert option** 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.1`.
77
- #
78
- # - +rotationTime+ -> **Expert option** 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`.
79
- #
80
- # - +expertSettings+ -> Dictionary of custom options.
81
- #
82
- #
83
- def initialize(user_id, count, optional = {})
84
- @user_id = user_id
85
- @count = count
86
- optional = normalize_optional(optional)
87
- @filter = optional['filter']
88
- @booster = optional['booster']
89
- @allow_nonexistent = optional['allowNonexistent']
90
- @cascade_create = optional['cascadeCreate']
91
- @scenario = optional['scenario']
92
- @return_properties = optional['returnProperties']
93
- @included_properties = optional['includedProperties']
94
- @diversity = optional['diversity']
95
- @min_relevance = optional['minRelevance']
96
- @rotation_rate = optional['rotationRate']
97
- @rotation_time = optional['rotationTime']
98
- @expert_settings = optional['expertSettings']
99
- @optional = optional
100
- @timeout = 3000
101
- @ensure_https = false
102
- @optional.each do |par, _|
103
- fail UnknownOptionalParameter.new(par) unless ["filter","booster","allowNonexistent","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings"].include? par
104
- end
105
- end
106
-
107
- # HTTP method
108
- def method
109
- :post
110
- end
111
-
112
- # Values of body parameters as a Hash
113
- def body_parameters
114
- p = Hash.new
115
- p['count'] = @count
116
- p['filter'] = @optional['filter'] if @optional.include? 'filter'
117
- p['booster'] = @optional['booster'] if @optional.include? 'booster'
118
- p['allowNonexistent'] = @optional['allowNonexistent'] if @optional.include? 'allowNonexistent'
119
- p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
120
- p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
121
- p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
122
- p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
123
- p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
124
- p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
125
- p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
126
- p['rotationTime'] = @optional['rotationTime'] if @optional.include? 'rotationTime'
127
- p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
128
- p
129
- end
130
-
131
- # Values of query parameters as a Hash.
132
- # name of parameter => value of the parameter
133
- def query_parameters
134
- params = {}
135
- params
136
- end
137
-
138
- # Relative path to the endpoint
139
- def path
140
- "/{databaseId}/users/#{@user_id}/recomms/"
141
- end
142
- end
143
- end