Class: AwsSdb::Request::Template
- Inherits:
-
Object
- Object
- AwsSdb::Request::Template
- Defined in:
- lib/aws_sdb_bare/request.rb
Overview
Is the parent of all the request templates, defines some methods
Direct Known Subclasses
BatchPutAttributes, CreateDomain, DeleteAttributes, DeleteDomain, DomainMetadata, GetAttributes, ListDomains, PutAttributes, Query, QueryWithAttributes, Select
Class Method Summary collapse
-
.shortcuts(shortcuts_hash) ⇒ Object
Generates method to allow shorter expressions in parameter definition takes an hash.
Instance Method Summary collapse
- #attributes=(attributes) ⇒ Object
-
#initialize(params = {}, opts = {}) ⇒ Template
constructor
takes the params for the request and an optional options hash params for the request are request specific, options accepted are only AWS credentials in form of.
- #request ⇒ Object
- #token=(value) ⇒ Object
Constructor Details
#initialize(params = {}, opts = {}) ⇒ Template
takes the params for the request and an optional options hash params for the request are request specific, options accepted are only AWS credentials in form of
{:account => 'your account', :secret => 'your secret'}
108 109 110 |
# File 'lib/aws_sdb_bare/request.rb', line 108 def initialize(params={}, opts={}) @params, @opts = params, opts end |
Class Method Details
.shortcuts(shortcuts_hash) ⇒ Object
Generates method to allow shorter expressions in parameter definition takes an hash
shortcuts({'LongUrlQueryParams' => :abbr})
will cause :abbr params to be expanded in LongUrlQueryParams
93 94 95 96 97 98 99 |
# File 'lib/aws_sdb_bare/request.rb', line 93 def shortcuts(shortcuts_hash) shortcuts_hash.each do |full_key, shortcut| define_method("#{shortcut}=") do |value| @params[full_key] = value end end end |
Instance Method Details
#attributes=(attributes) ⇒ Object
116 117 118 119 120 |
# File 'lib/aws_sdb_bare/request.rb', line 116 def attributes=(attributes) attributes.each_with_index do |attribute, index| @params["AttributeName.#{index}"] = attribute.to_s end end |
#request ⇒ Object
122 123 124 125 126 127 |
# File 'lib/aws_sdb_bare/request.rb', line 122 def request @request ||= begin Base.new('GET', @params.merge('Action' => self.class.to_s.split(':')[-1]), @opts) end end |
#token=(value) ⇒ Object
112 113 114 |
# File 'lib/aws_sdb_bare/request.rb', line 112 def token=(value) @params['NextToken'] = value end |