Class: TaskMapper::Provider::Bugzilla::Project
- Inherits:
-
TaskMapper::Provider::Base::Project
- Object
- TaskMapper::Provider::Base::Project
- TaskMapper::Provider::Bugzilla::Project
- Defined in:
- lib/provider/project.rb
Overview
Project class for taskmapper-bugzilla
Constant Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this.
-
#initialize(*object) ⇒ Project
constructor
TODO: Add created_at and updated_at.
- #ticket(*options) ⇒ Object
- #ticket!(*options) ⇒ Object
- #tickets(*options) ⇒ Object
Constructor Details
#initialize(*object) ⇒ Project
TODO: Add created_at and updated_at
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/provider/project.rb', line 10 def initialize(*object) if object.first object = object.first unless object.is_a? Hash @system_data = {:client => object} hash = {:id => object.id, :name => object.name, :description => object.name, :created_at => nil, :updated_at => nil} else hash = object end super(hash) end end |
Class Method Details
.find_all(*options) ⇒ Object
46 47 48 |
# File 'lib/provider/project.rb', line 46 def self.find_all(*) PRODUCT_API.list.collect { |product| self.new product } end |
.find_by_attributes(attributes = {}) ⇒ Object
42 43 44 |
# File 'lib/provider/project.rb', line 42 def self.find_by_attributes(attributes = {}) search_by_attribute(self.find_all, attributes) end |
.find_by_id(id) ⇒ Object
38 39 40 |
# File 'lib/provider/project.rb', line 38 def self.find_by_id(id) self.new PRODUCT_API.new id end |
Instance Method Details
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this
28 29 30 31 32 33 34 35 36 |
# File 'lib/provider/project.rb', line 28 def copy(project) project.tickets.each do |ticket| copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description) ticket.comments.each do |comment| copy_ticket.comment!(:body => comment.body) sleep 1 end end end |
#ticket(*options) ⇒ Object
54 55 56 |
# File 'lib/provider/project.rb', line 54 def ticket(*) TaskMapper::Provider::Bugzilla::Ticket.find_by_id(.first) end |
#ticket!(*options) ⇒ Object
58 59 60 |
# File 'lib/provider/project.rb', line 58 def ticket!(*) TaskMapper::Provider::Bugzilla::Ticket.create(self.id,*) end |
#tickets(*options) ⇒ Object
50 51 52 |
# File 'lib/provider/project.rb', line 50 def tickets(*) TaskMapper::Provider::Bugzilla::Ticket.find(self.id, ) end |