recombee_api_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +157 -0
  5. data/Rakefile +6 -0
  6. data/lib/recombee_api_client/api/add_bookmark.rb +70 -0
  7. data/lib/recombee_api_client/api/add_cart_addition.rb +70 -0
  8. data/lib/recombee_api_client/api/add_detail_view.rb +73 -0
  9. data/lib/recombee_api_client/api/add_group.rb +53 -0
  10. data/lib/recombee_api_client/api/add_item.rb +56 -0
  11. data/lib/recombee_api_client/api/add_item_property.rb +59 -0
  12. data/lib/recombee_api_client/api/add_purchase.rb +70 -0
  13. data/lib/recombee_api_client/api/add_rating.rb +73 -0
  14. data/lib/recombee_api_client/api/add_series.rb +53 -0
  15. data/lib/recombee_api_client/api/add_user.rb +54 -0
  16. data/lib/recombee_api_client/api/batch.rb +64 -0
  17. data/lib/recombee_api_client/api/delete_bookmark.rb +61 -0
  18. data/lib/recombee_api_client/api/delete_cart_addition.rb +61 -0
  19. data/lib/recombee_api_client/api/delete_detail_view.rb +61 -0
  20. data/lib/recombee_api_client/api/delete_group.rb +56 -0
  21. data/lib/recombee_api_client/api/delete_item.rb +58 -0
  22. data/lib/recombee_api_client/api/delete_item_property.rb +54 -0
  23. data/lib/recombee_api_client/api/delete_purchase.rb +61 -0
  24. data/lib/recombee_api_client/api/delete_rating.rb +61 -0
  25. data/lib/recombee_api_client/api/delete_series.rb +56 -0
  26. data/lib/recombee_api_client/api/delete_user.rb +56 -0
  27. data/lib/recombee_api_client/api/get_item_property_info.rb +54 -0
  28. data/lib/recombee_api_client/api/get_item_values.rb +55 -0
  29. data/lib/recombee_api_client/api/insert_to_group.rb +69 -0
  30. data/lib/recombee_api_client/api/insert_to_series.rb +72 -0
  31. data/lib/recombee_api_client/api/item_based_recommendation.rb +131 -0
  32. data/lib/recombee_api_client/api/list_group_items.rb +53 -0
  33. data/lib/recombee_api_client/api/list_groups.rb +50 -0
  34. data/lib/recombee_api_client/api/list_item_bookmarks.rb +54 -0
  35. data/lib/recombee_api_client/api/list_item_cart_additions.rb +54 -0
  36. data/lib/recombee_api_client/api/list_item_detail_views.rb +54 -0
  37. data/lib/recombee_api_client/api/list_item_properties.rb +51 -0
  38. data/lib/recombee_api_client/api/list_item_purchases.rb +54 -0
  39. data/lib/recombee_api_client/api/list_item_ratings.rb +54 -0
  40. data/lib/recombee_api_client/api/list_items.rb +63 -0
  41. data/lib/recombee_api_client/api/list_series.rb +50 -0
  42. data/lib/recombee_api_client/api/list_series_items.rb +53 -0
  43. data/lib/recombee_api_client/api/list_user_bookmarks.rb +53 -0
  44. data/lib/recombee_api_client/api/list_user_cart_additions.rb +53 -0
  45. data/lib/recombee_api_client/api/list_user_detail_views.rb +53 -0
  46. data/lib/recombee_api_client/api/list_user_purchases.rb +53 -0
  47. data/lib/recombee_api_client/api/list_user_ratings.rb +53 -0
  48. data/lib/recombee_api_client/api/list_users.rb +50 -0
  49. data/lib/recombee_api_client/api/merge_users.rb +72 -0
  50. data/lib/recombee_api_client/api/remove_from_group.rb +59 -0
  51. data/lib/recombee_api_client/api/remove_from_series.rb +62 -0
  52. data/lib/recombee_api_client/api/request.rb +7 -0
  53. data/lib/recombee_api_client/api/reset_database.rb +51 -0
  54. data/lib/recombee_api_client/api/set_item_values.rb +70 -0
  55. data/lib/recombee_api_client/api/user_based_recommendation.rb +116 -0
  56. data/lib/recombee_api_client/errors.rb +44 -0
  57. data/lib/recombee_api_client/version.rb +3 -0
  58. data/lib/recombee_api_client.rb +105 -0
  59. data/recombee_api_client.gemspec +26 -0
  60. metadata +173 -0
