Class: Twurl::AppOnlyTokenInformationController

Inherits:
AbstractCommandController show all
Defined in:
lib/twurl/app_only_token_information_controller.rb

Constant Summary collapse

NO_ISSUED_TOKENS_MESSAGE =
"No issued application-only (Bearer) tokens"

Instance Attribute Summary

Attributes inherited from AbstractCommandController

#client, #options

Instance Method Summary collapse

Methods inherited from AbstractCommandController

dispatch, #initialize

Constructor Details

This class inherits a constructor from Twurl::AbstractCommandController

Instance Method Details

#dispatchObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/twurl/app_only_token_information_controller.rb', line 5

def dispatch
  rcfile = OAuthClient.rcfile
  if rcfile.empty? || rcfile.bearer_tokens.nil?
    CLI.puts NO_ISSUED_TOKENS_MESSAGE
  else
    tokens = rcfile.bearer_tokens
    CLI.puts "[consumer_key: bearer_token]"
    tokens.each_key do |consumer_key|
      CLI.puts "#{consumer_key}: (omitted)"
    end
  end
end