Class: TicketMaster::Provider::Teambox::Project
- Inherits:
-
Base::Project
- Object
- Base::Project
- TicketMaster::Provider::Teambox::Project
- Defined in:
- lib/provider/project.rb
Overview
Project class for ticketmaster-teambox
Constant Summary collapse
- API =
The class to access the api’s projects
TeamboxAPI::Project
Instance Method Summary collapse
-
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this.
- #id ⇒ Object
- #ticket!(*options) ⇒ Object
-
#tickets(*options) ⇒ Object
declare needed overloaded methods here.
Instance Method Details
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this
31 32 33 34 35 36 37 38 39 |
# File 'lib/provider/project.rb', line 31 def copy(project) project.tickets.each do |ticket| copy_ticket = self.ticket!(:title => ticket.name) ticket.comments.each do |comment| copy_ticket.comment!(:body => comment.body) sleep 1 end end end |
#id ⇒ Object
41 42 43 |
# File 'lib/provider/project.rb', line 41 def id self[:id] end |
#ticket!(*options) ⇒ Object
25 26 27 28 |
# File 'lib/provider/project.rb', line 25 def ticket!(*) [0].merge!(:project_id => id) if .first.is_a?(Hash) provider_parent(self.class)::Ticket.create(*) end |
#tickets(*options) ⇒ Object
declare needed overloaded methods here
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/provider/project.rb', line 10 def tickets(*) begin if .first.is_a? Hash #options[0].merge!(:params => {:id => id}) super(*) elsif .empty? tickets = TeamboxAPI::Task.find(:all, :params => {:project_id => id}).collect { |ticket| TicketMaster::Provider::Teambox::Ticket.new ticket } else super(*) end rescue [] end end |