Class: TicketMaster::Provider::Jira::Project
- Inherits:
-
Base::Project
- Object
- Base::Project
- TicketMaster::Provider::Jira::Project
- Defined in:
- lib/provider/project.rb
Overview
Project class for ticketmaster-jira
Class Method Summary collapse
- .find(*options) ⇒ Object
- .find_all ⇒ Object
- .find_by_attributes(attributes = {}) ⇒ Object
- .find_by_id(id) ⇒ Object
Instance Method Summary collapse
- #copy(project) ⇒ Object
- #id ⇒ Object
-
#initialize(*object) ⇒ Project
constructor
API = Jira::Project # The class to access the api’s projects declare needed overloaded methods here copy from this.copy(that) copies that into this.
Constructor Details
#initialize(*object) ⇒ Project
API = Jira::Project # The class to access the api’s projects declare needed overloaded methods here copy from this.copy(that) copies that into this
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/provider/project.rb', line 10 def initialize(*object) if object.first object = object.first unless object.is_a? Hash @system_data = {:client => object} hash = {:id => object.id.to_i, :name => object.name, :description => object.description, :updated_at => nil, :created_at => nil} else hash = object end super(hash) end end |
Class Method Details
.find(*options) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/provider/project.rb', line 41 def self.find(*) if [0].first.is_a? Array self.find_all.select do |project| project if .first.any? { |id| project.id == id } end elsif [0].first.is_a? Hash find_by_attributes([0].first) else self.find_all end end |
.find_all ⇒ Object
57 58 59 60 61 |
# File 'lib/provider/project.rb', line 57 def self.find_all $jira.getProjectsNoSchemes().map do |project| Project.new project end end |
.find_by_attributes(attributes = {}) ⇒ Object
53 54 55 |
# File 'lib/provider/project.rb', line 53 def self.find_by_attributes(attributes = {}) search_by_attribute(self.find_all, attributes) end |
.find_by_id(id) ⇒ Object
63 64 65 |
# File 'lib/provider/project.rb', line 63 def self.find_by_id(id) self.find_all.select { |project| project.id == id }.first end |
Instance Method Details
#copy(project) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/provider/project.rb', line 31 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 |
#id ⇒ Object
27 28 29 |
# File 'lib/provider/project.rb', line 27 def id self[:id].to_i end |