Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Move proplists_merge into oauth_util.
  • Loading branch information
Tim Fletcher committed Nov 6, 2008
1 parent 9c4973a commit 0b45f73b06476b2ec015a5515fcbce2763c49b80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
@@ -26,21 +26,12 @@ oauth_params({Token, TokenSecret}, Consumer, ExtraParams) ->
{Params, TokenSecret}.

oauth_params(Consumer, ExtraParams) ->
proplists_merge([
oauth_util:proplists_merge([
{oauth_consumer_key, oauth_consumer:key(Consumer)},
{oauth_signature_method, oauth_consumer:signature_method(Consumer)},
{oauth_timestamp, oauth_util:unix_timestamp()},
{oauth_nonce, oauth_util:nonce()},
{oauth_version, "1.0"}
], ExtraParams).

proplists_merge({K,V}, Merged) ->
case proplists:is_defined(K, Merged) of
true ->
Merged;
false ->
[{K,V}|Merged]
end;
proplists_merge(A, B) ->
lists:foldl(fun proplists_merge/2, A, B).

@@ -36,4 +36,14 @@ percent_decode([C|Etc], Decoded) when ?is_unreserved(C) ->
esprintf(Fmt, Values) when is_tuple(Values) ->
esprintf(Fmt, tuple_to_list(Values));
esprintf(Fmt, Values) when is_list(Values) ->
fmt:sprintf(Fmt, [fmt:percent_encode(Value) || Value <- Values]).
fmt:sprintf(Fmt, [fmt:percent_encode(Value) || Value <- Values]).

proplists_merge({K,V}, Merged) ->
case proplists:is_defined(K, Merged) of
true ->
Merged;
false ->
[{K,V}|Merged]
end;
proplists_merge(A, B) ->
lists:foldl(fun proplists_merge/2, A, B).

0 comments on commit 0b45f73

Please sign in to comment.