|
| 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 | + #The view portions feature is currently experimental. |
| 11 | + # |
| 12 | + #Sets viewed portion of an item (for example a video or article) by a user (at a session). |
| 13 | + #If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated. |
| 14 | + # |
| 15 | + class SetViewPortion < ApiRequest |
| 16 | + attr_reader :user_id, :item_id, :session_id, :timestamp, :portion, :cascade_create |
| 17 | + attr_accessor :timeout |
| 18 | + attr_accessor :ensure_https |
| 19 | + |
| 20 | + ## |
| 21 | + # * *Required arguments* |
| 22 | + # - +user_id+ -> User who viewed a portion of the item |
| 23 | + # - +item_id+ -> Viewed item |
| 24 | + # - +portion+ -> Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). |
| 25 | + # |
| 26 | + # * *Optional arguments (given as hash optional)* |
| 27 | + # - +sessionId+ -> Id of session in which the user viewed the item |
| 28 | + # - +timestamp+ -> UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time. |
| 29 | + # - +cascadeCreate+ -> Sets whether the given user/item should be created if not present in the database. |
| 30 | + # |
| 31 | + def initialize(user_id, item_id, portion, optional = {}) |
| 32 | + @user_id = user_id |
| 33 | + @item_id = item_id |
| 34 | + @portion = portion |
| 35 | + @session_id = optional['sessionId'] |
| 36 | + @timestamp = optional['timestamp'] |
| 37 | + @cascade_create = optional['cascadeCreate'] |
| 38 | + @optional = optional |
| 39 | + @timeout = 1000 |
| 40 | + @ensure_https = false |
| 41 | + @optional.each do |par, _| |
| 42 | + fail UnknownOptionalParameter.new(par) unless ["sessionId","timestamp","cascadeCreate"].include? par |
| 43 | + end |
| 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 = Hash.new |
| 54 | + p['userId'] = @user_id |
| 55 | + p['itemId'] = @item_id |
| 56 | + p['portion'] = @portion |
| 57 | + p['sessionId'] = @optional['sessionId'] if @optional.include? 'sessionId' |
| 58 | + p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' |
| 59 | + p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' |
| 60 | + p |
| 61 | + end |
| 62 | + |
| 63 | + # Values of query parameters as a Hash. |
| 64 | + # name of parameter => value of the parameter |
| 65 | + def query_parameters |
| 66 | + params = {} |
| 67 | + params |
| 68 | + end |
| 69 | + |
| 70 | + # Relative path to the endpoint |
| 71 | + def path |
| 72 | + "/{databaseId}/viewportions/" |
| 73 | + end |
| 74 | + end |
| 75 | +end |
0 commit comments