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_optional
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
-> ‘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 if corresponding PUT requests were invoked). This concerns both the ‘seriesId` and the `itemId`. If `cascadeCreate` is set to true, the behavior also depends on the `itemType`. In case of `item`, an item is created, in case of `series` a series + corresponding item with the same ID is created.
-
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# 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 = 3000 @ensure_https = false @optional.each do |par, _| fail 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.
15 16 17 |
# File 'lib/recombee_api_client/api/insert_to_series.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/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
48 49 50 51 52 53 54 55 |
# 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 ⇒ Object
HTTP method
43 44 45 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 43 def method :post end |
#path ⇒ Object
Relative path to the endpoint
65 66 67 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 65 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 62 |
# File 'lib/recombee_api_client/api/insert_to_series.rb', line 59 def query_parameters params = {} params end |