Class: SmoothCodeAuth
- Inherits:
-
Object
- Object
- SmoothCodeAuth
- Defined in:
- lib/smoothcode/auth.rb
Instance Method Summary collapse
- #dashboard_request?(shop) ⇒ Boolean
-
#initialize(request_hmac, client_secret) ⇒ SmoothCodeAuth
constructor
A new instance of SmoothCodeAuth.
- #webhook_request?(webhook_data) ⇒ Boolean
Constructor Details
#initialize(request_hmac, client_secret) ⇒ SmoothCodeAuth
Returns a new instance of SmoothCodeAuth.
5 6 7 8 |
# File 'lib/smoothcode/auth.rb', line 5 def initialize(request_hmac, client_secret) @request_hmac = request_hmac @client_secret = client_secret end |
Instance Method Details
#dashboard_request?(shop) ⇒ Boolean
10 11 12 |
# File 'lib/smoothcode/auth.rb', line 10 def dashboard_request?(shop) generate_hmac(@client_secret, shop) == @request_hmac end |
#webhook_request?(webhook_data) ⇒ Boolean
14 15 16 |
# File 'lib/smoothcode/auth.rb', line 14 def webhook_request?(webhook_data) generate_hmac(@client_secret, webhook_data.to_json) == @request_hmac end |