Class: TaskMapper::Provider::Bugzilla::Ticket
- Inherits:
-
TaskMapper::Provider::Base::Ticket
- Object
- TaskMapper::Provider::Base::Ticket
- TaskMapper::Provider::Bugzilla::Ticket
- Defined in:
- lib/provider/ticket.rb
Overview
Ticket class for taskmapper-bugzilla
Constant Summary collapse
Class Method Summary collapse
- .create(project_id, *options) ⇒ Object
- .find(project_id, *options) ⇒ Object
- .find_by_id(id) ⇒ Object
Instance Method Summary collapse
- #assignee ⇒ Object
- #comment(*options) ⇒ Object
- #comments(*options) ⇒ Object
- #created_at ⇒ Object
- #description ⇒ Object
-
#initialize(*object) ⇒ Ticket
constructor
A new instance of Ticket.
- #requestor ⇒ Object
- #title ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Ticket
Returns a new instance of Ticket.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/provider/ticket.rb', line 9 def initialize(*object) return super(object.first) if object.first.is_a? Hash if object.first object = object.first unless object.is_a? Hash @system_data = {:client => object} hash = {:product_id => object.product_id, :id => object.id, :project_id => object.product_id, :component_id => object.component_id, :summary => object.summary, :title => object.summary, :version => object.version, :op_sys => object.op_sys, :platform => object.platform, :priority => object.priority, :description => object.description, :alias => object.alias, :qa_contact => object.qa_contact, :assignee => object.assigned_to, :requestor => object.qa_contact, :status => object.status, :target_milestone => object.target_milestone, :severity => object.severity, :created_at => nil, :updated_at => nil} else hash = object end super hash end end |
Class Method Details
.create(project_id, *options) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/provider/ticket.rb', line 90 def self.create(project_id, *) begin bug = Rubyzilla::Bug.new bug.product = TICKETS_API.new project_id .first.each_pair do |k, v| bug.send "#{k}=", v end self.new bug.create rescue self.find(project_id, []).last end end |
.find(project_id, *options) ⇒ Object
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/provider/ticket.rb', line 79 def self.find(project_id, *) if .first.empty? TICKETS_API.new(project_id).bugs.collect { |bug| self.new bug } elsif [0].first.is_a? Array [0].first.collect { |bug_id| self.find_by_id bug_id } elsif [0].first.is_a? Hash bugs = TICKETS_API.new(project_id).bugs.collect { |bug| self.new bug } search_by_attribute(bugs, [0].first) end end |
Instance Method Details
#assignee ⇒ Object
54 55 56 |
# File 'lib/provider/ticket.rb', line 54 def assignee self[:assignee] end |
#comment(*options) ⇒ Object
107 108 109 |
# File 'lib/provider/ticket.rb', line 107 def comment(*) Comment.find_by_id(self.id, .first) end |
#comments(*options) ⇒ Object
103 104 105 |
# File 'lib/provider/ticket.rb', line 103 def comments(*) Comment.find(self.id, ) end |
#created_at ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/provider/ticket.rb', line 58 def created_at begin normalize_datetime(self[:last_change_time]) rescue self[:created_at] end end |
#description ⇒ Object
46 47 48 |
# File 'lib/provider/ticket.rb', line 46 def description self[:description] end |
#requestor ⇒ Object
50 51 52 |
# File 'lib/provider/ticket.rb', line 50 def requestor self[:requestor] end |
#title ⇒ Object
42 43 44 |
# File 'lib/provider/ticket.rb', line 42 def title self[:summary] end |
#updated_at ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/provider/ticket.rb', line 66 def updated_at begin normalize_datetime(self[:last_change_time]) rescue self[:updated_at] end end |