class CustomerMiner::CLI

Public Instance Methods

query() click to toggle source
# File lib/customer_miner/cli.rb, line 34
def query
  file = options[:file]

  if options[:roles]
    roles = options[:roles].split(',')
  else
    roles = ['marketing']
  end

  secret_key_file_path = "#{Dir.home}/.customer_miner"
  secret_key = File.read(secret_key_file_path)
  Query.new(file: file, roles: roles, secret_key: secret_key).perform
end
set_key() click to toggle source
# File lib/customer_miner/cli.rb, line 18
def set_key
  key = options[:key]
  file = "#{Dir.home}/.customer_miner"
  File.open(file, 'w') do |file|
    file.write(key)
  end
  File.chmod(0600, file)
  puts "Set secret API key successfully"
end
version() click to toggle source
# File lib/customer_miner/cli.rb, line 12
def version
  puts "#{File.basename($0)} #{VERSION}"
end