Module: Spree::Core::TokenResource

Defined in:
lib/spree/core/token_resource.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



19
20
21
# File 'lib/spree/core/token_resource.rb', line 19

def self.included(receiver)
  receiver.extend ClassMethods
end

Instance Method Details

#create_tokenObject



12
13
14
15
16
17
# File 'lib/spree/core/token_resource.rb', line 12

def create_token
  permission = build_tokenized_permission
  permission.token = token = ::SecureRandom::hex(8)
  permission.save!
  token
end