Permalink
Browse files

log terms for building test cases

  • Loading branch information...
1 parent 32f49b6 commit c90e11d63b1f274cec66fc1c228e1b1cd1657a52 @hypernumbers committed Apr 7, 2012
Showing with 30 additions and 18 deletions.
  1. +0 −18 examples/twilio_ext.erl
  2. +30 −0 src/twilio_ext.erl
View
@@ -1,18 +0,0 @@
-%%% @author Gordon Guthrie
-%%% @copyright (C) 2012, Hypernumbers Ltd
-%%% @doc Examples of using extended twiml
-%%%
-%%% @end
-%%% Created : 23 Mar 2012 by gordon@hypernumbers.com
-
--module(twilio_ext).
-
--export([
- handle/1
- ]).
-
-handle(Params) ->
- io:format("Params is ~p~n", [Params]),
- Say = #say{text="yowza"},
- twiml:encode(Say).
-
View
@@ -0,0 +1,30 @@
+%%% @author Gordon Guthrie
+%%% @copyright (C) 2012, Hypernumbers Ltd
+%%% @doc Examples of using extended twiml
+%%%
+%%% @end
+%%% Created : 23 Mar 2012 by gordon@hypernumbers.com
+
+-module(twilio_ext).
+
+-export([
+ handle/1
+ ]).
+
+-include("twilio.hrl").
+
+handle(Params) ->
+ log_terms(Params, "terms.log"),
+ Say = #say{text="yowza"},
+ twiml:encode([Say]).
+
+log_terms(Terms, File) ->
+ Str = lists:flatten(io_lib:format("~p.~n", [Terms])),
+ _Return = filelib:ensure_dir(File),
+ case file:open(File, [append]) of
+ {ok, Id} ->
+ io:fwrite(Id, "~s~n", [Str]),
+ file:close(Id);
+ _ ->
+ error
+ end.

0 comments on commit c90e11d

Please sign in to comment.