Class: Everywhere::Commands::PlatformLogout
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Everywhere::Commands::PlatformLogout
- Defined in:
- lib/everywhere/commands/platform/logout.rb
Overview
every platform logout — revoke the token on the Platform, then drop the
local credential.
Instance Method Summary collapse
Instance Method Details
#call(url: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/everywhere/commands/platform/logout.rb', line 17 def call(url: nil, **) base = Everywhere::Platform::Client.base_url(url) store = Everywhere::Platform::Credentials.load creds = store.for(base) return UI.step("not logged in to #{base}") unless creds begin Everywhere::Platform::Client.new(base, token: creds["token"]).delete("/cli/token") rescue Everywhere::Error => e UI.warn("couldn't reach the Platform to revoke (#{e.}) — removing local credential anyway") end store.delete(base) UI.success("logged out of #{base}") end |