Module: SimpleAWS::CallTypes::ActionParam

Included in:
AutoScaling, SimpleAWS::CloudFormation, SimpleAWS::CloudWatch, EC2, ELB, ElastiCache, ElasticBeanstalk, IAM, ImportExport, MapReduce, MechanicalTurk, RDS, SES, SNS, SQS, STS, SimpleDB
Defined in:
lib/simple_aws/call_types/action_param.rb

Overview

Implement call handling to work with the ?Action param, signing the message according to whatever Signing module is included along side this module.

This module hooks up the method_missing functionality as described in the README. To call methods on APIs including this module, simply call a method with either the Ruby-fied name, or the full CamelCase name, and pass in options required as the parameters.

All responses will be wrapped up in an SimpleAWS::Response object.

Examples:

ec2 = SimpleAWS::EC2.new access_key, secret_key

# These two are equivalent
ec2.list_instances
ec2.ListInstances

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

For any undefined methods, try to convert them into valid AWS actions and return the results


31
32
33
34
35
36
37
38
39
40
# File 'lib/simple_aws/call_types/action_param.rb', line 31

def method_missing(name, *args)
  request = SimpleAWS::Request.new :post, self.uri, "/"
  request.params["Action"] = SimpleAWS::Util.camelcase(name.to_s)

  if args.any? && args.first.is_a?(Hash)
    insert_params_from request, args.first
  end

  send_request request
end