Class: ClientAuth::Signer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, path, params = {}) ⇒ Signer

Returns a new instance of Signer.



5
6
7
8
9
# File 'lib/client_auth/signer.rb', line 5

def initialize(method, path, params = {})
  @method = method.upcase
  @path = path
  @payload = params
end

Instance Attribute Details

#client_nameObject (readonly)

Returns the value of attribute client_name.



3
4
5
# File 'lib/client_auth/signer.rb', line 3

def client_name
  @client_name
end

#payloadObject

Returns the value of attribute payload.



3
4
5
# File 'lib/client_auth/signer.rb', line 3

def payload
  @payload
end

Instance Method Details

#configure(client_key, client_name) ⇒ Object



25
26
27
28
# File 'lib/client_auth/signer.rb', line 25

def configure(client_key, client_name)
  @client_key = client_key
  @client_name = client_name
end

#headersObject

Raises:

  • (NotImplementedError)


15
16
17
18
19
20
21
22
23
# File 'lib/client_auth/signer.rb', line 15

def headers
  raise NotImplementedError, 'Client name not configured' unless client_name

  {
    'X-Client' => client_name,
    'X-Timestamp' => timestamp,
    'X-Signature' => signature
  }
end