Class: TicketMaster::Provider::Bugzilla::Project

Inherits:
TicketMaster::Provider::Base::Project
  • Object
show all
Defined in:
lib/provider/project.rb

Overview

Project class for ticketmaster-bugzilla

Constant Summary collapse

PRODUCT_API =

declare needed overloaded methods here

Rubyzilla::Product

Class Method Summary collapse

Instance Method Summary collapse

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(*options)
  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(*options)
  TicketMaster::Provider::Bugzilla::Ticket.find_by_id(options.first)
end

#ticket!(*options) ⇒ Object



58
59
60
# File 'lib/provider/project.rb', line 58

def ticket!(*options)
  TicketMaster::Provider::Bugzilla::Ticket.create(self.id,*options)
end

#tickets(*options) ⇒ Object



50
51
52
# File 'lib/provider/project.rb', line 50

def tickets(*options)
  TicketMaster::Provider::Bugzilla::Ticket.find(self.id, options)
end