Sha256: 70fd5fc6467466089044c8b8c80579cf9f43b564c4b9ef56ee4a808be7c9db83
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
namespace :apikey do desc <<-DESC Reset your API key and generate a new one. The new key will be sent to you by e-mail. DESC task :reset do APIKey.put puts_title "API key reset" puts_long <<-MSG Your API key has been reset. You will receive an e-mail with your new API key shortly. After that, you will need to reconfigure this utility to use the new key, by running #{qcommand "apikey:switch"}. MSG end desc <<-DESC Change the current API key. You should use this task after #{qcommand "apikey:reset"} to use a newly generated API key. DESC task :switch do puts_title "API key" puts_long <<-MSG In order to use this utility, you must provide your API key that must have been sent to you in an e-mail after creating your account. Please paste it at the prompt below and press <enter>. MSG prompt_and_store_key end def prompt_and_store_key loop do puts print "API key: " entered = $stdin.gets.strip begin APIKey.site = APIAccess.site_with_api_key(entered) begin APIKey.get ensure APIKey.site = nil end rescue WebService::UnauthorizedAccess puts puts_long <<-MSG The key you entered apears to be invalid. Please double check it and retry, or let us help you: #{SUPPORT_EMAIL_ADDR}. MSG else Parameters.store(:api_key, entered) puts puts "* Key valid and saved." break end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Flucti-flucti-cli-0.1.16 | lib/flucti/tasks/apikey_tasks.rb |