Siftsciex v0.5.0 Siftsciex.Event.Payload.Item View Source
An item for a Sift Event
Link to this section Summary
Functions
Creates a Siftsciex.Event.Payload.Item.t/0 struct for a Sift Science Event payload
Link to this section Types
Link to this type
string_keys()
View Source
string_keys() :: :item_id | :product_title | :currency_code | :upc | :sku | :isbn | :brand | :manufacturer | :category | :color | :size
Link to this type
t()
View Source
t() :: %Siftsciex.Event.Payload.Item{
"$brand": Siftsciex.Event.Payload.payload_string(),
"$category": Siftsciex.Event.Payload.payload_string(),
"$color": Siftsciex.Event.Payload.payload_string(),
"$currency_code": Siftsciex.Event.Payload.payload_string(),
"$isbn": Siftsciex.Event.Payload.payload_string(),
"$item_id": Siftsciex.Event.Payload.payload_string(),
"$manufacturer": Siftsciex.Event.Payload.payload_string(),
"$price": integer(),
"$product_title": Siftsciex.Event.Payload.payload_string(),
"$quantity": integer(),
"$size": Siftsciex.Event.Payload.payload_string(),
"$sku": Siftsciex.Event.Payload.payload_string(),
"$tags": [String.t()],
"$upc": Siftsciex.Event.Payload.payload_string()
}
Link to this section Functions
Creates a Siftsciex.Event.Payload.Item.t/0 struct for a Sift Science Event payload.
When creating a new Item the price will be converted based on the :currency config. For example if your currency config is set to :base and you are using “USD” then a price of 500 (5 dollars) will be converted to 5000000, this is because Sift Science expects the micros value relative to the base unit for the currency. This conversion is handled automatically for you.
Parameters
data: The item details to be sent to Sift Science (Siftsciex.Event.Payload.Item.data/0)
Examples
iex> Item.new(%{item_id: "8", product_title: "Title", currency_code: "USD", price: 30, quantity: 1})
%Item{"$item_id": "8", "$product_title": "Title", "$currency_code": "USD", "$price": 30000000, "$quantity": 1}
iex> Item.new(%{item_id: "8", tags: ["table", "dining"]})
%Item{"$item_id": "8", "$tags": ["table", "dining"]}
iex> Item.new([%{item_id: "8", quantity: 1}, %{item_id: "1", quantity: 30}])
[%Item{"$item_id": "8", "$quantity": 1}, %Item{"$item_id": "1", "$quantity": 30}]