class RecombeeApiClient::AddRating
Adds a rating of the given item made by the given user.
Attributes
Public Class Methods
-
*Required arguments*
-
user_id
-> User who submitted the rating -
item_id
-> Rated item -
rating
-> Rating rescaled to interval [-1.0,1.0], where -1.0 means the worst rating possible, 0.0 means neutral, and 1.0 means absolutely positive rating. For example, in the case of 5-star evaluations, rating = (numStars-3)/2 formula may be used for the conversion.
-
-
*Optional arguments (given as hash optional)*
-
timestamp
-> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time. -
cascadeCreate
-> Sets whether the given user/item should be created if not present in the database. -
recommId
-> If this rating is based on a recommendation request, ‘recommId` is the id of the clicked recommendation. -
additionalData
-> A dictionary of additional data for the interaction.
-
# File lib/recombee_api_client/api/add_rating.rb, line 29 def initialize(user_id, item_id, rating, optional = {}) @user_id = user_id @item_id = item_id @rating = rating optional = normalize_optional(optional) @timestamp = optional['timestamp'] @cascade_create = optional['cascadeCreate'] @recomm_id = optional['recommId'] @additional_data = optional['additionalData'] @optional = optional @timeout = 1000 @ensure_https = false @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["timestamp","cascadeCreate","recommId","additionalData"].include? par end end
Public Instance Methods
Values of body parameters as a Hash
# File lib/recombee_api_client/api/add_rating.rb, line 52 def body_parameters p = Hash.new p['userId'] = @user_id p['itemId'] = @item_id p['rating'] = @rating p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' p['recommId'] = @optional['recommId'] if @optional.include? 'recommId' p['additionalData'] = @optional['additionalData'] if @optional.include? 'additionalData' p end
HTTP method
# File lib/recombee_api_client/api/add_rating.rb, line 47 def method :post end
Relative path to the endpoint
# File lib/recombee_api_client/api/add_rating.rb, line 72 def path "/{databaseId}/ratings/" end
Values of query parameters as a Hash. name of parameter => value of the parameter
# File lib/recombee_api_client/api/add_rating.rb, line 66 def query_parameters params = {} params end