SmsUp.Delivery.LoggerDelivery (sms_up v1.4.2)

View Source

Print the sms to the console and do not send it to any API. Usefull for dev environment and testing.

Summary

Functions

Deliver the SMS to the console. Provide a valid international number, the body of the message and a optional list of options (mostly used by real sms api). It is also possible to pass force_error to simulate a delivery failure

Functions

deliver(to, body, options \\ [])

@spec deliver(String.t(), String.t(), Keyword.t()) ::
  {:ok, %{body: String.t(), to: String.t(), options: Keyword.t()}}
  | {:error, String.t()}

Deliver the SMS to the console. Provide a valid international number, the body of the message and a optional list of options (mostly used by real sms api). It is also possible to pass force_error to simulate a delivery failure

Examples

iex> SmsUp.Delivery.LoggerDelivery.deliver("+41765556677", "Hello")
{:ok, %{to: "+41765556677", body: "Hello", options: []}}

iex> SmsUp.Delivery.LoggerDelivery.deliver("+41765556677", "Hello", option: 1)
{:ok, %{to: "+41765556677", body: "Hello", options: [option: 1]}}

iex> SmsUp.Delivery.LoggerDelivery.deliver("+41765556677", "Hello", force_error: "Ooops")
{:error, "Ooops"}