class Jira::Command::Vote::Delete

Attributes

ticket[RW]

Public Class Methods

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

Public Instance Methods

run() click to toggle source
# File lib/jira/commands/vote/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/vote/delete.rb, line 31
def endpoint
  "issue/#{ticket}/votes?username=#{Jira::Core.username}"
end
on_failure() click to toggle source
# File lib/jira/commands/vote/delete.rb, line 39
def on_failure
  ->{ puts "No unvote." }
end
on_success() click to toggle source
# File lib/jira/commands/vote/delete.rb, line 35
def on_success
  ->{ puts "Successfully removed vote from ticket #{ticket}" }
end