Sha256: 486c07bad4c1d3002c9c18ccd23d344b27aaa85c6d9f923f3238cfcd1c12957c
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 KB
Contents
module TaskMapper::Provider module Bugzilla # The comment class for taskmapper-bugzilla # # Do any mapping between TaskMapper and your system's comment model here # versions of the ticket. # COMMENT_API = Rubyzilla::Bug class Comment < TaskMapper::Provider::Base::Comment # declare needed overloaded methods here 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 def body self[:text] end def created_at begin normalize_datetime(self[:time]) rescue self[:created_at] end end def updated_at begin normalize_datetime(self[:time]) rescue self[:updated_at] end end def self.find_by_id(ticket_id, id) self.new COMMENT_API.new(ticket_id).comments(:comment_ids => [id]).first end def self.find(ticket_id, *options) if options.first.empty? COMMENT_API.new(ticket_id).comments.collect { |comment| self.new comment } elsif options[0].first.is_a? Array COMMENT_API.new(ticket_id).comments(:comment_ids => options[0].first).collect { |comment| self.new comment } end end private def normalize_datetime(datetime) Time.mktime(datetime.year, datetime.month, datetime.day, datetime.hour, datetime.min, datetime.sec) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
taskmapper-bugzilla-0.4.0 | lib/provider/comment.rb |
taskmapper-bugzilla-0.3.0 | lib/provider/comment.rb |