Class: Enstratus::RequestSigner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request = {:method => 'GET', :path => ''}) ⇒ RequestSigner

Returns a new instance of RequestSigner.



7
8
9
10
11
12
13
# File 'lib/enstratus/request_signer.rb', line 7

def initialize(request={:method => 'GET', :path => ''})
  @access_key ||= Enstratus.configuration.access_key
  @secret_key ||= Enstratus.configuration.secret_key
  @request ||= request
  @sig = sign
  @headers = {"User-agent" => Enstratus::UA, "x-esauth-access" => "#{@access_key}", "x-esauth-timestamp" => "#{@timestamp}", "x-esauth-signature" => @sig, "x-es-details" => "basic", "Accept" => "application/json"}
end

Instance Attribute Details

#access_keyObject

Returns the value of attribute access_key.



3
4
5
# File 'lib/enstratus/request_signer.rb', line 3

def access_key
  @access_key
end

#headersObject (readonly)

Returns the value of attribute headers.



4
5
6
# File 'lib/enstratus/request_signer.rb', line 4

def headers
  @headers
end

#requestObject

Returns the value of attribute request.



3
4
5
# File 'lib/enstratus/request_signer.rb', line 3

def request
  @request
end

#secret_keyObject

Returns the value of attribute secret_key.



3
4
5
# File 'lib/enstratus/request_signer.rb', line 3

def secret_key
  @secret_key
end

#sigObject (readonly)

Returns the value of attribute sig.



4
5
6
# File 'lib/enstratus/request_signer.rb', line 4

def sig
  @sig
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



4
5
6
# File 'lib/enstratus/request_signer.rb', line 4

def timestamp
  @timestamp
end