Class: TicketMaster::Provider::Github::Project
- Inherits:
-
Base::Project
- Object
- Base::Project
- TicketMaster::Provider::Github::Project
- Defined in:
- lib/provider/project.rb
Overview
Project class for ticketmaster-github
Class Method Summary collapse
Instance Method Summary collapse
-
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this.
- #created_at ⇒ Object
- #id ⇒ Object
-
#initialize(*object) ⇒ Project
constructor
declare needed overloaded methods here.
- #ticket(*options) ⇒ Object
- #ticket!(*options) ⇒ Object
- #tickets(*options) ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Project
declare needed overloaded methods here
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/provider/project.rb', line 9 def initialize(*object) if object.first object = object.first @system_data = {:client => object} unless object.is_a? Hash hash = {:description => object.description, :created_at => object.created_at, :updated_at => object.created_at, :name => object.name, :id => object.name, :owner => object.owner} else hash = object end super hash end end |
Class Method Details
.find_all(*options) ⇒ Object
66 67 68 69 |
# File 'lib/provider/project.rb', line 66 def self.find_all(*) TicketMaster::Provider::Github.api.repositories(TicketMaster::Provider::Github.login).collect { |repository| self.new repository } end |
.find_by_attributes(attributes = {}) ⇒ Object
58 59 60 |
# File 'lib/provider/project.rb', line 58 def self.find_by_attributes(attributes = {}) search_by_attribute(find_all, attributes).collect { |project| self.new project } end |
.find_by_id(id) ⇒ Object
62 63 64 |
# File 'lib/provider/project.rb', line 62 def self.find_by_id(id) self.new TicketMaster::Provider::Github.api.repository("#{TicketMaster::Provider::Github.login}/#{id}") end |
Instance Method Details
#copy(project) ⇒ Object
copy from this.copy(that) copies that into this
48 49 50 51 52 53 54 55 56 |
# File 'lib/provider/project.rb', line 48 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
27 28 29 30 31 32 33 |
# File 'lib/provider/project.rb', line 27 def created_at begin Time.parse(self[:created_at]) rescue self[:created_at] end end |
#id ⇒ Object
43 44 45 |
# File 'lib/provider/project.rb', line 43 def id self[:name] end |
#ticket(*options) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/provider/project.rb', line 75 def ticket(*) unless .empty? TicketMaster::Provider::Github::Ticket.find_by_id(self.id, .first) else TicketMaster::Provider::Github::Ticket end end |
#ticket!(*options) ⇒ Object
83 84 85 |
# File 'lib/provider/project.rb', line 83 def ticket!(*) TicketMaster::Provider::Github::Ticket.open(self.id, .first) end |
#tickets(*options) ⇒ Object
71 72 73 |
# File 'lib/provider/project.rb', line 71 def tickets(*) TicketMaster::Provider::Github::Ticket.find(self.id, ) end |
#updated_at ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/provider/project.rb', line 35 def updated_at begin Time.parse(self[:created_at]) rescue self[:created_at] end end |