Class: SimpleAWS::API
- Inherits:
-
Object
- Object
- SimpleAWS::API
- Defined in:
- lib/simple_aws/api.rb
Overview
Base class for all AWS API wrappers.
See the list of AWS Endpoints for the values to use when implementing various APIs:
http://docs.amazonwebservices.com/general/latest/gr/index.html?rande.html
Direct Known Subclasses
AutoScaling, CloudFormation, CloudFront, CloudWatch, DynamoDB, EC2, ELB, ElastiCache, ElasticBeanstalk, IAM, ImportExport, MapReduce, MechanicalTurk, RDS, S3, SES, SNS, SQS, STS, SimpleDB
Instance Attribute Summary (collapse)
-
- (Object) access_key
readonly
Returns the value of attribute access_key.
-
- (Object) region
readonly
Returns the value of attribute region.
-
- (Object) secret_key
readonly
Returns the value of attribute secret_key.
-
- (Object) version
readonly
Returns the value of attribute version.
Class Method Summary (collapse)
-
+ (Object) default_region(region)
Specify a default region for all requests for this API.
-
+ (Object) endpoint(endpoint)
Define the AWS endpoint for the API being wrapped.
-
+ (Object) use_https(value)
Specify whether this API uses HTTPS for requests.
-
+ (Object) version(version)
Specify the AWS version of the API in question.
Instance Method Summary (collapse)
-
- (API) initialize(access_key, secret_key, region = nil)
constructor
Construct a new access object for the API in question.
-
- (String) uri
Get the full host name for the current API.
Constructor Details
- (API) initialize(access_key, secret_key, region = nil)
Construct a new access object for the API in question.
68 69 70 71 72 73 74 75 76 |
# File 'lib/simple_aws/api.rb', line 68 def initialize(access_key, secret_key, region = nil) @access_key = access_key @secret_key = secret_key @region = region || self.class.instance_variable_get("@default_region") @endpoint = self.class.instance_variable_get("@endpoint") @use_https = self.class.instance_variable_get("@use_https") @version = self.class.instance_variable_get("@version") end |
Instance Attribute Details
- (Object) access_key (readonly)
Returns the value of attribute access_key
59 60 61 |
# File 'lib/simple_aws/api.rb', line 59 def access_key @access_key end |
- (Object) region (readonly)
Returns the value of attribute region
59 60 61 |
# File 'lib/simple_aws/api.rb', line 59 def region @region end |
- (Object) secret_key (readonly)
Returns the value of attribute secret_key
59 60 61 |
# File 'lib/simple_aws/api.rb', line 59 def secret_key @secret_key end |
- (Object) version (readonly)
Returns the value of attribute version
59 60 61 |
# File 'lib/simple_aws/api.rb', line 59 def version @version end |
Class Method Details
+ (Object) default_region(region)
Specify a default region for all requests for this API.
33 34 35 |
# File 'lib/simple_aws/api.rb', line 33 def default_region(region) @default_region = region end |
+ (Object) endpoint(endpoint)
Define the AWS endpoint for the API being wrapped.
24 25 26 |
# File 'lib/simple_aws/api.rb', line 24 def endpoint(endpoint) @endpoint = endpoint end |
+ (Object) use_https(value)
Specify whether this API uses HTTPS for requests. If not set, the system will use HTTP. Some API endpoints are not available under HTTP and some are only HTTP.
44 45 46 |
# File 'lib/simple_aws/api.rb', line 44 def use_https(value) @use_https = value end |
+ (Object) version(version)
Specify the AWS version of the API in question.
53 54 55 |
# File 'lib/simple_aws/api.rb', line 53 def version(version) @version = version end |
Instance Method Details
- (String) uri
Get the full host name for the current API
83 84 85 86 87 88 89 90 91 |
# File 'lib/simple_aws/api.rb', line 83 def uri return @uri if @uri @uri = @use_https ? "https" : "http" @uri += "://#{@endpoint}" @uri += ".#{@region}" if @region @uri += ".amazonaws.com" @uri end |