Module: Spree::TokenResource

Defined in:
lib/spree/token_resource.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



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

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

Instance Method Details

#create_tokenObject



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

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