Class: TaskMapper::Provider::Unfuddle::Project

Inherits:
Base::Project
  • Object
show all
Defined in:
lib/provider/project.rb

Overview

Project class for taskmapper-unfuddle

Constant Summary collapse

API =

The class to access the api’s projects

UnfuddleAPI::Project

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Project

declare needed overloaded methods here



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/provider/project.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)
  end
end

Instance Method Details

#copy(project) ⇒ Object

copy from this.copy(that) copies that into this



36
37
38
39
40
41
42
43
44
# File 'lib/provider/project.rb', line 36

def copy(project)
  project.tickets.each do |ticket|
    copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
    ticket.comments.each do |comment|
      copy_ticket.comment!(:body => comment.body)
      sleep 1
    end
  end
end

#created_atObject



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

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

#nameObject



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

def name
  self.title
end

#updated_atObject



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

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