Class: Redcuine::Issue
Constant Summary collapse
- @@default_param =
{}
- @@issue_attribute_keys =
[:subject, :description, :tracker_id, :status_id, :category_id, :assigned_to_id, :priority_id, :fixed_version, :start_date, :due_date, :estimate_date, :done_ratio]
Class Method Summary collapse
Class Method Details
.delete ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/redcuine/issue.rb', line 63 def self.delete issue = Resource::Issue.find(CONFIG["id"]) res = issue.destroy puts res ? "Destroyed issue!" : "Fail to destroy issue." return res rescue puts $!.to_s puts $!.backtrace if CONFIG["debug"] puts "Fail to destroy issue." return false end |
.get ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/redcuine/issue.rb', line 18 def self.get CONFIG["id"] ? show(CONFIG["id"]) : index rescue puts $!.to_s puts $!.backtrace if CONFIG["debug"] puts "Fail to get issue." return false end |
.post ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/redcuine/issue.rb', line 27 def self.post keys = [:project_id] + @@issue_attribute_keys opts = (keys, @@default_param) opts[:description] = description_by_editor if CONFIG["editor"] issue = Resource::Issue.new(opts) issue.save! puts "Created issue!" CONFIG["id"] = issue.id get return true rescue puts $!.to_s puts $!.backtrace if CONFIG["debug"] puts "Fail to create issue." return false end |
.put ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/redcuine/issue.rb', line 44 def self.put opts = (@@issue_attribute_keys, @@default_param) issue = Resource::Issue.find(CONFIG["id"]) if CONFIG["editor"] opts[:description] = description_by_editor(issue.description) end issue.load(opts) issue.save! puts "Updated issue!" CONFIG["id"] = issue.id get return true rescue puts $!.to_s puts $!.backtrace if CONFIG["debug"] puts "Fail to update issue." return false end |