Class: SimpleAWS::SQS

Inherits:
API
  • Object
show all
Includes:
CallTypes::ActionParam, SimpleAWS::Signing::Version2
Defined in:
lib/simple_aws/sqs.rb

Overview

Amazon's Simple Queue Service

http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Welcome.html

All requests are POST and always through HTTPS. Use the third parameter to initialize if you need to talk to a region other than us-east-1.

For the requests that act on a queue directly, like SendMessage, pass in the QueueURL as the first parameter to the call:

sqs.send_message queue_url, params

In accordance with the AWS documentation, SimpleAWS does not try to reconstruct queue urls, use ListQueues or GetQueueUrl to get the correct queue url when needed.

Instance Attribute Summary

Attributes inherited from API

#access_key, #debug_to, #region, #secret_key, #version

Instance Method Summary collapse

Methods included from SimpleAWS::Signing::Version2

#finish_and_sign_request, #sign_request

Methods inherited from API

#debug!, default_region, endpoint, #initialize, #uri, use_https, version

Constructor Details

This class inherits a constructor from SimpleAWS::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Special handling here, we need to look for a QueueURL as the first parameter and update the request URI accordingly


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/simple_aws/sqs.rb', line 37

def method_missing(name, *args)
  if args.first.is_a?(String)
    request_uri = args.first
    params = args.last
  else
    request_uri = self.uri
    params = args.first
  end

  uri = URI.parse(request_uri)

  request = SimpleAWS::Request.new :post, "#{uri.scheme}://#{uri.host}", uri.path
  request.params["Action"] = SimpleAWS::Util.camelcase(name.to_s)

  if params.is_a?(Hash)
    insert_params_from request, params
  end

  send_request request
end