Initial signature test

This commit is contained in:
Carlos Martín Nieto
2013-06-11 16:34:02 +02:00
parent f8f791296a
commit 9d222df593
8 changed files with 127 additions and 0 deletions

24
src/geef_sig.erl Normal file
View File

@@ -0,0 +1,24 @@
-module(geef_sig).
-include("geef_records.hrl").
-export([new/2, new/3]).
-spec new(iolist(), iolist()) -> geef_signature() | {error, term()}.
new(Name0, Email0) ->
case geef_nif:signature_new(Name0, Email0) of
{ok, Name, Email, Time0, Offset} ->
Time = {{Time0 div 1000000, Time0 rem 1000000, 0}, Offset},
{ok, #geef_signature{name=Name, email=Email, time=Time}};
Err ->
Err
end.
-spec new(iolist(), iolist(), geef_time()) -> geef_signature() | {error, term()}.
new(Name0, Email0, Time) ->
case geef_nif:signature_new(Name0, Email0, 0) of
{ok, Name, Email} ->
{ok, #geef_signature{name=Name, email=Email, time=Time}};
Err ->
Err
end.