Class: Jira::Command::Delete

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket, force) ⇒ Delete

Returns a new instance of Delete.



17
18
19
20
# File 'lib/jira/commands/delete.rb', line 17

def initialize(ticket, force)
  self.ticket = ticket
  self.force = force
end

Instance Attribute Details

#forceObject

Returns the value of attribute force.



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

def force
  @force
end

#ticketObject

Returns the value of attribute ticket.



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

def ticket
  @ticket
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/jira/commands/delete.rb', line 22

def run
  return if ticket.empty?
  return if .empty?
  return if ['fields'].nil?
  return if subtasks_failure?

  api.delete "issue/#{ticket}?deleteSubtasks=#{force}",
    success: ->{ puts "Ticket #{ticket} has been deleted." },
    failure: ->{ puts "No change made to ticket #{ticket}." }
end