pivotal-tracker 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,5 +3,7 @@
3
3
  coverage
4
4
  rdoc
5
5
  pkg
6
-
6
+ vendor
7
7
  .bundle
8
+ .idea
9
+ request_test.rb
data/Gemfile CHANGED
@@ -1,16 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  group :runtime do
4
- gem 'rest-client', '~> 1.5.1'
5
- gem 'happymapper', '>= 0.2.4'
4
+ gem 'rest-client', '~> 1.6.0'
5
+ gem 'happymapper', '>= 0.3.2'
6
6
  gem 'builder'
7
- gem 'nokogiri', '~> 1.4.1'
7
+ gem 'nokogiri', '~> 1.4.3.1'
8
8
  end
9
9
 
10
10
  group :test do
11
- gem 'rspec', :require => 'spec'
11
+ gem 'rspec', '~> 1.3.0', :require => 'spec'
12
12
  gem 'rake'
13
- gem 'bundler', '~> 0.9.5'
14
13
  gem 'jeweler'
15
14
  gem 'stale_fish', '~> 1.3.0'
16
15
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (2.3.8)
5
+ builder (2.1.2)
6
+ fakeweb (1.2.8)
7
+ gemcutter (0.6.1)
8
+ git (1.2.5)
9
+ happymapper (0.3.2)
10
+ libxml-ruby (~> 1.1.3)
11
+ jeweler (1.4.0)
12
+ gemcutter (>= 0.1.0)
13
+ git (>= 1.2.5)
14
+ rubyforge (>= 2.0.0)
15
+ json_pure (1.4.5)
16
+ libxml-ruby (1.1.4)
17
+ mime-types (1.16)
18
+ nokogiri (1.4.3.1)
19
+ rake (0.8.7)
20
+ rest-client (1.6.0)
21
+ mime-types (>= 1.16)
22
+ rspec (1.3.0)
23
+ rubyforge (2.0.4)
24
+ json_pure (>= 1.1.7)
25
+ stale_fish (1.3.0)
26
+ activesupport
27
+ fakeweb
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ builder
34
+ happymapper (>= 0.3.2)
35
+ jeweler
36
+ nokogiri (~> 1.4.3.1)
37
+ rake
38
+ rest-client (~> 1.6.0)
39
+ rspec (~> 1.3.0)
40
+ stale_fish (~> 1.3.0)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Justin Smestad, Josh Nichols
1
+ Copyright (c) 2009 Justin Smestad
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -2,10 +2,6 @@
2
2
 
3
3
  Ruby wrapper for Pivotal Tracker API, no frameworks required. Simply Ruby.
4
4
 
5
- == Note
6
-
7
- Version 0.0.8 and above are incompatible with previous versions.
8
-
9
5
  == Features
10
6
 
11
7
  * Compatible with Pivotal Tracker API version 3
@@ -16,26 +12,39 @@ Version 0.0.8 and above are incompatible with previous versions.
16
12
 
17
13
  PivotalTracker::Client.token('myusername@email.com', 'secretpassword') # Automatically fetch API Token
18
14
  PivotalTracker::Client.token = 'jkfduisj97823974j2kl24899234' # Manually set API Token
19
-
15
+
20
16
  @projects = PivotalTracker::Project.all # return all projects
21
17
  @a_project = PivotalTracker::Project.find(84739) # find project with a given ID
22
-
18
+
23
19
  @a_project.stories.all # return all stories for "a_project"
24
20
  @a_project.stories.all(:label => 'overdue', :story_type => ['bug', 'chore']) # return all stories that match the passed filters
25
21
  @a_project.stories.find(847762630) # find story with a given ID
26
-
22
+
27
23
  @a_project.stories.create(:name => 'My Story', :story_type => 'feature') # create a story for this project
28
24
 
25
+ # all tracker defined filters are allowed, as well as :limit & :offset for pagination
26
+
27
+ # The below pattern below is planned to be added to the final release:
28
+
29
+ @a_project.stories << PivotalTracker::Story.new(84739, :name => 'Ur Story') # same as earlier story creation, useful for copying/cloning from proj
30
+
31
+
29
32
  @story = @a_project.stories.find(847762630)
30
33
  @story.notes.all # return all notes (comments) for a story
31
- @story.notes.create(:text => 'A new coment', :noted_at => '06/29/2010 05:00 EST') # add a new story
32
-
34
+ @story.notes.create(:text => 'A new comment', :noted_at => '06/29/2010 05:00 EST') # add a new note
33
35
 
