Class: TaskMapper::Provider::Bugzilla::Comment
- Inherits:
-
TaskMapper::Provider::Base::Comment
- Object
- TaskMapper::Provider::Base::Comment
- TaskMapper::Provider::Bugzilla::Comment
- Defined in:
- lib/provider/comment.rb
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
- #created_at ⇒ Object
-
#initialize(*object) ⇒ Comment
constructor
declare needed overloaded methods here.
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Comment
declare needed overloaded methods here
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/provider/comment.rb', line 11 def initialize(*object) if object.first object = object.first unless object.is_a? Hash @system_data = {:client => object} hash = {:id => object.id, :ticket_id => object.bug_id, :body => object.text, :author => object.creator, :created_at => object.time, :updated_at => object.time} else hash = object end super hash end end |
Class Method Details
.find(ticket_id, *options) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/provider/comment.rb', line 54 def self.find(ticket_id, *) if .first.empty? COMMENT_API.new(ticket_id).comments.collect { |comment| self.new comment } elsif [0].first.is_a? Array COMMENT_API.new(ticket_id).comments(:comment_ids => [0].first).collect { |comment| self.new comment } end end |
.find_by_id(ticket_id, id) ⇒ Object
50 51 52 |
# File 'lib/provider/comment.rb', line 50 def self.find_by_id(ticket_id, id) self.new COMMENT_API.new(ticket_id).comments(:comment_ids => [id]).first end |
Instance Method Details
#body ⇒ Object
30 31 32 |
# File 'lib/provider/comment.rb', line 30 def body self[:text] end |
#created_at ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/provider/comment.rb', line 34 def created_at begin normalize_datetime(self[:time]) rescue self[:created_at] end end |
#updated_at ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/provider/comment.rb', line 42 def updated_at begin normalize_datetime(self[:time]) rescue self[:updated_at] end end |