Class: Bl::Type

Inherits:
Command show all
Defined in:
lib/bl/type.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

#initializeType

Returns a new instance of Type.



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

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

Instance Method Details

#add(*names) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/bl/type.rb', line 18

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

#colorsObject



48
49
50
51
52
# File 'lib/bl/type.rb', line 48

def colors
  TYPE_COLORS.each do |color|
    puts Paint[color, '#ffffff', color]
  end
end

#delete(*ids) ⇒ Object



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

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

#listObject



11
12
13
14
# File 'lib/bl/type.rb', line 11

def list
  res = client.get(@url)
  print_response(res)
end

#update(*ids) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/bl/type.rb', line 29

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