Class: Weekdone::Cli::Command
- Inherits:
-
Thor
- Object
- Thor
- Weekdone::Cli::Command
- Includes:
- Weekdone::Cli
- Defined in:
- lib/weekdone/cli/command.rb
Constant Summary
Constants included from Weekdone::Cli
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Weekdone::Cli
Class Method Details
.exit_on_failure? ⇒ Boolean
13 14 15 |
# File 'lib/weekdone/cli/command.rb', line 13 def self.exit_on_failure? true end |
Instance Method Details
#login ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/weekdone/cli/command.rb', line 18 def login client = build_client puts "open URL to authorize:" puts client. print "\ninput authorization code: " auth_code = STDIN.gets.chomp client.(auth_code) Credential.write_credential(client.token_hash) end |
#report ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/weekdone/cli/command.rb', line 32 def report client = build_client report = client.getReport Credential.write_credential(client.token_hash) Output.format(report, format: :json) end |
#teams ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/weekdone/cli/command.rb', line 41 def teams client = build_client teams = client.getAllTeams Credential.write_credential(client.token_hash) Output.format(teams, format: :json) end |
#types ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/weekdone/cli/command.rb', line 59 def types client = build_client types = client.getAllTypes Credential.write_credential(client.token_hash) Output.format(types, format: :json) end |
#users ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/weekdone/cli/command.rb', line 50 def users client = build_client users = client.getAllUsers Credential.write_credential(client.token_hash) Output.format(users, format: :json) end |