Class: Bl::Milestone

Inherits:
Command
  • Object
show all
Defined in:
lib/bl/milestone.rb

Constant Summary

Constants inherited from Command

Command::ACTIVITY_TYPES, Command::CATEGORY_FIELDS, Command::FILE_FIELDS, Command::GIT_REPO_FIELDS, Command::ISSUES_PARAMS, Command::ISSUE_BASE_ATTRIBUTES, Command::ISSUE_FIELDS, Command::MILESTONE_FIELDS, Command::MILESTONE_PARAMS, Command::PROJECT_FIELDS, Command::PROJECT_PARAMS, Command::ROLES, Command::SPACE_DISK_USAGE, Command::SPACE_DISK_USAGE_DETAILS_FIELDS, Command::SPACE_FIELDS, Command::SPACE_NOTIFICATION_FIELDS, Command::TYPE_COLORS, Command::USER_FIELDS, Command::USER_PARAMS, Command::WATCHINGS_PARAMS, Command::WEBHOOK_FIELDS, Command::WEBHOOK_PARAMS, Command::WIKI_FIELDS

Instance Method Summary collapse

Methods included from Formatting

colorize_priority, colorize_status, colorize_type

Methods included from Requestable

client, formatter

Constructor Details

#initializeMilestone

Returns a new instance of Milestone.



4
5
6
7
8
# File 'lib/bl/milestone.rb', line 4

def initialize(*)
  @config = Bl::Config.instance
  @url = "projects/#{@config[:project_key]}/versions"
  super
end

Instance Method Details

#add(*names) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bl/milestone.rb', line 23

def add(*names)
  names.each do |name|
    res = client.post(
      @url,
      name: name,
      description: options[:description],
      startDate: options[:startDate],
      releaseDueDate: options[:releaseDueDate]
    )
    puts 'milestone added'
    print_response(res)
  end
end

#delete(*ids) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/bl/milestone.rb', line 49

def delete(*ids)
  ids.each do |id|
    res = client.delete("#{@url}/#{id}")
    puts 'milestone deleted'
    print_response(res)
  end
end

#listObject



12
13
14
15
16
17
18
19
# File 'lib/bl/milestone.rb', line 12

def list
  res = client.get(@url)
  if options[:all]
  else
    res.body.select! { |m| m.archived == false } unless options[:all]
  end
  print_response(res)
end

#update(*ids) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/bl/milestone.rb', line 40

def update(*ids)
  ids.each do |id|
    res = client.patch("#{@url}/#{id}", delete_class_options(options))
    puts 'milestone updated'
    print_response(res)
  end
end