Siftsciex v0.3.1 Siftsciex.Score.Response.Score View Source
Represents the scores
items in a Score response (Siftsciex.Score.Response.t/0
) from Sift
Link to this section Summary
Functions
Converts a map to a new Siftsciex.Score.Response.Score.t/0
record
Link to this section Types
Link to this type
data()
View Source
data() :: %{ required(Siftsciex.Score.abuse_type()) => %{score: float(), reasons: [map()]} }
Link to this type
t()
View Source
t() :: %Siftsciex.Score.Response.Score{ reasons: :empty | [Siftsciex.Score.Response.Reason.t()], score: :empty | float(), type: :empty | Siftsciex.Score.abuse_type() }
Link to this section Functions
Link to this function
new(data)
View Source
new(data() | [data()]) :: [Siftsciex.Score.Response.Score.t()]
Converts a map to a new Siftsciex.Score.Response.Score.t/0
record.
Parameters
data
: A map or list of maps that should be converted toSiftsciex.Score.Response.Score.t/0
records
Examples
iex> Score.new(%{payment_abuse: %{score: 0.5, reasons: [%{name: "Bad", value: "thing", details: %{"user_id" => "bob"}}]}})
[%Score{type: :payment_abuse, score: 0.5, reasons: [%Siftsciex.Score.Response.Reason{name: "Bad", value: "thing", details: %{"user_id" => "bob"}}]}]
iex> Score.new(%{payment_abuse: %{score: 0.5, reasons: [%{name: "Bad", value: "thing"}]}, promotion_abuse: %{score: 0.3}})
[%Score{type: :payment_abuse, score: 0.5, reasons: [%Siftsciex.Score.Response.Reason{name: "Bad", value: "thing"}]}, %Score{type: :promotion_abuse, score: 0.3}]