Sha256: b3954462aa7aadb44abd81ef5794e188d02a8652232f76016e28952fe0e37cbe
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
module TicketMaster::Provider module Zendesk # Project class for ticketmaster-zendesk # # class Project < TicketMaster::Provider::Base::Project attr_accessor :prefix_options #API = ZendeskAPI::Organization # declare needed overloaded methods here def initialize(*object) if object.first object = object.first unless object.is_a? Hash @system_data = {:client => object} hash = {:repository => object.account, :user => object.username, :name => object.name} 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 tickets(*options) if options.empty? Ticket.find_all(self.name).collect { |ticket| Ticket.new [ticket, self.name]} elsif options.first.is_a? Array Ticket.find_all(self.name).select { |ticket| ticket if options.first.any? { |ticket_id| ticket_id == ticket.id }} elsif options.first.is_a? Hash Ticket.find_by_attributes(self.name, options.first) end end def ticket(*options) if options.first.is_a? Fixnum ticket_id = options.first Ticket.find_by_id(ticket_id) elsif options.first.is_a? Hash Ticket.find_by_attributes(self.name, options.first).first else TicketMaster::Provider::Zendesk::Ticket end end def ticket!(*options) Ticket.new [ZendeskAPI::Ticket.create(options.first), self.name] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ticketmaster-zendesk-0.0.1 | lib/provider/project.rb |