class SmoothCodeAuth
Public Class Methods
new(request_hmac, client_secret)
click to toggle source
# File lib/smoothcode/auth.rb, line 4 def initialize(request_hmac, client_secret) @request_hmac = request_hmac @client_secret = client_secret end
Public Instance Methods
dashboard_request?(shop)
click to toggle source
# File lib/smoothcode/auth.rb, line 9 def dashboard_request?(shop) generate_hmac(@client_secret, shop) == @request_hmac end
webhook_request?(webhook_data)
click to toggle source
# File lib/smoothcode/auth.rb, line 13 def webhook_request?(webhook_data) webhook_data = webhook_data.transform_keys(&:to_sym) webhook_id = webhook_data[:id] generate_hmac(@client_secret, webhook_id.to_s) == @request_hmac end