Class: Jeff::Signer

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

Overview

Signs an AWS request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, host, path, query_string) ⇒ Signer

Returns a new instance of Signer.



46
47
48
49
50
51
# File 'lib/jeff.rb', line 46

def initialize(method, host, path, query_string)
  @method = method.upcase
  @host = host
  @path = path
  @query_string = query_string
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



44
45
46
# File 'lib/jeff.rb', line 44

def host
  @host
end

#methodObject (readonly)

Returns the value of attribute method.



44
45
46
# File 'lib/jeff.rb', line 44

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



44
45
46
# File 'lib/jeff.rb', line 44

def path
  @path
end

#query_stringObject (readonly)

Returns the value of attribute query_string.



44
45
46
# File 'lib/jeff.rb', line 44

def query_string
  @query_string
end

Instance Method Details

#sign_with(aws_secret_access_key) ⇒ Object



53
54
55
# File 'lib/jeff.rb', line 53

def sign_with(aws_secret_access_key)
  Signature.new(aws_secret_access_key).sign(string_to_sign)
end

#string_to_signObject



57
58
59
# File 'lib/jeff.rb', line 57

def string_to_sign
  [method, host, path, query_string].join("\n")
end