Class: TaskMapper::Provider::Unfuddle::Comment

Inherits:
Base::Comment
  • Object
show all
Defined in:
lib/provider/comment.rb

Overview

The comment class for taskmapper-unfuddle

Do any mapping between TaskMapper and your system’s comment model here versions of the ticket.

Constant Summary collapse

API =

The class to access the api’s comments

UnfuddleAPI::Comment

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Comment

declare needed overloaded methods here



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/provider/comment.rb', line 12

def initialize(*options) 
  @system_data ||= {}
  @cache ||= {}
  first = options.shift
  case first
  when Hash
    super first.to_hash
  else
    @system_data[:client] = first
    super first.attributes.merge!(
                :project_id => first.prefix_options[:project_id],
                :ticket_id => first.prefix_options[:ticket_id])
  end
end

Instance Method Details

#authorObject



27
28
29
30
31
32
33
# File 'lib/provider/comment.rb', line 27

def author
  @author ||= begin
    UnfuddleAPI::People.find(self[:author_id]).username
    rescue
    ''
    end
end

#created_atObject



35
36
37
# File 'lib/provider/comment.rb', line 35

def created_at
  @created_at ||= self[:created_at] ? Time.parse(self[:created_at]) : nil
end

#updated_atObject



39
40
41
# File 'lib/provider/comment.rb', line 39

def updated_at
  @updated_at ||= self[:updated_at] ? Time.parse(self[:updated_at]) : nil
end