Class: TicketMaster::Provider::Mingle::Project

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

Overview

Project class for ticketmaster-mingle

Constant Summary collapse

API =

The class to access the api’s projects

MingleAPI::Project

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Project

Returns a new instance of Project.



14
15
16
# File 'lib/provider/project.rb', line 14

def initialize(*options)
  super(*options)
end

Instance Method Details

#copy(project) ⇒ Object

copy from this.copy(that) copies that into this



39
40
41
42
43
44
45
46
47
# File 'lib/provider/project.rb', line 39

def copy(project)
  project.tickets.each do |ticket|
    copy_ticket = self.ticket!(:name => ticket.title, :description => ticket.description)
    ticket.comments.each do |comment|
      copy_ticket.comment!(:content => comment.body)
      sleep 1
    end
  end
end

#idObject

declare needed overloaded methods here



10
11
12
# File 'lib/provider/project.rb', line 10

def id
  self[:identifier]
end

#ticket!(*options) ⇒ Object



33
34
35
36
# File 'lib/provider/project.rb', line 33

def ticket!(*options)
  options[0].merge!(:identifier => id) if options.first.is_a?(Hash)
  provider_parent(self.class)::Ticket.create(*options)
end

#tickets(*options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/provider/project.rb', line 18

def tickets(*options)
  begin
    if options.first.is_a? Hash
      #options[0].merge!(:params => {:id => id})
      super(*options)
    elsif options.empty?
      tickets = MingleAPI::Card.find(:all, :params => {:identifier => id}).collect { |ticket| TicketMaster::Provider::Mingle::Ticket.new ticket }
    else
      super(*options)
    end
  rescue
    []
  end
end