Class: Bl::Watchings

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

Instance Method Summary collapse

Methods included from Printer

print_response, printable_issues

Methods included from Formatting

colorize_priority, colorize_status, colorize_type

Methods included from Requestable

client, formatter, request

Constructor Details

#initializeWatchings

Returns a new instance of Watchings.



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

def initialize(*)
  @config = Bl::Config.instance
  @url = 'watchings'
  super
end

Instance Method Details

#addObject



32
33
34
35
36
# File 'lib/bl/watchings.rb', line 32

def add
  res = request(:post, 'watchings', options.to_h)
  puts 'watch added'
  print_watch_target(res.body)
end

#count(id) ⇒ Object



19
20
21
22
# File 'lib/bl/watchings.rb', line 19

def count(id)
  res = request(:get, "/users/#{id}/#{@url}/count")
  puts res.body.count
end

#delete(id) ⇒ Object



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

def delete(id)
  res = request(:delete, "watchings/#{id}")
  puts 'watch deleted'
  print_watch_target(res.body)
end

#list(id) ⇒ Object



12
13
14
15
# File 'lib/bl/watchings.rb', line 12

def list(id)
  res = request(:get, "/users/#{id}/#{@url}", delete_class_options(options.to_h))
  res.body.map { |t| print_watch_target(t) }
end

#mark_as_checked(id) ⇒ Object



61
62
63
64
# File 'lib/bl/watchings.rb', line 61

def mark_as_checked(id)
  res = request(:post, "/users/#{id}/watchings/markAsChecked")
  puts 'watch mark as checked'
end

#mark_as_read(id) ⇒ Object



55
56
57
58
# File 'lib/bl/watchings.rb', line 55

def mark_as_read(id)
  res = request(:post, "watchings/#{id}/markAsRead")
  puts 'watch mark as read'
end

#show(id) ⇒ Object



25
26
27
28
# File 'lib/bl/watchings.rb', line 25

def show(id)
  res = request(:get, "watchings/#{id}")
  print_watch_target(res.body)
end

#update(id) ⇒ Object



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

def update(id)
  # TODO fix conflict with issue update command
  # res = request(:patch, "watchings/#{id}", option.to_h)
  # puts 'watch updated'
  # print_watch_target(res.body)
end