Class: TaskMapper::Provider::Mingle::Project
- Inherits:
-
Base::Project
- Object
- Base::Project
- TaskMapper::Provider::Mingle::Project
- Defined in:
- lib/provider/project.rb
Overview
Project class for taskmapper-mingle
Constant Summary collapse
Instance Method Summary collapse
-
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this.
-
#id ⇒ Object
declare needed overloaded methods here.
-
#initialize(*options) ⇒ Project
constructor
A new instance of Project.
- #ticket!(*options) ⇒ Object
- #tickets(*options) ⇒ Object
Constructor Details
#initialize(*options) ⇒ Project
Returns a new instance of Project.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/provider/project.rb', line 14 def initialize(*) @system_data ||= {} @cache ||= {} first = .first case first when Hash super first.to_hash else @system_data[:client] = first super first.attributes end end |
Instance Method Details
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this
48 49 50 51 52 53 54 55 56 |
# File 'lib/provider/project.rb', line 48 def copy(project) project.tickets.each do |ticket| copy_ticket = self.ticket!(:name => ticket.title, :description => ticket.description) ticket.comments.each do |comment| copy_ticket.comment!(:content => comment.body) sleep 1 end end end |
#id ⇒ Object
declare needed overloaded methods here
10 11 12 |
# File 'lib/provider/project.rb', line 10 def id self[:identifier] end |
#ticket!(*options) ⇒ Object
42 43 44 45 |
# File 'lib/provider/project.rb', line 42 def ticket!(*) [0].merge!(:identifier => id) if .first.is_a?(Hash) provider_parent(self.class)::Ticket.create(*) end |
#tickets(*options) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/provider/project.rb', line 27 def tickets(*) begin if .first.is_a? Hash #options[0].merge!(:params => {:id => id}) super(*) elsif .empty? tickets = MingleAPI::Card.find(:all, :params => {:identifier => id}).collect { |ticket| TaskMapper::Provider::Mingle::Ticket.new ticket } else super(*) end rescue [] end end |