Class: TicketMaster::Provider::Teambox::Project

Inherits:
Base::Project
  • Object
show all
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

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

#idObject



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!(*options)
  options[0].merge!(:project_id => id) if options.first.is_a?(Hash)
  provider_parent(self.class)::Ticket.create(*options)
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(*options)
  begin
    if options.first.is_a? Hash
      #options[0].merge!(:params => {:id => id})
      super(*options)
    elsif options.empty?
      tickets = TeamboxAPI::Task.find(:all, :params => {:project_id => id}).collect { |ticket| TicketMaster::Provider::Teambox::Ticket.new ticket }
    else
      super(*options)
    end
  rescue
    []
  end
end