Siftsciex v0.3.1 Siftsciex.Score.Response.Reason View Source

Represents a reason for a Sift Score

Link to this section Summary

Functions

Creates a new t:Siftscience.Score.Response.Reason.t/0 struct from a response

Link to this section Types

Link to this type data() View Source
data() :: %{optional(str_key()) => String.t(), :details => String.t() | map()}
Link to this type str_key() View Source
str_key() :: :name | :value
Link to this type t() View Source
t() :: %Siftsciex.Score.Response.Reason{
  details: :empty | map() | String.t(),
  name: :empty | String.t(),
  value: :empty | String.t()
}

Link to this section Functions

Creates a new t:Siftscience.Score.Response.Reason.t/0 struct from a response

Parameters

  • data: A single or list of maps to be turned into structs

Examples

iex> Reason.new(%{name: "Bob", value: "Fraudster", details: %{"users" => "a, b, c"}})
%Reason{name: "Bob", value: "Fraudster", details: %{"users" => "a, b, c"}}

iex> Reason.new(%{name: "Bob", value: "Fraudster", details: "fake stuff"})
%Reason{name: "Bob", value: "Fraudster", details: "fake stuff"}

iex> Reason.new(%{name: "Bob", value: "Fraudster"})
%Reason{name: "Bob", value: "Fraudster", details: :empty}

iex> Reason.new([%{name: "Bob", value: "Fraudster"}, %{name: "Sue", value: "Criminal"}])
[%Reason{name: "Bob", value: "Fraudster"}, %Reason{name: "Sue", value: "Criminal"}]