@@ -0,0 +1,56 @@
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
+ #Deletes a user of given *userId* from the database.
11
+ #
12
+ #If there are any purchases, ratings, bookmarks, cart additions or detail views made by the user present in the database, they will be deleted in cascade as well.
13
+ #
14
+ class DeleteUser < ApiRequest
15
+ attr_reader :user_id
16
+ attr_accessor :timeout
17
+
18
+ ##
19
+ # * *Required arguments*
20
+ # - +user_id+ -> ID of the user to be added.
21
+ #
22
+ def initialize(user_id)
23
+ @user_id = user_id
24
+ @timeout = 1000
25
+ end
26
+
27
+ # HTTP method
28
+ def method
29
+ :delete
30
+ end
31
+
32
+ # Values of body parameters as a Hash
33
+ def body_parameters
34
+ p = Hash.new
35
+ p
36
+ end
37
+
38
+ # Values of query path parameters as a Hash.
39
+ # name of parameter => value of the parameter
40
+ def query_parameters
41
+ params = {}
42
+ params
43
+ end
44
+
45
+ # Relative path to the endpoint
46
+ def basic_path
47
+ "/{databaseId}/users/#{@user_id}"
48
+ end
49
+
50
+ # Relative path to the endpoint including query parameters
51
+ def path
52
+ p = "/{databaseId}/users/#{@user_id}"
53
+ p
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,54 @@
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
+ #Gets information about specified item property.
11
+ #
12
+ class GetItemPropertyInfo < ApiRequest
13
+ attr_reader :property_name
14
+ attr_accessor :timeout
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +property_name+ -> Name of the property about which the information is to be retrieved.
19
+ #
20
+ def initialize(property_name)
21
+ @property_name = property_name
22
+ @timeout = 1000
23
+ end
24
+
25
+ # HTTP method
26
+ def method
27
+ :get
28
+ end
29
+
30
+ # Values of body parameters as a Hash
31
+ def body_parameters
32
+ p = Hash.new
33
+ p
34
+ end
35
+
36
+ # Values of query path parameters as a Hash.
37
+ # name of parameter => value of the parameter
38
+ def query_parameters
39
+ params = {}
40
+ params
41
+ end
42
+
43
+ # Relative path to the endpoint
44
+ def basic_path
45
+ "/{databaseId}/items/properties/#{@property_name}"
46
+ end
47
+
48
+ # Relative path to the endpoint including query parameters
49
+ def path
50
+ p = "/{databaseId}/items/properties/#{@property_name}"
51
+ p
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,55 @@
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
+ #Get all the current property values of a given item.
11
+ #
12
+ class GetItemValues < ApiRequest
13
+ attr_reader :item_id
14
+ attr_accessor :timeout
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +item_id+ -> ID of the item properties of which are to be obtained.
19
+ #
20
+ #
21
+ def initialize(item_id)
22
+ @item_id = item_id
23
+ @timeout = 1000
24
+ end
25
+
26
+ # HTTP method
27
+ def method
28
+ :get
29
+ end
30
+
31
+ # Values of body parameters as a Hash
32
+ def body_parameters
33
+ p = Hash.new
34
+ p
35
+ end
36
+
37
+ # Values of query path parameters as a Hash.
38
+ # name of parameter => value of the parameter
39
+ def query_parameters
40
+ params = {}
41
+ params
42
+ end
43
+
44
+ # Relative path to the endpoint
45
+ def basic_path
46
+ "/{databaseId}/items/#{@item_id}"
47
+ end
48
+
49
+ # Relative path to the endpoint including query parameters
50
+ def path
51
+ p = "/{databaseId}/items/#{@item_id}"
52
+ p
53
+ end
54
+ end
55
+ 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
+ #Inserts an existing item/group into group of given `groupId`.
11
+ #
12
+ class InsertToGroup < ApiRequest
13
+ attr_reader :group_id, :item_type, :item_id, :cascade_create
14
+ attr_accessor :timeout
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +group_id+ -> ID of the group to be inserted into.
19
+ # - +item_type+ -> `item` iff the regular item from the catalog is to be inserted, `group` iff group is inserted as the item.
20
+ # - +item_id+ -> ID of the item iff `itemType` is `item`. ID of the group iff `itemType` is `group`.
21
+ #
22
+ # * *Optional arguments (given as hash optional)*
23
+ # - +cascadeCreate+ -> Indicates that any non-existing entity specified within the request should be created (as is corresponding PUT requests were invoked). This concerns both the `groupId` and the `groupId`. If `cascadeCreate` is set true, the behavior also depends on the `itemType`. Either items or group may be created if not present in the database.
24
+ #
25
+ def initialize(group_id, item_type, item_id, optional = {})
26
+ @group_id = group_id
27
+ @item_type = item_type
28
+ @item_id = item_id
29
+ @cascade_create = optional['cascadeCreate']
30
+ @optional = optional
31
+ @timeout = 1000
32
+ @optional.each do |par, _|
33
+ fail UnknownOptionalParameter.new(par) unless ["cascadeCreate"].include? par
34
+ end
35
+ end
36
+
37
+ # HTTP method
38
+ def method
39
+ :post
40
+ end
41
+
42
+ # Values of body parameters as a Hash
43
+ def body_parameters
44
+ p = Hash.new
45
+ p['itemType'] = @item_type
46
+ p['itemId'] = @item_id
47
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional['cascadeCreate']
48
+ p
49
+ end
50
+
51
+ # Values of query path 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 basic_path
60
+ "/{databaseId}/groups/#{@group_id}/items/"
61
+ end
62
+
63
+ # Relative path to the endpoint including query parameters
64
+ def path
65
+ p = "/{databaseId}/groups/#{@group_id}/items/"
66
+ p
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,72 @@
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
+ #Inserts an existing item/series into series of given seriesId at position determined by time.
11
+ #
12
+ class InsertToSeries < ApiRequest
13
+ attr_reader :series_id, :item_type, :item_id, :time, :cascade_create
14
+ attr_accessor :timeout
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +series_id+ -> ID of the series to be inserted into.
19
+ # - +item_type+ -> `item` iff the regular item from the catalog is to be inserted, `series` iff series is inserted as the item.
20
+ # - +item_id+ -> ID of the item iff `itemType` is `item`. ID of the series iff `itemType` is `series`.
21
+ # - +time+ -> Time index used for sorting items in the series. According to time, items are sorted within series in ascending order. In the example of TV show episodes, the episode number is a natural choice to be passed as time.
22
+ #
23
+ # * *Optional arguments (given as hash optional)*
24
+ # - +cascadeCreate+ -> Indicates that any non-existing entity specified within the request should be created (as is corresponding PUT requests were invoked). This concerns both the `seriesId` and the `itemId`. If `cascadeCreate` is set true, the behavior also depends on the `itemType`. Either item or series may be created if not present in the database.
25
+ #
26
+ def initialize(series_id, item_type, item_id, time, optional = {})
27
+ @series_id = series_id
28
+ @item_type = item_type
29
+ @item_id = item_id
30
+ @time = time
31
+ @cascade_create = optional['cascadeCreate']
32
+ @optional = optional
33
+ @timeout = 1000
34
+ @optional.each do |par, _|
35
+ fail UnknownOptionalParameter.new(par) unless ["cascadeCreate"].include? par
36
+ end
37
+ end
38
+
39
+ # HTTP method
40
+ def method
41
+ :post
42
+ end
43
+
44
+ # Values of body parameters as a Hash
45
+ def body_parameters
46
+ p = Hash.new
47
+ p['itemType'] = @item_type
48
+ p['itemId'] = @item_id
49
+ p['time'] = @time
50
+ p['cascadeCreate'] = @optional['cascadeCreate'] if @optional['cascadeCreate']
51
+ p
52
+ end
53
+
54
+ # Values of query path parameters as a Hash.
55
+ # name of parameter => value of the parameter
56
+ def query_parameters
57
+ params = {}
58
+ params
59
+ end
60
+
61
+ # Relative path to the endpoint
62
+ def basic_path
63
+ "/{databaseId}/series/#{@series_id}/items/"
64
+ end
65
+
66
+ # Relative path to the endpoint including query parameters
67
+ def path
68
+ p = "/{databaseId}/series/#{@series_id}/items/"
69
+ p
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,131 @@
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
+ #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.
11
+ #
12
+ class ItemBasedRecommendation < ApiRequest
13
+ attr_reader :item_id, :count, :target_user_id, :user_impact, :filter, :booster, :allow_nonexistent, :diversity, :min_relevance, :rotation_rate, :rotation_time
14
+ attr_accessor :timeout
15
+
16
+ ##
17
+ # * *Required arguments*
18
+ # - +item_id+ -> ID of the item recommendations for which are to be generated.
19
+ # - +count+ -> Number of items to be recommended (N for the top-N recommendation).
20
+ #
21
+ # * *Optional arguments (given as hash optional)*
22
+ # - +targetUserId+ -> ID of the user who will see the recommendations.
23
+ # - +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.1`
24
+ #
25
+ # - +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.
26
+ # - +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.
27
+ # - +allowNonexistent+ -> If the user does not exist in the database, returns a list of non-personalized recommendations instead of causing HTTP 404 error.
28
+ # - +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.
29
+ #
30
+ # - +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.
31
+ #
32
+ # - +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.
33
+ #
34
+ # - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to fully recover from the penalization. By example, `rotationTime=7200.0` means that items recommended more than 2 hours ago are definitely not penalized anymore. Currently, the penalization is linear, so for `rotationTime=7200.0`, an item is still penalized by `0.5` to the user after 1 hour. |
35
+ #
36
+ #
37
+ def initialize(item_id, count, optional = {})
38
+ @item_id = item_id
39
+ @count = count
40
+ @target_user_id = optional['targetUserId']
41
+ @user_impact = optional['userImpact']
42
+ @filter = optional['filter']
43
+ @booster = optional['booster']
44
+ @allow_nonexistent = optional['allowNonexistent']
45
+ @diversity = optional['diversity']
46
+ @min_relevance = optional['minRelevance']
47
+ @rotation_rate = optional['rotationRate']
48
+ @rotation_time = optional['rotationTime']
49
+ @optional = optional
50
+ @timeout = 3000
51
+ @optional.each do |par, _|
52
+ fail UnknownOptionalParameter.new(par) unless ["targetUserId","userImpact","filter","booster","allowNonexistent","diversity","minRelevance","rotationRate","rotationTime"].include? par
53
+ end
54
+ end
55
+
56
+ # HTTP method
57
+ def method
58
+ :get
59
+ end
60
+
61
+ # Values of body parameters as a Hash
62
+ def body_parameters
63
+ p = Hash.new
64
+ p
65
+ end
66
+
67
+ # Values of query path parameters as a Hash.
68
+ # name of parameter => value of the parameter
69
+ def query_parameters
70
+ params = {}
71
+ params['count'] = @count
72
+ params['targetUserId'] = @optional['targetUserId'] if @optional['targetUserId']
73
+ params['userImpact'] = @optional['userImpact'] if @optional['userImpact']
74
+ params['filter'] = @optional['filter'] if @optional['filter']
75
+ params['booster'] = @optional['booster'] if @optional['booster']
76
+ params['allowNonexistent'] = @optional['allowNonexistent'] if @optional['allowNonexistent']
77
+ params['diversity'] = @optional['diversity'] if @optional['diversity']
78
+ params['minRelevance'] = @optional['minRelevance'] if @optional['minRelevance']
79
+ params['rotationRate'] = @optional['rotationRate'] if @optional['rotationRate']
80
+ params['rotationTime'] = @optional['rotationTime'] if @optional['rotationTime']
81
+ params
82
+ end
83
+
84
+ # Relative path to the endpoint
85
+ def basic_path
86
+ "/{databaseId}/items/#{@item_id}/recomms/"
87
+ end
88
+
89
+ # Relative path to the endpoint including query parameters
90
+ def path
91
+ p = "/{databaseId}/items/#{@item_id}/recomms/?count=#{@count}"
92
+ if @optional.include? 'targetUserId'
93
+ p += (p.include? '?') ? '&' : '?'
94
+ p += "targetUserId=#{@optional['targetUserId']}"
95
+ end
96
+ if @optional.include? 'userImpact'
97
+ p += (p.include? '?') ? '&' : '?'
98
+ p += "userImpact=#{@optional['userImpact']}"
99
+ end
100
+ if @optional.include? 'filter'
101
+ p += (p.include? '?') ? '&' : '?'
102
+ p += "filter=#{@optional['filter']}"
103
+ end
104
+ if @optional.include? 'booster'
105
+ p += (p.include? '?') ? '&' : '?'
106
+ p += "booster=#{@optional['booster']}"
107
+ end
108
+ if @optional.include? 'allowNonexistent'
109
+ p += (p.include? '?') ? '&' : '?'
110
+ p += "allowNonexistent=#{@optional['allowNonexistent']}"
111
+ end
112
+ if @optional.include? 'diversity'
113
+ p += (p.include? '?') ? '&' : '?'
114
+ p += "diversity=#{@optional['diversity']}"
115
+ end
116
+ if @optional.include? 'minRelevance'
117
+ p += (p.include? '?') ? '&' : '?'
118
+ p += "minRelevance=#{@optional['minRelevance']}"
119
+ end
120
+ if @optional.include? 'rotationRate'
121
+ p += (p.include? '?') ? '&' : '?'
122
+ p += "rotationRate=#{@optional['rotationRate']}"
123
+ end
124
+ if @optional.include? 'rotationTime'
125
+ p += (p.include? '?') ? '&' : '?'
126
+ p += "rotationTime=#{@optional['rotationTime']}"
127
+ end
128
+ p
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,53 @@
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
+ #List all the items present in the given group.
11
+ class ListGroupItems < ApiRequest
12
+ attr_reader :group_id
13
+ attr_accessor :timeout
14
+
15
+ ##
16
+ # * *Required arguments*
17
+ # - +group_id+ -> ID of the group items of which are to be listed.
18
+ #
19
+ def initialize(group_id)
20
+ @group_id = group_id
21
+ @timeout = 1000
22
+ end
23
+
24
+ # HTTP method
25
+ def method
26
+ :get
27
+ end
28
+
29
+ # Values of body parameters as a Hash
30
+ def body_parameters
31
+ p = Hash.new
32
+ p
33
+ end
34
+
35
+ # Values of query path parameters as a Hash.
36
+ # name of parameter => value of the parameter
37
+ def query_parameters
38
+ params = {}
39
+ params
40
+ end
41
+
42
+ # Relative path to the endpoint
43
+ def basic_path
44
+ "/{databaseId}/groups/#{@group_id}/items/"
45
+ end
46
+
47
+ # Relative path to the endpoint including query parameters
48
+ def path
49
+ p = "/{databaseId}/groups/#{@group_id}/items/"
50
+ p
51
+ end
52
+ end
53
+ end