class Jira::Command::Watch::List
Attributes
ticket[RW]
watcher[RW]
Public Class Methods
new(ticket)
click to toggle source
# File lib/jira/commands/watch/list.rb, line 17 def initialize(ticket) self.ticket = ticket end
Public Instance Methods
run()
click to toggle source
# File lib/jira/commands/watch/list.rb, line 21 def run return if ticket.empty? return if watchers.nil? return if no_watchers? watchers.each do |watcher| self.watcher = watcher display_watcher end end
Private Instance Methods
display_name()
click to toggle source
# File lib/jira/commands/watch/list.rb, line 48 def display_name Jira::Format.user(watcher['displayName']) end
display_watcher()
click to toggle source
# File lib/jira/commands/watch/list.rb, line 44 def display_watcher puts "[#{watchers.index(watcher).to_s.rjust(2)}] #{display_name}" end
no_watchers?()
click to toggle source
# File lib/jira/commands/watch/list.rb, line 36 def no_watchers? if watchers.count.zero? puts "Ticket #{ticket} has no watchers." return true end false end
watchers()
click to toggle source
# File lib/jira/commands/watch/list.rb, line 52 def watchers @watchers ||= api.get("issue/#{ticket}/watchers")['watchers'] end