Sha256: 0b981c110110e2fdb62da0d842012c38f0c5fbad3a0b266a72fb51120b1e3471
Contents?: true
Size: 1.07 KB
Versions: 42
Compression:
Stored size: 1.07 KB
Contents
require_relative "../scripts" require_relative "../pivotal" module Octopolo module Scripts class PivotalAuth include UserConfigWrapper include CLIWrapper attr_accessor :email attr_accessor :password attr_accessor :token def execute ask_credentials request_token store_token rescue Pivotal::BadCredentials => e cli.say e.message end # Private: Ask the user for their credentials def ask_credentials self.email = cli.prompt "Your Pivotal Tracker email: " self.password = cli.prompt_secret "Your Pivotal Tracker password (never stored): " end private :ask_credentials # Private: Fetch the user's token from the Pivotal API def request_token self.token = Pivotal::Client.fetch_token(email, password) end private :request_token # Private: Store the returned token from the Pivotal API def store_token user_config.set :pivotal_token, token end private :store_token end end end # vim: set ft=ruby: #
Version data entries
42 entries across 42 versions & 1 rubygems