Class: RightScale::CloudApi::AWS::SQS::ApiManager
- Inherits:
-
CloudApi::ApiManager
- Object
- CloudApi::ApiManager
- RightScale::CloudApi::AWS::SQS::ApiManager
- Defined in:
- lib/cloud/aws/sqs/manager.rb
Overview
Amazon Simple Queue Service (SQS) compatible manager (thread unsafe).
Defined Under Namespace
Classes: Error
Constant Summary collapse
- DEFAULT_API_VERSION =
Default API version for SQS service. To override the API version use :api_version key when instantiating a manager.
'2011-10-01'
Instance Method Summary collapse
-
#api(action, *args) ⇒ Object
Makes an API call to AWS::Ec2 compatible cloud.
-
#initialize(aws_access_key_id, aws_secret_access_key, aws_account_number, endpoint, options = {}) ⇒ ApiManager
constructor
Constructor.
-
#method_missing(method_name, *args, &block) ⇒ Object
Adds an ability to call SQS API methods by their names.
-
#parametrize(*args) ⇒ Hash
(also: #p9e)
Parametrize data to the format that Amazon EC2 and compatible services accept.
Constructor Details
#initialize(aws_access_key_id, aws_secret_access_key, aws_account_number, endpoint, options = {}) ⇒ ApiManager
Constructor
238 239 240 241 242 243 |
# File 'lib/cloud/aws/sqs/manager.rb', line 238 def initialize(aws_access_key_id, aws_secret_access_key, aws_account_number, endpoint, ={}) credentials = { :aws_account_number => aws_account_number, :aws_access_key_id => aws_access_key_id, :aws_secret_access_key => aws_secret_access_key } super(credentials, endpoint, ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
Adds an ability to call SQS API methods by their names
323 324 325 326 327 328 329 |
# File 'lib/cloud/aws/sqs/manager.rb', line 323 def method_missing(method_name, *args, &block) if method_name.to_s[/\A[A-Z]/] api(method_name, *args, &block) else super end end |
Instance Method Details
#api(action, *args) ⇒ Object
Makes an API call to AWS::Ec2 compatible cloud
262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/cloud/aws/sqs/manager.rb', line 262 def api(action, *args) queue_name = args.shift if args.first.is_a?(String) opts = args.shift || {} # Uri Parameters opts['Action'] ||= action.to_s._snake_case._camelize = {} [:body] = opts.delete(:body) [:headers] = opts.delete(:headers) || {} [:options] = opts.delete(:options) || {} [:params] = parametrize(opts) # Options and Per Queue URI path = queue_name._blank? ? '' : "#{@credentials[:aws_account_number]}/#{queue_name}" process_api_request(:get, path, ) end |
#parametrize(*args) ⇒ Hash Also known as: p9e
Parametrize data to the format that Amazon EC2 and compatible services accept
See Utils::AWS.parametrize for more examples.
304 305 306 |
# File 'lib/cloud/aws/sqs/manager.rb', line 304 def parametrize(*args) # :nodoc: Utils::AWS.parametrize(*args) end |