Class: Jira::Command::Rename
Instance Attribute Summary collapse
-
#ticket ⇒ Object
Returns the value of attribute ticket.
Instance Method Summary collapse
-
#initialize(ticket) ⇒ Rename
constructor
A new instance of Rename.
- #on_failure ⇒ Object
- #on_success ⇒ Object
- #params ⇒ Object
- #run ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(ticket) ⇒ Rename
Returns a new instance of Rename.
16 17 18 |
# File 'lib/jira/commands/rename.rb', line 16 def initialize(ticket) self.ticket = ticket end |
Instance Attribute Details
#ticket ⇒ Object
Returns the value of attribute ticket.
14 15 16 |
# File 'lib/jira/commands/rename.rb', line 14 def ticket @ticket end |
Instance Method Details
#on_failure ⇒ Object
41 42 43 |
# File 'lib/jira/commands/rename.rb', line 41 def on_failure ->{ puts "No change made to ticket #{ticket}." } end |
#on_success ⇒ Object
37 38 39 |
# File 'lib/jira/commands/rename.rb', line 37 def on_success ->{ puts "Successfully updated ticket #{ticket}'s summary." } end |
#params ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/jira/commands/rename.rb', line 29 def params { fields: { summary: summary } } end |
#run ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/jira/commands/rename.rb', line 20 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
45 46 47 |
# File 'lib/jira/commands/rename.rb', line 45 def summary @summary ||= io.ask("New summary for ticket #{ticket}:") end |