Class: JiraCommand::Command::Sprint

Inherits:
Thor
  • Object
show all
Defined in:
lib/jira_command/command/sprint.rb

Instance Method Summary collapse

Instance Method Details

#create(name) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/jira_command/command/sprint.rb', line 32

def create(name)
  config = JiraCommand::Config.new.read

  board_id = JiraCommand::Prompt::Base.new.select_board

  jira_sprint = JiraCommand::Jira::Sprint.new(config)

  jira_sprint.create(
    name: name,
    board_id: board_id,
    start_date: DateTime.parse(options['start_datetime']).strftime('%Y-%m-%dT%H:%M:%S.%L+09:00'),
    end_date: DateTime.parse(options['end_datetime']).strftime('%Y-%m-%dT%H:%M:%S.%L+09:00')
  )
end

#listObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jira_command/command/sprint.rb', line 15

def list
  config = JiraCommand::Config.new.read

  board_id = JiraCommand::Prompt::Base.new.select_board
  jira_sprint = JiraCommand::Jira::Sprint.new(config)
  state = []
  state << 'future' unless options['future'].nil?
  state << 'active' unless options['active'].nil?
  state << 'closed' unless options['closed'].nil?
  res = jira_sprint.list(board_id: board_id, query: { state: state })

  puts(res.map { |item| item[:name] })
end