Class: Jira::Command::Rename
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#ticket ⇒ Object
Returns the value of attribute ticket.
Instance Method Summary collapse
-
#initialize(ticket, options) ⇒ Rename
constructor
A new instance of Rename.
- #on_failure ⇒ Object
- #on_success ⇒ Object
- #params ⇒ Object
- #run ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(ticket, options) ⇒ Rename
Returns a new instance of Rename.
17 18 19 20 |
# File 'lib/jira/commands/rename.rb', line 17 def initialize(ticket, ) self.ticket = ticket self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
15 16 17 |
# File 'lib/jira/commands/rename.rb', line 15 def @options end |
#ticket ⇒ Object
Returns the value of attribute ticket.
15 16 17 |
# File 'lib/jira/commands/rename.rb', line 15 def ticket @ticket end |
Instance Method Details
#on_failure ⇒ Object
43 44 45 |
# File 'lib/jira/commands/rename.rb', line 43 def on_failure ->{ puts "No change made to ticket #{ticket}." } end |
#on_success ⇒ Object
39 40 41 |
# File 'lib/jira/commands/rename.rb', line 39 def on_success ->{ puts "Successfully updated ticket #{ticket}'s summary." } end |
#params ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/jira/commands/rename.rb', line 31 def params { fields: { summary: summary } } end |
#run ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/jira/commands/rename.rb', line 22 def run return if ticket.empty? return if summary.empty? api.patch "issue/#{ticket}", params: params, success: on_success, failure: on_failure end |
#summary ⇒ Object
47 48 49 |
# File 'lib/jira/commands/rename.rb', line 47 def summary @summary ||= ['summary'] || io.ask("New summary for ticket #{ticket}:", default: '') end |