34
- # all tracker defined filters are allowed, as well as :limit & :offset for pagination
35
36
 
36
- # The below are planned to be added to the final release:
37
+ @story.attachments # return an array of all attachment items (data only, not the files)
38
+ @story.upload_attachment(file_path) # add a file attachment to @story that can be found at file_path
39
+
40
+
41
+ # All 4 examples below return a PivotalTracker::Story from the new project, with the same story ID
42
+
43
+ @story.move_to_project(123456) # move @story to the project with ID 123456
44
+ @story.move_to_project('123456') # same as above
45
+ @story.move_to_project(@project) # move @story to @project
46
+ @story.move_to_project(@another_story) # move @story into the same project as @another_story
37
47
 
38
- @a_project.stories << PivotalTracker::Story.new(84739, :name => 'Ur Story') # same as above, useful for copying/cloning from proj
39
48
 
40
49
 
41
50
  The API is based on the following this gist: http://gist.github.com/283120
@@ -52,14 +61,17 @@ The API is based on the following this gist: http://gist.github.com/283120
52
61
  $ cd pivotal-tracker
53
62
  $ bundle install
54
63
  $ bundle exec rake
55
-
64
+
56
65
  == Additional Information
57
66
 
58
- Wiki: http://wiki.github.com/jsmestad/pivotal-tracker
59
- Documentation: http://rdoc.info/projects/jsmestad/pivotal-tracker
67
+ * Wiki: http://wiki.github.com/jsmestad/pivotal-tracker
68
+ * Documentation: http://rdoc.info/projects/jsmestad/pivotal-tracker
69
+ * Pivotal API v3 Docs: http://www.pivotaltracker.com/help/api?version=v3
60
70
 
61
- == Contributers
71
+ == Contributors along the way
62
72
 
