Class: TicketMaster::Provider::Codaset::Project
- Inherits:
-
Base::Project
- Object
- Base::Project
- TicketMaster::Provider::Codaset::Project
- Defined in:
- lib/provider/project.rb
Overview
Project class for ticketmaster-codaset
Constant Summary collapse
- API =
The class to access the api’s projects
CodasetAPI::Project
Instance Method Summary collapse
-
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this.
-
#created_at ⇒ Object
declare needed overloaded methods here.
- #id ⇒ Object
-
#initialize(*options) ⇒ Project
constructor
A new instance of Project.
- #name ⇒ Object
- #ticket!(*options) ⇒ Object
- #tickets(*options) ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(*options) ⇒ Project
Returns a new instance of Project.
18 19 20 |
# File 'lib/provider/project.rb', line 18 def initialize(*) super(*) end |
Instance Method Details
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this
51 52 53 54 55 56 57 58 59 |
# File 'lib/provider/project.rb', line 51 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 |
#created_at ⇒ Object
declare needed overloaded methods here
10 11 12 |
# File 'lib/provider/project.rb', line 10 def created_at @created_at ||= self[:created_at] ? Time.parse(self[:created_at]) : nil end |
#id ⇒ Object
22 23 24 |
# File 'lib/provider/project.rb', line 22 def id self[:slug] end |
#name ⇒ Object
26 27 28 |
# File 'lib/provider/project.rb', line 26 def name self[:title] end |
#ticket!(*options) ⇒ Object
30 31 32 33 |
# File 'lib/provider/project.rb', line 30 def ticket!(*) [0].merge!(:slug => slug) if .first.is_a?(Hash) provider_parent(self.class)::Ticket.create(*) end |
#tickets(*options) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/provider/project.rb', line 35 def tickets(*) begin if .first.is_a? Hash #options[0].merge!(:params => {:slug => slug}) super(*) elsif .empty? tickets = CodasetAPI::Ticket.find(:all, :params => {:slug => slug}).collect { |ticket| TicketMaster::Provider::Codaset::Ticket.new ticket } else super(*) end rescue [] end end |
#updated_at ⇒ Object
14 15 16 |
# File 'lib/provider/project.rb', line 14 def updated_at @updated_at ||= self[:updated_at] ? Time.parse(self[:updated_at]) : nil end |