class RecombeeApiClient::InsertToGroup

Inserts an existing item/group into group of given `groupId`.

Attributes

cascade_create[R]
ensure_https[RW]
group_id[R]
item_id[R]
item_type[R]
timeout[RW]

Public Class Methods

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

    • group_id -> ID of the group to be inserted into.

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

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

  • *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 `groupId` and the `groupId`. If `cascadeCreate` is set true, the behavior also depends on the `itemType`. Either items or group may be created if not present in the database.

# File lib/recombee_api_client/api/insert_to_group.rb, line 26
def initialize(group_id, item_type, item_id, optional = {})
  @group_id = group_id
  @item_type = item_type
  @item_id = item_id
  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_group.rb, line 46
def body_parameters
  p = Hash.new
  p['itemType'] = @item_type
  p['itemId'] = @item_id
  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_group.rb, line 41
def method
  :post
end
path() click to toggle source

Relative path to the endpoint

# File lib/recombee_api_client/api/insert_to_group.rb, line 62
def path
  "/{databaseId}/groups/#{@group_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_group.rb, line 56
def query_parameters
  params = {}
  params
end