Class: Jira::Command::Watch::Add

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket) ⇒ Add

Returns a new instance of Add.



17
18
19
# File 'lib/jira/commands/watch/add.rb', line 17

def initialize(ticket)
  self.ticket = ticket
end

Instance Attribute Details

#ticketObject

Returns the value of attribute ticket.



15
16
17
# File 'lib/jira/commands/watch/add.rb', line 15

def ticket
  @ticket
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
# File 'lib/jira/commands/watch/add.rb', line 21

def run
  return if ticket.empty?

  api.post "issue/#{ticket}/watchers",
    params:  "\"#{Jira::Core.username}\"",
    success: on_success,
    failure: on_failure
end