SmsUp (sms_up v1.0.0) View Source
SmsUp is used to send sms throught SmsUP (other api may be integrated easily) by implementing the same behaviour. This module provides delegates to the internal modules for sending sms and the distributed One Time Password store. For the One Time Password functionality if you are part of a cluster the librairy uses mnesia to distibute the store accross the nodes.
Link to this section Summary
Functions
Send a sms with the chosen Sender Module.
Configuration is available as :
config :sms_up, :deliver_module, MODULE
MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.
Send a sms with the chosen Sender Module.
Configuration is available as :
config :sms_up, :deliver_module, MODULE
MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.
Generate a pin code for the given id and store it in a mnesia database. Returns the generated pin code.
Validate a pin code along with the user id and tells if the provided pin is correct or not. Returns a tupple containing true or false regarding the result.
Link to this section Functions
Specs
send_sms(String.t(), String.t(), Keyword.t()) :: {:error, String.t()} | {:ok, %{body: String.t(), to: String.t()}}
send_sms(String.t(), String.t(), String.t()) :: {:error, String.t()} | {:ok, %{body: String.t(), to: String.t()}}
Send a sms with the chosen Sender Module.
Configuration is available as :
config :sms_up, :deliver_module, MODULE
MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.
Returns a ok tuple containing the message body and the number for which it was sent to or an error tuple with the reason.
Examples
iex> SmsUp.send_sms("+41765556677", "message")
{:ok, %{to: "+41765556677", body: "message"}}
Send a sms with the chosen Sender Module.
Configuration is available as :
config :sms_up, :deliver_module, MODULE
MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.
Returns a ok tuple containing the message body and the number for which it was sent to or an error tuple with the reason.
Examples
iex> SmsUp.send_sms("0765556677", "CH", "message")
{:ok, %{to: "+41765556677", body: "message"}}
Specs
Generate a pin code for the given id and store it in a mnesia database. Returns the generated pin code.
Examples
iex> SmsUp.store("user@email.ch")
"123456"
Specs
Validate a pin code along with the user id and tells if the provided pin is correct or not. Returns a tupple containing true or false regarding the result.
Examples
iex> SmsUp.validate("user@email.ch", "Good Pin")
{:ok, true}
iex> SmsUp.validate("user@email.ch", "Wrong Pin")
{:ok, false}