Class: TaskMapper::Provider::Unfuddle::Ticket

Inherits:
Base::Ticket
  • Object
show all
Defined in:
lib/provider/ticket.rb

Overview

Ticket class for taskmapper-unfuddle

Constant Summary collapse

API =

The class to access the api’s tickets

UnfuddleAPI::Ticket

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Ticket

declare needed overloaded methods here



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/provider/ticket.rb', line 10

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]
  end
end

Instance Method Details

#assigneeObject



35
36
37
38
39
40
41
# File 'lib/provider/ticket.rb', line 35

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

#created_atObject



27
28
29
# File 'lib/provider/ticket.rb', line 27

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

#requestorObject



43
44
45
46
47
48
49
# File 'lib/provider/ticket.rb', line 43

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

#titleObject



23
24
25
# File 'lib/provider/ticket.rb', line 23

def title
  self.summary
end

#updated_atObject



31
32
33
# File 'lib/provider/ticket.rb', line 31

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