nexmo v0.4.0 Nexmo.Config View Source

The Nexmo.Config module provides configuration settings and helper functions to the application.

Link to this section Summary

Functions

Prints the Nexmo API key stored as an environment variable.

Prints the Nexmo API secret stored as an environment variable.

Nexmo.Config.convert_to_map/1 takes the user inputted parameters and converts them into a map.

Nexmo.Config.merge_credentials/1 takes the user inputted parameters and merges the user's Nexmo API credentials into the map.

Called when an application is started.

Link to this section Functions

Prints the Nexmo API key stored as an environment variable.

Examples

iex> Nexmo.Config.api_key
"123456789"
Link to this function

api_secret()

View Source (since 0.1.0)

Prints the Nexmo API secret stored as an environment variable.

Examples

iex> Nexmo.Config.api_secret "this_is_a_sample_secret"

Link to this function

convert_to_map(params)

View Source (since 0.3.0)

Nexmo.Config.convert_to_map/1 takes the user inputted parameters and converts them into a map.

Examples

iex> Nexmo.Config.convert_to_map({a, '123'})
%{a: '123'}
Link to this function

merge_credentials(params)

View Source (since 0.3.0)

Nexmo.Config.merge_credentials/1 takes the user inputted parameters and merges the user's Nexmo API credentials into the map.

Examples

iex> Nexmo.Config.merge_credentials(%{a: '123', b: '456'})
%{a: '123', b: '456', api_key: '123456789', api_secret: 'this_is_a_sample_secret'}

Called when an application is started.

This function is called when an application is started using Application.start/2 (and functions on top of that, such as Application.ensure_started/2). This function should start the top-level process of the application (which should be the top supervisor of the application's supervision tree if the application follows the OTP design principles around supervision).

start_type defines how the application is started:

  • :normal - used if the startup is a normal startup or if the application is distributed and is started on the current node because of a failover from another node and the application specification key :start_phases is :undefined.
  • {:takeover, node} - used if the application is distributed and is started on the current node because of a failover on the node node.
  • {:failover, node} - used if the application is distributed and is started on the current node because of a failover on node node, and the application specification key :start_phases is not :undefined.

start_args are the arguments passed to the application in the :mod specification key (e.g., mod: {MyApp, [:my_args]}).

This function should either return {:ok, pid} or {:ok, pid, state} if startup is successful. pid should be the PID of the top supervisor. state can be an arbitrary term, and if omitted will default to []; if the application is later stopped, state is passed to the stop/1 callback (see the documentation for the c:stop/1 callback for more information).

use Application provides no default implementation for the start/2 callback.

Callback implementation for Application.start/2.