Class: Weekdone::Cli::Objective

Inherits:
Thor
  • Object
show all
Includes:
Weekdone::Cli
Defined in:
lib/weekdone/cli/command_objective.rb

Constant Summary

Constants included from Weekdone::Cli

VERSION

Instance Method Summary collapse

Methods included from Weekdone::Cli

#build_client

Instance Method Details

#commentsObject



38
39
40
41
42
43
44
# File 'lib/weekdone/cli/command_objective.rb', line 38

def comments
  client = build_client

  objectives = client.listObjectiveComments(options[:objectiveid])
  Credential.write_credential(client.token_hash)
  Output.format(objectives, format: :json)
end

#listObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/weekdone/cli/command_objective.rb', line 20

def list
  client = build_client

  params = {}
  params[:type] = options[:type] if not options[:type].nil?
  params[:departmentid] = options[:departmentid] if not options[:departmentid].nil?
  params[:teamid] = options[:teamid] if not options[:teamid].nil?
  params[:userid] = options[:userid] if not options[:userid].nil?
  params[:period] = options[:period] if not options[:period].nil?

  objectives = client.getAllObjectives(params)

  Credential.write_credential(client.token_hash)
  Output.format(objectives, format: :json)
end