Class: AwsSdb::Request::Base
- Inherits:
-
Object
- Object
- AwsSdb::Request::Base
- Defined in:
- lib/aws_sdb_bare/request.rb
Constant Summary collapse
- HOST =
'sdb.amazonaws.com'
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#params ⇒ Object
Returns the value of attribute params.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
-
#host ⇒ Object
Hostname for the request.
-
#initialize(method, params, opts = {}) ⇒ Base
constructor
A new instance of Base.
-
#path ⇒ Object
Uri path.
-
#uri(protocol = 'http') ⇒ Object
(also: #to_s)
The full uri for the request, it takes the protocol as argument.
-
#uri_query ⇒ Object
Only the query part of the uri.
Constructor Details
#initialize(method, params, opts = {}) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/aws_sdb_bare/request.rb', line 11 def initialize(method, params, opts={}) @account = opts[:account] || (ENV['AMAZON_ACCESS_KEY_ID'] || ENV['AWS_ACCESS_KEY_ID']) @secret = opts[:secret] || (ENV['AMAZON_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_ACCESS_KEY']) raise <<-end_msg unless @account && @secret Amazon AWS account or access key not defined Please pass {:account => 'your account', :secret => 'your secret'} as a last argument or define the following environment variables ENV['AMAZON_ACCESS_KEY_ID'] ENV['AMAZON_SECRET_ACCESS_KEY'] end_msg @method = method @params = params add_req_data_to_params end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
9 10 11 |
# File 'lib/aws_sdb_bare/request.rb', line 9 def account @account end |
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/aws_sdb_bare/request.rb', line 9 def params @params end |
#secret ⇒ Object
Returns the value of attribute secret.
9 10 11 |
# File 'lib/aws_sdb_bare/request.rb', line 9 def secret @secret end |
Instance Method Details
#host ⇒ Object
Hostname for the request
27 28 29 |
# File 'lib/aws_sdb_bare/request.rb', line 27 def host HOST end |
#path ⇒ Object
Uri path
32 33 34 |
# File 'lib/aws_sdb_bare/request.rb', line 32 def path '/' end |
#uri(protocol = 'http') ⇒ Object Also known as: to_s
The full uri for the request, it takes the protocol as argument
37 38 39 |
# File 'lib/aws_sdb_bare/request.rb', line 37 def uri(protocol = 'http') "#{protocol}://" + host + path + '?' + uri_query end |
#uri_query ⇒ Object
Only the query part of the uri
42 43 44 |
# File 'lib/aws_sdb_bare/request.rb', line 42 def uri_query params_query + '&Signature=' + signature end |