class Bigcommerce::Customer
Public Class Methods
count(params = {})
click to toggle source
# File lib/bigcommerce/resources/customers/customer.rb, line 30 def self.count(params = {}) get 'customers/count', params end
Public Instance Methods
login_token(config: Bigcommerce.config)
click to toggle source
Generate a token that can be used to log the customer into the storefront. This requires your app to have the store_v2_customers_login scope and to be installed in the store.
# File lib/bigcommerce/resources/customers/customer.rb, line 37 def login_token(config: Bigcommerce.config) payload = { 'iss' => config.client_id, 'iat' => Time.now.to_i, 'jti' => SecureRandom.uuid, 'operation' => 'customer_login', 'store_hash' => config.store_hash, 'customer_id' => id } JWT.encode(payload, config.client_secret, 'HS256') end