Sha256: 011d75c6d526857a0350a9e24b0a1fa21acf2b68f0bd369043fdf38a85eae450
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require 'thor' require 'customer_miner/version' require 'customer_miner/query' require 'concurrent' require 'thread/pool' module CustomerMiner class CLI< Thor map '--version' => :version desc 'version', 'Prints the cm version' def version puts "#{File.basename($0)} #{VERSION}" end desc 'set_key', 'Set secret API key. You can get it from https://dashboard.clearbit.com/api' option :key, required: true, banner: "your_secret_api_key" 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 desc 'query', 'query customer data and generate csv file' option :file, required: true, banner: './your-clearbit.csv', desc: "CSV file export from Google Analytics" option :roles, required: false, banner: "marketing,operations", desc: "Roles you want to get. You can get available role in"\ " http://support.clearbit.com/article/120-employment-role-and-seniority" 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
customer_miner-0.0.5 | lib/customer_miner/cli.rb |
customer_miner-0.0.4 | lib/customer_miner/cli.rb |