63
73
  * Justin Smestad (http://github.com/jsmestad)
64
74
  * Josh Nichols (http://github.com/technicalpickles)
65
75
  * Terence Lee (http://github.com/hone)
76
+ * Jon Mischo (http://github.com/supertaz)
77
+ * Gabor Ratky (http://github.com/rgabo)
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rake'
2
- require 'bundler'
3
2
 
4
3
  begin
5
4
  require 'jeweler'
@@ -10,11 +9,15 @@ begin
10
9
  gem.homepage = "http://github.com/jsmestad/pivotal-tracker"
11
10
  gem.authors = ["Justin Smestad", "Josh Nichols", "Terence Lee"]
12
11
 
13
- bundle = Bundler::Definition.from_gemfile('Gemfile')
14
- bundle.dependencies.each do |dep|
15
- next unless dep.groups.include?(:runtime)
16
- gem.add_dependency(dep.name, dep.requirement.to_s)
17
- end
12
+ gem.add_dependency 'rest-client', '~> 1.6.0'
13
+ gem.add_dependency 'happymapper', '>= 0.3.2'
14
+ gem.add_dependency 'builder'
15
+ gem.add_dependency 'nokogiri', '~> 1.4.3.1'
16
+
17
+ gem.add_development_dependency 'rspec'
18
+ gem.add_development_dependency 'bundler', '>= 0.9.26'
19
+ gem.add_development_dependency 'jeweler'
20
+ gem.add_development_dependency 'stale_fish', '~> 1.3.0'
18
21
  end
19
22
  Jeweler::GemcutterTasks.new
20
23
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -0,0 +1,16 @@
1
+ module PivotalTracker
2
+ class Attachment
3
+ include HappyMapper
4
+
5
+ tag 'attachment'
6
+
7
+ element :id, Integer
8
+ element :filename, String
9
+ element :description, String
10
+ element :uploaded_by, String
11
+ element :uploaded_at, DateTime
12
+ element :url, String
13
+ element :status, String
14
+
15
+ end
16
+ end
@@ -18,6 +18,7 @@ module PivotalTracker
18
18
 
19
19
  element :id, Integer
20
20
  element :name, String
21
+ element :account, String
21
22
  element :week_start_day, String
22
23
  element :point_scale, String
23
24
  element :week_start_day, String
@@ -26,6 +27,7 @@ module PivotalTracker
26
27
  element :initial_velocity, Integer
27
28
  element :current_velocity, Integer
28
29
  element :last_activity_at, DateTime
30
+ element :use_https, Boolean
29
31
 
30
32
  def activities
31
33
  @activities ||= Proxy.new(self, Activity)
@@ -43,5 +45,14 @@ module PivotalTracker
43
45
  @memberships ||= Proxy.new(self, Membership)
44
46
  end
45
47
 
48
+ def iteration(group)
49
+ case group.to_sym
50
+ when :done: Iteration.done(self)
51
+ when :current: Iteration.current(self)
52
+ when :backlog: Iteration.backlog(self)
53
+ else
54
+ raise ArgumentError, "Invalid group. Use :done, :current or :backlog instead."
55
+ end
56
+ end
46
57
  end
47
58
  end
@@ -11,12 +11,13 @@ module PivotalTracker
11
11
  end
12
12
  end
13
13
 
14
- attr_accessor :project_id
14
+ tag "story"
15
15
 
16
16
  element :id, Integer
17
- element :url, String
17
+ element :url, String
18
18
  element :created_at, DateTime
19
19
  element :accepted_at, DateTime
20
+ element :project_id, Integer
20
21
 
21
22
  element :name, String
22
23
  element :description, String
@@ -29,10 +30,14 @@ module PivotalTracker
29
30
  element :jira_id, Integer
30
31
  element :jira_url, String
31
32
  element :other_id, Integer
33
+ element :integration_id, Integer
32
34
 
33
- def initialize(attributes={})
34
- self.project_id = attributes.delete(:owner).id if attributes[:owner]
35
+ has_many :attachments, Attachment, :tag => 'attachments'
35
36
 
37
+ def initialize(attributes={})
38
+ if attributes[:owner]
39
+ self.project_id = attributes.delete(:owner).id
40
+ end
36
41
  update_attributes(attributes)
37
42
  end
38
43
 
@@ -62,8 +67,34 @@ module PivotalTracker
62
67
  @tasks ||= Proxy.new(self, Task)
63
68
  end
64
69
 
65
- def project=(proj_id)
66
- self.project_id = proj_id
70
+ def upload_attachment(filename)
71
+ Attachment.parse(Client.connection["/projects/#{project_id}/stories/#{id}/attachments"].post(:Filedata => File.new(filename)))
72
+ end
73
+
74
+ def move_to_project(new_project)
75
+ move = true
76
+ old_project_id = self.project_id
77
+ target_project = -1
78
+ case new_project.class.to_s
79
+ when 'PivotalTracker::Story'
80
+ target_project = new_project.project_id
81
+ when 'PivotalTracker::Project'
82
+ target_project = new_project.id
83
+ when 'String'
84
+ target_project = new_project.to_i
85
+ when 'Fixnum', 'Integer'
86
+ target_project = new_project
87
+ else
88
+ move = false
89
+ end
90
+ if move
91
+ move_builder = Nokogiri::XML::Builder.new do |story|
92
+ story.story {
93
+ story.project_id "#{target_project}"
94
+ }
95
+ end
96
+ Story.parse(Client.connection["/projects/#{old_project_id}/stories/#{id}"].put(move_builder.to_xml, :content_type => 'application/xml'))
97
+ end
67
98
  end
68
99
 
69
100
  protected
@@ -79,10 +110,12 @@ module PivotalTracker
79
110
  xml.requested_by "#{requested_by}"
80
111
  xml.owned_by "#{owned_by}"
81
112
  xml.labels "#{labels}"
113
+ xml.project_id "#{project_id}"
82
114
  # See spec
83
115
  # xml.jira_id "#{jira_id}"
84
116
  # xml.jira_url "#{jira_url}"
85
117
  xml.other_id "#{other_id}"
118
+ xml.integration_id "#{integration_id}"
86
119
  }
87
120
  end
88
121
  return builder.to_xml
@@ -8,6 +8,7 @@ require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'extensions')
8
8
  require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'proxy')
9
9
  require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'client')
10
10
  require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'project')
11
+ require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'attachment')
11
12
  require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'story')
12
13
  require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'task')
