class Jira::Command::Assign
Attributes
options[RW]
ticket[RW]
Public Class Methods
new(ticket, options={})
click to toggle source
# File lib/jira/commands/assign.rb, line 17 def initialize(ticket, options={}) self.ticket = ticket self.options = options end
Public Instance Methods
run()
click to toggle source
# File lib/jira/commands/assign.rb, line 22 def run api.patch path, params: params, success: on_success, failure: on_failure end
Private Instance Methods
assignee()
click to toggle source
# File lib/jira/commands/assign.rb, line 56 def assignee @assignee ||= ( assignee = options['assignee'] || io.ask('Assignee?', default: 'auto') assignee == 'auto' ? '-1' : assignee ) end
name()
click to toggle source
# File lib/jira/commands/assign.rb, line 52 def name assignee == '-1' ? 'default user' : "'#{assignee}'" end
on_failure()
click to toggle source
# File lib/jira/commands/assign.rb, line 37 def on_failure ->(json) do message = (json['errors'] || {})['assignee'] puts message || "Ticket #{ticket} was not assigned." end end
on_success()
click to toggle source
# File lib/jira/commands/assign.rb, line 31 def on_success -> do puts "Ticket #{ticket} assigned to #{name}." end end
params()
click to toggle source
# File lib/jira/commands/assign.rb, line 48 def params { name: assignee } end
path()
click to toggle source
# File lib/jira/commands/assign.rb, line 44 def path "issue/#{ticket}/assignee" end