Skip to content

Commit

Permalink
refactor SQS
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkokiefer committed Jul 16, 2012
1 parent 89a7716 commit 93eb2ea
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions lib/sqs.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
exports.init = function(genericAWSClient) {
// Creates a Simple Queue Service API client
var createSQSClient = function (accessKeyId, secretAccessKey, options) {
return function (accessKeyId, secretAccessKey, options) {
options = options || {};
var client = SQSClient({
var aws = genericAWSClient({
host: options.host || "sqs.us-east-1.amazonaws.com",
path: options.path || "/",
agent: options.agent,
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
secure: options.secure,
version: options.version
});
return client;
}
// Amazon Simple Queue Service API client
var SQSClient = function(obj) {
var aws = genericAWSClient({
host: obj.host, path: obj.path, accessKeyId: obj.accessKeyId,
secretAccessKey: obj.secretAccessKey, secure: obj.secure, agent:obj.agent
agent: options.agent
})
obj.call = function(action, query, callback) {
var callFn = function(action, query, callback) {
query["Action"] = action
query["Version"] = obj.version || '2009-02-01'
query["Version"] = options.version || '2009-02-01'
query["SignatureMethod"] = "HmacSHA256"
query["SignatureVersion"] = "2"
return aws.call(action, query, callback);
}
return obj;
return {call: callFn};
}
return createSQSClient;
}

0 comments on commit 93eb2ea

Please sign in to comment.