13
14
  require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'membership')
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pivotal-tracker}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Smestad", "Josh Nichols", "Terence Lee"]
12
- s.date = %q{2010-07-05}
12
+ s.date = %q{2010-08-07}
13
13
  s.email = %q{justin.smestad@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -18,12 +18,14 @@ Gem::Specification.new do |s|
18
18
  s.files = [
19
19
  ".gitignore",
20
20
  "Gemfile",
21
+ "Gemfile.lock",
21
22
  "LICENSE",
22
23
  "README.rdoc",
23
24
  "Rakefile",
24
25
  "VERSION",
25
26
  "lib/pivotal-tracker.rb",
26
27
  "lib/pivotal-tracker/activity.rb",
28
+ "lib/pivotal-tracker/attachment.rb",
27
29
  "lib/pivotal-tracker/client.rb",
28
30
  "lib/pivotal-tracker/extensions.rb",
29
31
  "lib/pivotal-tracker/iteration.rb",
@@ -54,6 +56,7 @@ Gem::Specification.new do |s|
54
56
  "spec/spec_helper.rb",
55
57
  "spec/support/stale_fish_fixtures.rb",
56
58
  "spec/unit/pivotal-tracker/activity_spec.rb",
59
+ "spec/unit/pivotal-tracker/attachment_spec.rb",
57
60
  "spec/unit/pivotal-tracker/iteration_spec.rb",
58
61
  "spec/unit/pivotal-tracker/membership_spec.rb",
59
62
  "spec/unit/pivotal-tracker/note_spec.rb",
@@ -64,12 +67,13 @@ Gem::Specification.new do |s|
64
67
  s.homepage = %q{http://github.com/jsmestad/pivotal-tracker}
65
68
  s.rdoc_options = ["--charset=UTF-8"]
66
69
  s.require_paths = ["lib"]
67
- s.rubygems_version = %q{1.3.6}
70
+ s.rubygems_version = %q{1.3.7}
68
71
  s.summary = %q{Ruby wrapper for the Pivotal Tracker API}
69
72
  s.test_files = [
70
73
  "spec/spec_helper.rb",
71
74
  "spec/support/stale_fish_fixtures.rb",
72
75
  "spec/unit/pivotal-tracker/activity_spec.rb",
76
+ "spec/unit/pivotal-tracker/attachment_spec.rb",
73
77
  "spec/unit/pivotal-tracker/iteration_spec.rb",
74
78
  "spec/unit/pivotal-tracker/membership_spec.rb",
75
79
  "spec/unit/pivotal-tracker/note_spec.rb",
@@ -82,22 +86,34 @@ Gem::Specification.new do |s|
82
86
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
83
87
  s.specification_version = 3
84
88
 
85
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
86
- s.add_runtime_dependency(%q<rest-client>, ["~> 1.5.1"])
87
- s.add_runtime_dependency(%q<happymapper>, [">= 0.2.4"])
89
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
90
+ s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.0"])
91
+ s.add_runtime_dependency(%q<happymapper>, [">= 0.3.2"])
88
92
  s.add_runtime_dependency(%q<builder>, [">= 0"])
89
- s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4.1"])
93
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
94
+ s.add_development_dependency(%q<rspec>, [">= 0"])
95
+ s.add_development_dependency(%q<bundler>, [">= 0.9.26"])
96
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
97
+ s.add_development_dependency(%q<stale_fish>, ["~> 1.3.0"])
90
98
  else
91
- s.add_dependency(%q<rest-client>, ["~> 1.5.1"])
92
- s.add_dependency(%q<happymapper>, [">= 0.2.4"])
99
+ s.add_dependency(%q<rest-client>, ["~> 1.6.0"])
100
+ s.add_dependency(%q<happymapper>, [">= 0.3.2"])
93
101
  s.add_dependency(%q<builder>, [">= 0"])
94
- s.add_dependency(%q<nokogiri>, ["~> 1.4.1"])
102
+ s.add_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
103
+ s.add_dependency(%q<rspec>, [">= 0"])
104
+ s.add_dependency(%q<bundler>, [">= 0.9.26"])
105
+ s.add_dependency(%q<jeweler>, [">= 0"])
106
+ s.add_dependency(%q<stale_fish>, ["~> 1.3.0"])
95
107
  end
96
108
  else
97
- s.add_dependency(%q<rest-client>, ["~> 1.5.1"])
98
- s.add_dependency(%q<happymapper>, [">= 0.2.4"])
109
+ s.add_dependency(%q<rest-client>, ["~> 1.6.0"])
110
+ s.add_dependency(%q<happymapper>, [">= 0.3.2"])
99
111
  s.add_dependency(%q<builder>, [">= 0"])
100
- s.add_dependency(%q<nokogiri>, ["~> 1.4.1"])
112
+ s.add_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
113
+ s.add_dependency(%q<rspec>, [">= 0"])
114
+ s.add_dependency(%q<bundler>, [">= 0.9.26"])
115
+ s.add_dependency(%q<jeweler>, [">= 0"])
116
+ s.add_dependency(%q<stale_fish>, ["~> 1.3.0"])
101
117
  end
102
118
  end
103
119