Class: TrackerIcal

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker-ical.rb

Class Method Summary collapse

Class Method Details

.create_calendar_for_project_id(project_id) ⇒ Object

Returns an ics formatted string of all the iterations and releases in the project If a release does not have a deadline, it will not be included in the output



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tracker-ical.rb', line 24

def self.create_calendar_for_project_id(project_id)
  project = PivotalTracker::Project.find(project_id)
  releases = project.stories.all(:story_type => 'release')
  calendar = Icalendar::Calendar.new
  iterations = project.iterations.all
  iterations.each do |iter|
    iteration_event(project,calendar,iter)
    # Retrieve the due_on value for each milestone & stip the time component
    #Retrieve the title of the milestone & set it to the summary
    #Retrieve the goals of the milestone & set it to the description
  end
  releases.each do |release|
    release_event(project,calendar,release)
  end
  calendar.publish
  return calendar.to_ical
end

.create_ics_file_for_project_id(filepath, project_id) ⇒ Object

Creates an ics file at the specified filepath containing the iterations and releases with deadlines for the project_id



43
44
45
46
47
# File 'lib/tracker-ical.rb', line 43

def self.create_ics_file_for_project_id(filepath,project_id)
  file = File.new(filepath,"w+")
  file.write(self.create_calendar_for_project_id(project_id))
  file.close
end

.token(username, password) ⇒ Object

Retrieves the PivotalTracker token for a given username and password, enabling further interaction with the Pivotal API



18
19
20
# File 'lib/tracker-ical.rb', line 18

def self.token(username,password)
  PivotalTracker::Client.token(username,password)
end

.token=(token) ⇒ Object

Set the PivotalTracker token to be used for interating with the Pivotal API



8
9
10
# File 'lib/tracker-ical.rb', line 8

def self.token=(token)
  PivotalTracker::Client.token=token
end

.use_ssl=(ssl = true) ⇒ Object

Set if PivotalTracker API should be accessed via SSL for all requests



13
14
15
# File 'lib/tracker-ical.rb', line 13

def self.use_ssl=(ssl=true)
  PivotalTracker::Client.use_ssl = ssl  
end