Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Rework oauth_token_pair.
  • Loading branch information
Tim Fletcher committed Nov 6, 2008
1 parent 198688d commit 7baf63bf3ae66ab8bbaf816bf7826e3ca5518880
Showing 1 changed file with 4 additions and 7 deletions.
@@ -2,17 +2,14 @@

-export([new/1, new/2]).

-import(proplists, [get_value/2]).


new(Token, TokenSecret) ->
{Token, TokenSecret}.

new(_HttpResponse={ok, {_,_,Data}}) ->
new_from_params(oauth_params:from_string(Data));
Params = oauth_params:from_string(Data),
{get_value("oauth_token", Params), get_value("oauth_token_secret", Params)};
new(HttpResponse) ->
HttpResponse.

new_from_params(List) ->
new(get("oauth_token", List), get("oauth_token_secret", List)).

get(Key, List) ->
proplists:get_value(Key, List).

0 comments on commit 7baf63b

Please sign in to comment.