lib/provider/ticket.rb in ticketmaster-zendesk-0.0.1 vs lib/provider/ticket.rb in ticketmaster-zendesk-0.0.2
- old
+ new
@@ -7,10 +7,11 @@
SEARCH_API = ZendeskAPI::Search
API = ZendeskAPI::Ticket
def initialize(*object)
+ return super(object.first) if object.first.is_a? Hash
if object.first
args = object.first
object = args.shift
project_id = args.shift
@system_data = {:client => object}
@@ -40,16 +41,14 @@
Time.parse(self[:updated_at])
end
def self.find_all(*options)
project_id = options.first
- SEARCH_API.find(:all, :params => {:query => "status:open"}).collect { |ticket| self.new [ticket, project_id]}
+ SEARCH_API.find(:all, :params => {:query => "status:open"}).collect { |ticket| self.new([ticket, project_id])}
end
- def self.find_by_id(*options)
- id = options.shift
- project_id = options.shift
- self.new [API.find(id), project_id]
+ def self.find_by_id(project_id, ticket_id)
+ self.new [API.find(ticket_id), project_id]
end
def self.find_by_attributes(project_id, attributes = {})
self.find_all(project_id).select do |ticket|
attributes.inject(true) do |memo, kv|