class Jira::Command::Watch::Delete

Attributes

ticket[RW]

Public Class Methods

new(ticket) click to toggle source
# File lib/jira/commands/watch/delete.rb, line 17
def initialize(ticket)
  self.ticket = ticket
end

Public Instance Methods

run() click to toggle source
# File lib/jira/commands/watch/delete.rb, line 21
def run
  return if ticket.empty?

  api.delete endpoint,
    success: on_success,
    failure: on_failure
end

Private Instance Methods

endpoint() click to toggle source
# File lib/jira/commands/watch/delete.rb, line 31
def endpoint
  "issue/#{ticket}/watchers?username=#{Jira::Core.username}"
end
on_failure() click to toggle source
# File lib/jira/commands/watch/delete.rb, line 39
def on_failure
  ->{ puts "Did not stop watching ticket." }
end
on_success() click to toggle source
# File lib/jira/commands/watch/delete.rb, line 35
def on_success
  ->{ puts "Stopped watching ticket #{ticket}" }
end