class RecombeeApiClient::InsertToSeries

Inserts an existing item/series into series of given seriesId at position determined by time.

Attributes

cascade_create[R]
ensure_https[RW]
item_id[R]
item_type[R]
series_id[R]
time[R]
timeout[RW]

Public Class Methods

new(series_id, item_type, item_id, time, optional = {}) click to toggle source
  • *Required arguments*

    • series_id -> ID of the series to be inserted into.

    • item_type -> `item` iff the regular item from the catalog is to be inserted, `series` iff series is inserted as the item.

    • item_id -> ID of the item iff `itemType` is `item`. ID of the series iff `itemType` is `series`.

    • 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.

  • *Optional arguments (given as hash optional)*

    • 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.

# File lib/recombee_api_client/api/insert_to_series.rb, line 27
def initialize(series_id, item_type, item_id, time, optional = {})
  @series_id = series_id
  @item_type = item_type
  @item_id = item_id
  @time = time
  optional = normalize_optional(optional)
  @cascade_create = optional['cascadeCreate']
  @optional = optional
  @timeout = 1000
  @ensure_https = false
  @optional.each do |par, _|
    fail UnknownOptionalParameter.new(par) unless ["cascadeCreate"].include? par
  end
end

Public Instance Methods

body_parameters() click to toggle source

Values of body parameters as a Hash

# File lib/recombee_api_client/api/insert_to_series.rb, line 48
def body_parameters
  p = Hash.new
  p['itemType'] = @item_type
  p['itemId'] = @item_id
  p['time'] = @time
  p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
  p
end
method() click to toggle source

HTTP method

# File lib/recombee_api_client/api/insert_to_series.rb, line 43
def method
  :post
end
path() click to toggle source

Relative path to the endpoint

# File lib/recombee_api_client/api/insert_to_series.rb, line 65
def path
  "/{databaseId}/series/#{@series_id}/items/"
end
query_parameters() click to toggle source

Values of query parameters as a Hash. name of parameter => value of the parameter

# File lib/recombee_api_client/api/insert_to_series.rb, line 59
def query_parameters
  params = {}
  params
end