class Jira::Command::Comment::Add

Attributes

options[RW]
ticket[RW]

Public Class Methods

new(ticket, options) click to toggle source
# File lib/jira/commands/comment/add.rb, line 18
def initialize(ticket, options)
  self.ticket = ticket
  self.options = options
end

Public Instance Methods

run() click to toggle source
# File lib/jira/commands/comment/add.rb, line 23
def run
  return if text.empty?
  api.post "issue/#{ticket}/comment",
    params:  params,
    success: on_success,
    failure: on_failure
end

Private Instance Methods

on_failure() click to toggle source
# File lib/jira/commands/comment/add.rb, line 45
def on_failure
  ->{ puts "No comment posted." }
end
on_success() click to toggle source
# File lib/jira/commands/comment/add.rb, line 41
def on_success
  ->{ puts "Successfully posted your comment." }
end
params() click to toggle source
# File lib/jira/commands/comment/add.rb, line 33
def params
  { body: text }
end
text() click to toggle source
# File lib/jira/commands/comment/add.rb, line 37
def text
  body(options['text'])
end