Class: RecombeeApiClient::AddDetailView
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::AddDetailView
- Defined in:
- lib/recombee_api_client/api/add_detail_view.rb
Overview
Adds a detail view of the given item made by the given user.
Instance Attribute Summary collapse
-
#additional_data ⇒ Object
readonly
Returns the value of attribute additional_data.
-
#auto_presented ⇒ Object
readonly
Returns the value of attribute auto_presented.
-
#cascade_create ⇒ Object
readonly
Returns the value of attribute cascade_create.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
-
#recomm_id ⇒ Object
readonly
Returns the value of attribute recomm_id.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#body_parameters ⇒ Object
Values of body parameters as a Hash.
-
#initialize(user_id, item_id, optional = {}) ⇒ AddDetailView
constructor
-
*Required arguments* -
user_id-> User who viewed the item -item_id-> Viewed item.
-
-
#method ⇒ Object
HTTP method.
-
#path ⇒ Object
Relative path to the endpoint.
-
#query_parameters ⇒ Object
Values of query parameters as a Hash.
Methods included from HashNormalizer
#camelize, #normalize_hash_to_camel_case
Constructor Details
#initialize(user_id, item_id, optional = {}) ⇒ AddDetailView
-
*Required arguments*
-
user_id-> User who viewed the item -
item_id-> Viewed item
-
-
*Optional arguments (given as hash optional)*
-
timestamp-> UTC timestamp of the view as ISO8601-1 pattern or UTC epoch time. The default value is the current time. -
duration-> Duration of the view -
cascadeCreate-> Sets whether the given user/item should be created if not present in the database. -
recommId-> If this detail view is based on a recommendation request,recommIdis the id of the clicked recommendation. -
additionalData-> A dictionary of additional data for the interaction. -
autoPresented-> Indicates whether the item was automatically presented to the user (e.g., in a swiping feed) or explicitly requested by the user (e.g., by clicking on a link). Defaults tofalse.
-
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 30 def initialize(user_id, item_id, optional = {}) @user_id = user_id @item_id = item_id optional = normalize_hash_to_camel_case(optional) @timestamp = optional['timestamp'] @duration = optional['duration'] @cascade_create = optional['cascadeCreate'] @recomm_id = optional['recommId'] @additional_data = optional['additionalData'] @auto_presented = optional['autoPresented'] @optional = optional @timeout = 3000 @ensure_https = false @optional.each do |par, _| raise UnknownOptionalParameter.new(par) unless %w[timestamp duration cascadeCreate recommId additionalData autoPresented].include? par end end |
Instance Attribute Details
#additional_data ⇒ Object (readonly)
Returns the value of attribute additional_data.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def additional_data @additional_data end |
#auto_presented ⇒ Object (readonly)
Returns the value of attribute auto_presented.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def auto_presented @auto_presented end |
#cascade_create ⇒ Object (readonly)
Returns the value of attribute cascade_create.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def cascade_create @cascade_create end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def duration @duration end |
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
15 16 17 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 15 def ensure_https @ensure_https end |
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def item_id @item_id end |
#recomm_id ⇒ Object (readonly)
Returns the value of attribute recomm_id.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def recomm_id @recomm_id end |
#timeout ⇒ Object
Returns the value of attribute timeout.
15 16 17 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 15 def timeout @timeout end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def @timestamp end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
13 14 15 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 13 def user_id @user_id end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 55 def body_parameters p = {} p['userId'] = @user_id p['itemId'] = @item_id p['timestamp'] = @optional['timestamp'] if @optional.include? 'timestamp' p['duration'] = @optional['duration'] if @optional.include? 'duration' 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['autoPresented'] = @optional['autoPresented'] if @optional.include? 'autoPresented' p end |
#method ⇒ Object
HTTP method
50 51 52 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 50 def method :post end |
#path ⇒ Object
Relative path to the endpoint
76 77 78 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 76 def path '/{databaseId}/detailviews/' end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
71 72 73 |
# File 'lib/recombee_api_client/api/add_detail_view.rb', line 71 def query_parameters {} end |