class Weekdone::Cli::Command

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/weekdone/cli/command.rb, line 13
def self.exit_on_failure?
  true
end

Public Instance Methods

login() click to toggle source
# File lib/weekdone/cli/command.rb, line 18
def login
  client = build_client

  puts "open URL to authorize:"
  puts client.authorization_request

  print "\ninput authorization code: "
  auth_code = STDIN.gets.chomp
  client.authorization_grant(auth_code)

  Credential.write_credential(client.token_hash)
end
report() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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