Class: Jira::Command::Unwatch

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/commands/watch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket) ⇒ Unwatch

Returns a new instance of Unwatch.



90
91
92
# File 'lib/jira/commands/watch.rb', line 90

def initialize(ticket)
  self.ticket = ticket
end

Instance Attribute Details

#ticketObject

Returns the value of attribute ticket.



88
89
90
# File 'lib/jira/commands/watch.rb', line 88

def ticket
  @ticket
end

Instance Method Details

#runObject



94
95
96
97
98
99
100
101
# File 'lib/jira/commands/watch.rb', line 94

def run
  return if ticket.empty?

  username = Jira::Core.username
  api.delete "issue/#{ticket}/watchers?username=#{username}",
    success: on_success,
    failure: on_failure
end