Class: Twurl::AccountInformationController

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

Constant Summary collapse

NO_AUTHORIZED_ACCOUNTS_MESSAGE =
"No authorized accounts"

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
17
18
19
20
# File 'lib/twurl/account_information_controller.rb', line 5

def dispatch
  rcfile = OAuthClient.rcfile
  if rcfile.empty?
    CLI.puts NO_AUTHORIZED_ACCOUNTS_MESSAGE
  else
    profiles = rcfile.profiles
    profiles.keys.sort.each do ||
      CLI.puts 
      profiles[].each do |consumer_key, _|
         = "  #{consumer_key}"
         << " (default)" if rcfile.default_profile == [, consumer_key]
        CLI.puts 
      end
    end
  end
end