Class: Bl::Category

Inherits:
Command show all
Defined in:
lib/bl/category.rb

Constant Summary

Constants inherited from Command

Bl::Command::ACTIVITY_TYPES, Bl::Command::CATEGORY_FIELDS, Bl::Command::FILE_FIELDS, Bl::Command::GIT_REPO_FIELDS, Bl::Command::ISSUES_PARAMS, Bl::Command::ISSUE_BASE_ATTRIBUTES, Bl::Command::ISSUE_FIELDS, Bl::Command::MILESTONE_FIELDS, Bl::Command::MILESTONE_PARAMS, Bl::Command::PROJECT_FIELDS, Bl::Command::PROJECT_PARAMS, Bl::Command::ROLES, Bl::Command::SPACE_DISK_USAGE, Bl::Command::SPACE_DISK_USAGE_DETAILS_FIELDS, Bl::Command::SPACE_FIELDS, Bl::Command::SPACE_NOTIFICATION_FIELDS, Bl::Command::TYPE_COLORS, Bl::Command::USER_FIELDS, Bl::Command::USER_PARAMS, Bl::Command::WATCHINGS_PARAMS, Bl::Command::WEBHOOK_FIELDS, Bl::Command::WEBHOOK_PARAMS, Bl::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

#initializeCategory

Returns a new instance of Category.



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

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

Instance Method Details

#add(*names) ⇒ Object



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

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

#delete(*ids) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/bl/category.rb', line 36

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

#listObject



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

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

#update(*ids) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/bl/category.rb', line 27

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