Siftsciex v0.3.1 Siftsciex.Event.Response View Source

Module for handling a Sift Science Event response

Link to this section Summary

Functions

Returns the error type (t:Siftsciex.Event.Response.Error.value/0) of the response if the response indicates an error

Determines whether the given Response struct reflects an error

Processes the respose from Sift Science

Link to this section Types

Link to this type t() View Source
t() :: %Siftsciex.Event.Response{
  message: Siftsciex.Event.Payload.payload_string(),
  request: Siftsciex.Event.Payload.payload_string(),
  score_response: :empty | Siftsciex.Score.Response.t(),
  status: Siftsciex.Event.Payload.payload_int(),
  time: :empty | DateTime.t()
}

Link to this section Functions

Link to this function error(response) View Source
error(Siftsciex.Event.Response.t()) :: Siftsciex.Event.Response.Error.value()

Returns the error type (t:Siftsciex.Event.Response.Error.value/0) of the response if the response indicates an error.

Parameters

  • response: The respnonse object to check the error for.

Examples

iex> Response.error(%Response{status: 51})
:invalid_api_key

Determines whether the given Response struct reflects an error.

Parameters

Examples

iex> Response.error?(%Response{status: 51})
true

iex> Response.error?(%Response{status: 0})
false

Processes the respose from Sift Science

Parameters

  • body: The response body from the Event Request

Examples

iex> Response.process(%{"status" => 0, "error_message" => "OK", "time" => time, "request" => ""})
%Response{status: 0, message: "OK", time: date_time, request: "", score_response: :empty}