Skip to content

Commit

Permalink
Merge pull request #7 from talko/fixes/dialyzer
Browse files Browse the repository at this point in the history
Fix cond_delete/3 and dialyzer issues
  • Loading branch information
joelreymont committed May 4, 2012
2 parents a3f95aa + 4ac364a commit beab1f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ddb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ delete(Name, Keys, Returns)
-spec cond_delete(tablename(), key_json(), update_cond()) -> json_reply().

cond_delete(Name, Keys, Condition) ->
cond_update(Name, Keys, Condition, 'none').
cond_delete(Name, Keys, Condition, 'none').

-spec cond_delete(tablename(), key_json(), update_cond(), returns()) -> json_reply().

Expand Down
11 changes: 7 additions & 4 deletions src/ddb_iam.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
-export([credentials/2, token/1]).

-include_lib("ibrowse/include/ibrowse.hrl").
-include_lib("xmerl/include/xmerl.hrl").

-define(IAM_ENDPOINT, "https://sts.amazonaws.com/").
-define(IAM_AWS_VERSION, "2011-06-15").
Expand All @@ -46,14 +47,15 @@ credentials(AccessKeyId, SecretAccessKey) ->
'ok' = application:set_env('iam', 'accesskeyid', AccessKeyId),
'ok' = application:set_env('iam', 'secretaccesskey', SecretAccessKey).

-spec credentials() -> {string(), string()}.
-spec credentials() -> {'ok', string(), string()}.

credentials() ->
{'ok', AccessKeyId} = application:get_env('iam', 'accesskeyid'),
{'ok', SecretAccessKey} = application:get_env('iam', 'secretaccesskey'),
{'ok', AccessKeyId, SecretAccessKey}.

-spec token(pos_integer()) -> {'ok', string(), string(), string()} |
-spec token(pos_integer()) -> {'ok', string(), string(), string()} |
{'error', 'maximum_retries_reached'} |
{'error', string(), string()}.

token(Duration)
Expand All @@ -75,8 +77,9 @@ token(Duration)
{'error', Code, Message}
end.

-spec request(string(), string(), non_neg_integer()) -> {'ok', string()} |
{'error', string()}.
-spec request(string(), string(), non_neg_integer()) -> {'ok', #xmlElement{}} |
{'error', 'maximum_retries_reached'} |
{'error', #xmlElement{}}.

request(Action, Endpoint, Duration) ->
{'ok', AccessKeyId, SecretAccessKey} = credentials(),
Expand Down

0 comments on commit beab1f2

Please sign in to comment.