Skip to content

Commit

Permalink
KAZOO-KNM: follow nomenclature for providers behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp committed Mar 3, 2016
1 parent 0898d7f commit bbdeec7
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 19 deletions.
2 changes: 0 additions & 2 deletions core/kazoo_number_manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ROOT = ../..
PROJECT = kazoo_number_manager

SOURCES = src/providers/knm_providers.erl src/*.erl src/*/*.erl

all: compile

include $(ROOT)/make/kz.mk
6 changes: 4 additions & 2 deletions core/kazoo_number_manager/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Version: 4.0
The Kazoo number manager aims for the following:

1. Provide a consistent interface to number management
2. Abstract concepts of carriers, providers, convertors, etc, to allow a more easily pluggable system
3. Simplify how numbers move from various states and between accounts
1. Abstract concepts of carriers, providers, convertors, etc, to allow a more easily pluggable system
1. Simplify how numbers move from various states and between accounts

## Interface

Expand Down Expand Up @@ -41,6 +41,8 @@ The `knm_gen_carrier` module provides an Erlang behaviour which all carrier modu

The `knm_providers` module provides the interface to the enabled provider modules. Just as the `knm_carriers` module abstracts the carrier, `knm_proviers` abstracts the provider modules, allowing providers to be added/removed without needing knowledge of which provider modules are in play.

The `knm_gen_provider` module provides an Erlang behaviour which all provider modules must implement.

### Convertors

The `knm_converters` module abstracts how numbers are normalized, classified, and reconciled. The primary implementation is the regex-based system, but there are plans to integrate [libphonenumber](https://github.com/googlei18n/libphonenumber) as another backend.
Expand Down
22 changes: 22 additions & 0 deletions core/kazoo_number_manager/src/knm_gen_provider.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
%%%-------------------------------------------------------------------
%%% @copyright (C) 2011-2016, 2600Hz INC
%%% @doc
%%%
%%% When implementing provider modules, these callbacks are a must!
%%%
%%% @end
%%% @contributors
%%% Pierre Fenoll
%%%-------------------------------------------------------------------
-module(knm_gen_provider).

-include("knm.hrl").

-callback save(knm_number:knm_number()) ->
knm_number:knm_number().

-callback delete(knm_number:knm_number()) ->
knm_number:knm_number().

-callback has_emergency_services(knm_number:knm_number()) ->
boolean().
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_cnam_notifier).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/src/providers/knm_dash_e911.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_dash_e911).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/src/providers/knm_failover.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_failover).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_port_notifier).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/src/providers/knm_prepend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_prepend).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down
8 changes: 0 additions & 8 deletions core/kazoo_number_manager/src/providers/knm_providers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
-export([delete/1]).
-export([has_emergency_services/1]).

%% To be implemented by knm provider modules:

-callback save(knm_number:knm_number()) -> knm_number:knm_number().

-callback delete(knm_number:knm_number()) -> knm_number:knm_number().

-callback has_emergency_services(knm_number:knm_number()) -> boolean().

%%--------------------------------------------------------------------
%% @public
%% @doc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_vitelity_cnam).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
%%% Peter Defebvre
%%%-------------------------------------------------------------------
-module(knm_vitelity_e911).
-behaviour(knm_providers).
-behaviour(knm_gen_provider).

-export([save/1]).
-export([delete/1]).
Expand Down

0 comments on commit bbdeec7

Please sign in to comment.