class IdonethisCli::Cli

Public Instance Methods

authorize() click to toggle source
# File lib/idonethis_cli/cli.rb, line 18
def authorize
  url = auth_client.url
  code = cli.ask ("Enter code from this URL:\n #{url}").chomp.strip

  oauth2_token = auth_client.oauth2_token(code)

  if oauth2_token
    settings.save_oauth2_token(oauth2_token.to_hash)
    cli.say "Login successful"
  else
    cli.say "Login failed #{oauth2_token.error}"
  end
end