Sha256: 525b3e45b8cbbb606b9861248cd61d48e1bd5a7527e7789b28abe4d561f55502
Contents?: true
Size: 1.96 KB
Versions: 6
Compression:
Stored size: 1.96 KB
Contents
module TicketMaster::Provider module Bugzilla # Project class for ticketmaster-bugzilla # class Project < TicketMaster::Provider::Base::Project # declare needed overloaded methods here PRODUCT_API = Rubyzilla::Product # TODO: Add created_at and updated_at 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 # copy from this.copy(that) copies that into this 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 def self.find_by_id(id) self.new PRODUCT_API.new id end def self.find_by_attributes(*options) options = options.first if options.is_a? Hash search_by_attribute(self.find_all, options) else self.find_all.select do |project| options.any? { |id| project.id == id } end end end def self.find_all(*options) PRODUCT_API.list.collect { |product| self.new product } end def tickets(*options) TicketMaster::Provider::Bugzilla::Ticket.find(self.id, options) end def ticket(*options) TicketMaster::Provider::Bugzilla::Ticket.find_by_id(options.first) end def ticket!(*options) TicketMaster::Provider::Bugzilla::Ticket.create(self.id,*options) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems