Class: PivotalTracker

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

Instance Method Summary collapse

Constructor Details

#initialize(project_id, token, options = {}) ⇒ PivotalTracker

Returns a new instance of PivotalTracker.



18
19
20
21
22
23
# File 'lib/pivotal-tracker.rb', line 18

def initialize(project_id, token, options = {})
  @project_id, @token = project_id, token

  @base_url = "http://www.pivotaltracker.com/services/v2" 
  @base_url.gsub! 'http', 'https'  if options[:use_ssl]
end

Instance Method Details

#create_story(story) ⇒ Object



51
52
53
# File 'lib/pivotal-tracker.rb', line 51

def create_story(story)
  stories_resource.post story.to_xml
end

#delete_story(story) ⇒ Object



59
60
61
# File 'lib/pivotal-tracker.rb', line 59

def delete_story(story)
  story_resource(story).delete
end

#deliver_all_finished_storiesObject



63
64
65
66
# File 'lib/pivotal-tracker.rb', line 63

def deliver_all_finished_stories
  response = stories_resource['/deliver_all_finished'].put ''
  Story.parse(response)
end

#find(*filters) ⇒ Object



40
41
42
43
44
# File 'lib/pivotal-tracker.rb', line 40

def find(*filters)
  filter_query = CGI::escape coerce_to_filter(filters)
  response = stories_resource["?filter=#{filter_query}"].get
  Story.parse(response)
end

#find_story(id) ⇒ Object



46
47
48
49
# File 'lib/pivotal-tracker.rb', line 46

def find_story(id)
  response = story_resource(id).get
  Story.parse(response).first
end

#iterationsObject



35
36
37
38
# File 'lib/pivotal-tracker.rb', line 35

def iterations
  response = iterations_resource.get
  Iteration.parse(response)
end

#projectObject



25
26
27
28
# File 'lib/pivotal-tracker.rb', line 25

def project
  response = project_resource.get
  Project.parse(response).first
end

#storiesObject



30
31
32
33
# File 'lib/pivotal-tracker.rb', line 30

def stories
  response = stories_resource.get
  Story.parse(response)
end

#update_story(story) ⇒ Object



55
56
57
# File 'lib/pivotal-tracker.rb', line 55

def update_story(story)
  story_resource(story).put story.to_xml
end