Class: RecombeeApiClient::InsertToSeries
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::InsertToSeries
- Defined in:
- lib/recombee_api_client/api/insert_to_series.rb
Overview
Inserts an existing item/series into a series of the given seriesId at a position determined by time.
Instance Attribute Summary collapse
-
#cascade_create ⇒ Object
readonly
Returns the value of attribute cascade_create.
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
-
#item_type ⇒ Object
readonly
Returns the value of attribute item_type.
-
#series_id ⇒ Object
readonly
Returns the value of attribute series_id.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#body_parameters ⇒ Object
Values of body parameters as a Hash.
-
#initialize(series_id, item_type, item_id, time, optional = {}) ⇒ InsertToSeries
constructor
-
*Required arguments* -
series_id-> ID of the series to be inserted into.
-
-
#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(series_id, item_type, item_id, time, optional = {}) ⇒ InsertToSeries
-
*Required arguments*
-
series_id-> ID of the series to be inserted into. -
item_type->itemiff the regular item from the catalog is to be inserted,seriesiff series is inserted as the item. -
item_id-> ID of the item iffitemTypeisitem. ID of the series iffitemTypeisseries. -
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 if corresponding PUT requests were invoked). This concerns both theseriesIdand theitemId. IfcascadeCreateis set to true, the behavior also depends on theitemType. In case ofitem, an item is created, in case ofseriesa series + corresponding item with the same ID is created.
-
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 26 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_hash_to_camel_case(optional) @cascade_create = optional['cascadeCreate'] @optional = optional @timeout = 3000 @ensure_https = false @optional.each do |par, _| raise UnknownOptionalParameter.new(par) unless ['cascadeCreate'].include? par end end |
Instance Attribute Details
#cascade_create ⇒ Object (readonly)
Returns the value of attribute cascade_create.
13 14 15 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 13 def cascade_create @cascade_create end |
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
14 15 16 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 14 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/insert_to_series.rb', line 13 def item_id @item_id end |
#item_type ⇒ Object (readonly)
Returns the value of attribute item_type.
13 14 15 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 13 def item_type @item_type end |
#series_id ⇒ Object (readonly)
Returns the value of attribute series_id.
13 14 15 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 13 def series_id @series_id end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
13 14 15 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 13 def time @time end |
#timeout ⇒ Object
Returns the value of attribute timeout.
14 15 16 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 14 def timeout @timeout end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
47 48 49 50 51 52 53 54 55 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 47 def body_parameters p = {} p['itemType'] = @item_type p['itemId'] = @item_id p['time'] = @time p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' p end |
#method ⇒ Object
HTTP method
42 43 44 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 42 def method :post end |
#path ⇒ Object
Relative path to the endpoint
64 65 66 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 64 def path "/{databaseId}/series/#{@series_id}/items/" end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
59 60 61 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 59 def query_parameters {} end |