Module: Artisan::Projects::ApiKeyGenerator

Defined in:
lib/artisan/projects/api_key_generator.rb

Defined Under Namespace

Modules: Hexer

Class Method Summary collapse

Class Method Details

.unique_api_keyObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/artisan/projects/api_key_generator.rb', line 14

def self.unique_api_key
  repository = Repository.project
  key = Hexer.hex(6)

  while !repository.find_by_api_key(key).nil?
    key = Hexer.hex(6)
  end

  key
end