class Bl::Commands::Watching

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/bl/commands/watching.rb, line 4
def initialize(*)
  @config = Bl::Config.instance
  @url = 'watchings'
  super
end

Public Instance Methods

add() click to toggle source
# File lib/bl/commands/watching.rb, line 32
def add
  res = request(:post, 'watchings', options.to_h)
  puts 'watch added'
  print_watch_target(res.body)
end
count(id) click to toggle source
# File lib/bl/commands/watching.rb, line 19
def count(id)
  res = request(:get, "/users/#{id}/#{@url}/count")
  puts res.body.count
end
delete(id) click to toggle source
# File lib/bl/commands/watching.rb, line 48
def delete(id)
  res = request(:delete, "watchings/#{id}")
  puts 'watch deleted'
  print_watch_target(res.body)
end
list(id) click to toggle source
# File lib/bl/commands/watching.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) click to toggle source
# File lib/bl/commands/watching.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) click to toggle source
# File lib/bl/commands/watching.rb, line 55
def mark_as_read(id)
  res = request(:post, "watchings/#{id}/markAsRead")
  puts 'watch mark as read'
end
show(id) click to toggle source
# File lib/bl/commands/watching.rb, line 25
def show(id)
  res = request(:get, "watchings/#{id}")
  print_watch_target(res.body)
end
update(id) click to toggle source
# File lib/bl/commands/watching.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