Class: TaskMapper::Provider::Jira::Project

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

Overview

Project class for taskmapper-jira

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*object) ⇒ Project

API = Jira::Project # The class to access the api’s projects declare needed overloaded methods here copy from this.copy(that) copies that into this



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

def initialize(*object)
  if object.first
    object = object.first
    unless object.is_a? Hash
      @system_data = {:client => object}
      hash = {:id => object.id.to_i, 
              :name => object.name,
              :description => object.description,
              :updated_at => nil,
              :created_at => nil}
    else
      hash = object
    end
    super(hash)
  end
end

Class Method Details

.find_allObject



45
46
47
48
49
# File 'lib/provider/project.rb', line 45

def self.find_all
  $jira.getProjectsNoSchemes().map do |project| 
    Project.new project 
  end
end

.find_by_attributes(attributes = {}) ⇒ Object



41
42
43
# File 'lib/provider/project.rb', line 41

def self.find_by_attributes(attributes = {})
  search_by_attribute(self.find_all, attributes)
end

.find_by_id(id) ⇒ Object



51
52
53
# File 'lib/provider/project.rb', line 51

def self.find_by_id(id)
  self.find_all.select { |project| project.id == id }.first
end

Instance Method Details

#copy(project) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/provider/project.rb', line 31

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

#idObject



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

def id
  self[:id].to_i
end