Class: Versapay::WebhookSignature

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/versapay/webhooks.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, url, key, attributes) ⇒ WebhookSignature

Returns a new instance of WebhookSignature.

Parameters:

  • method (Symbol, String)

    The HTTP method of the request (:get, :post)

  • url (String)

    The URL that the request is going to

  • key (String)

    The private key to be used for signing

  • attributes (Hash)

    The hash of attributes that will be sent in the request



44
45
46
47
48
49
50
# File 'lib/versapay/webhooks.rb', line 44

def initialize(method, url, key, attributes)
  @method     = method
  @url        = url
  @key        = key
  @attributes = attributes
  @signature  = generate_signature
end

Instance Attribute Details

#signatureObject (readonly) Also known as: to_s

Returns the value of attribute signature.



33
34
35
# File 'lib/versapay/webhooks.rb', line 33

def signature
  @signature
end

Class Method Details

.hmac(*args) ⇒ Object



36
37
38
# File 'lib/versapay/webhooks.rb', line 36

def self.hmac(*args)
  new(*args).to_s
end