Class: RecombeeApiClient::SetItemValues

Inherits:
SetValues show all
Defined in:
lib/recombee_api_client/api/set_item_values.rb

Overview

Set/update (some) property values of a given item. The properties (columns) must be previously created by [Add item property](docs.recombee.com/api#add-item-property).

Instance Attribute Summary collapse

Attributes inherited from SetValues

#cascade_create, #values

Instance Method Summary collapse

Methods inherited from SetValues

#body_parameters, #method, #query_parameters

Methods included from HashNormalizer

#camelize, #normalize_optional

Constructor Details

#initialize(item_id, values, optional = {}) ⇒ SetItemValues

  • *Required arguments*

    • item_id -> ID of the item which will be modified.

    • values -> The values for the individual properties.

Example of body: “‘

{
  "product_description": "4K TV with 3D feature",
  "categories":   ["Electronics", "Televisions"],
  "price_usd": 342,
  "in_stock_from": "2016-11-16T08:00Z",
  "!cascadeCreate": true
}

“‘

Special parameter ‘!cascadeCreate` may be used. It indicates that the item of the given itemId should be created if it does not exist in the database, as if the corresponding PUT method was used. Note the exclamation mark (!) at the beginning of the parameter’s name to distinguish it from item property names.

  • *Optional arguments (given as hash optional)*

    • cascadeCreate -> Sets whether the item should be created if not present in the database.



36
37
38
39
40
41
# File 'lib/recombee_api_client/api/set_item_values.rb', line 36

def initialize(item_id, values, optional = {})
  super(values, optional)
  @item_id = item_id
  @timeout = 1000
  @ensure_https = false
end

Instance Attribute Details

#ensure_httpsObject

Returns the value of attribute ensure_https.



11
12
13
# File 'lib/recombee_api_client/api/set_item_values.rb', line 11

def ensure_https
  @ensure_https
end

#item_idObject (readonly)

Returns the value of attribute item_id.



9
10
11
# File 'lib/recombee_api_client/api/set_item_values.rb', line 9

def item_id
  @item_id
end

#timeoutObject

Returns the value of attribute timeout.



10
11
12
# File 'lib/recombee_api_client/api/set_item_values.rb', line 10

def timeout
  @timeout
end

Instance Method Details

#pathObject

Relative path to the endpoint



44
45
46
# File 'lib/recombee_api_client/api/set_item_values.rb', line 44

def path
  "/{databaseId}/items/#{@item_id}"
end