Class: Amazon::WebServices::Util::AmazonAuthenticationRelay
- Inherits:
-
Object
- Object
- Amazon::WebServices::Util::AmazonAuthenticationRelay
show all
- Defined in:
- lib/amazon/webservices/util/amazon_authentication_relay.rb
Constant Summary
collapse
- REQUIRED_PARAMETERS =
[:Name,:Transport]
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AmazonAuthenticationRelay.
15
16
17
18
19
20
21
|
# File 'lib/amazon/webservices/util/amazon_authentication_relay.rb', line 15
def initialize( args )
missing_parameters = REQUIRED_PARAMETERS - args.keys
raise "Missing paramters: #{missing_parameters.join(',')}" unless missing_parameters.empty?
@name = args[:Name]
@transport = args[:Transport]
@keyId, @key = findAuthInfo( args )
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *request) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/amazon/webservices/util/amazon_authentication_relay.rb', line 34
def method_missing(method, *request)
time = Time.now.gmtime.strftime('%Y-%m-%dT%H:%M:%S.321Z')
request[0] ||= {}
args = { :AWSAccessKeyId => @keyId,
:Timestamp => time,
:Signature => RequestSigner.sign(@name,method,time,@key),
:Request => request }
@transport.send( method, args )
end
|
Instance Method Details
#inspect ⇒ Object
48
49
50
|
# File 'lib/amazon/webservices/util/amazon_authentication_relay.rb', line 48
def inspect
"#<Amazon::WebServices::Util::AmazonAuthenticationRelay:#{object_id} name:#{@name} transport:#{@transport.inspect}>"
end
|
#to_s ⇒ Object
44
45
46
|
# File 'lib/amazon/webservices/util/amazon_authentication_relay.rb', line 44
def to_s
"AmazonAuthenticationRelay[name:#{@name} transport:#{@transport}]>"
end
|
#withCredential(credential, method, *request) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/amazon/webservices/util/amazon_authentication_relay.rb', line 23
def withCredential(credential,method,*request)
time = Time.now.gmtime.strftime('%Y-%m-%dT%H:%M:%S.123Z')
request[0] ||= {}
args = { :AWSAccessKeyId => @keyId,
:Timestamp => time,
:Signature => RequestSigner.sign(@name,method,time,@key),
:Credential => credential,
:Request => request }
@transport.send( method, args )
end
|