Class: AwsAgcod::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_agcod/signature.rb

Constant Summary collapse

SERVICE =
"AGCODService"
DEFAULT_REGION =
"us-east-1"

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ Signature

Returns a new instance of Signature.



14
15
16
17
18
# File 'lib/aws_agcod/signature.rb', line 14

def initialize(credentials)
  @access_key = credentials["access_key"]
  @secret_key = credentials["secret_key"]
  @region = credentials["region"] || DEFAULT_REGION
end

Instance Method Details

#sign(uri, headers, body = "") ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aws_agcod/signature.rb', line 20

def sign(uri, headers, body = "")
  @uri = uri
  @headers = headers
  @body = body
  @date = headers["x-amz-date"]

  signed_headers = headers.dup
  signed_headers["Authorization"] = authorization

  signed_headers
end