hone-pivotal-tracker 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README +13 -0
- data/Rakefile +58 -0
- data/VERSION +1 -0
- data/lib/pivotal-tracker/extensions.rb +12 -0
- data/lib/pivotal-tracker/iteration.rb +7 -0
- data/lib/pivotal-tracker/project.rb +8 -0
- data/lib/pivotal-tracker/story.rb +36 -0
- data/lib/pivotal-tracker.rb +113 -0
- data/pivotal-tracker.gemspec +59 -0
- data/test/extensions_test.rb +19 -0
- data/test/pivotal_tracker_test.rb +9 -0
- data/test/test_helper.rb +11 -0
- metadata +92 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Josh Nichols
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Ruby Pivotal Tracker
|
2
|
+
http://www.evalcode.com
|
3
|
+
|
4
|
+
=========================
|
5
|
+
Notes
|
6
|
+
=========================
|
7
|
+
There are a few areas that need to be modified in order for this code to work correctly.
|
8
|
+
You must set the Token key in the initialize method as well as project_id.
|
9
|
+
|
10
|
+
=========================
|
11
|
+
Contributers
|
12
|
+
=========================
|
13
|
+
Justin Smestad
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "pivotal-tracker"
|
8
|
+
gem.summary = %Q{Ruby wrapper for the Pivotal Tracker API}
|
9
|
+
gem.email = "justin.smestad@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/jsmestad/pivotal-tracker"
|
11
|
+
gem.authors = ["Justin Smestad", "Josh Nichols"]
|
12
|
+
gem.add_dependency "rest-client"
|
13
|
+
gem.add_dependency "happymapper", ">= 0.2.4"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/*_test.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/*_test.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
task :rcov do
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rake/rdoctask'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
if File.exist?('VERSION.yml')
|
47
|
+
config = YAML.load(File.read('VERSION.yml'))
|
48
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
49
|
+
else
|
50
|
+
version = ""
|
51
|
+
end
|
52
|
+
|
53
|
+
rdoc.rdoc_dir = 'rdoc'
|
54
|
+
rdoc.title = "ruby-pivotal-tracker #{version}"
|
55
|
+
rdoc.rdoc_files.include('README*')
|
56
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
57
|
+
end
|
58
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.3
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Story
|
2
|
+
include HappyMapper
|
3
|
+
element :id, Integer
|
4
|
+
element :story_type, String
|
5
|
+
element :url, String
|
6
|
+
element :estimate, Integer
|
7
|
+
# possible states: unscheduled, unstarted, started, finished, accepted, rejected
|
8
|
+
element :current_state, String
|
9
|
+
element :name, String
|
10
|
+
element :requested_by, String
|
11
|
+
element :owned_by, String
|
12
|
+
element :created_at, DateTime
|
13
|
+
element :accepted_at, DateTime
|
14
|
+
element :labels, String
|
15
|
+
has_one :iteration, Iteration
|
16
|
+
|
17
|
+
def initialize(attributes = {})
|
18
|
+
attributes.each do |key, value|
|
19
|
+
send("#{key}=", value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_xml(options = {})
|
24
|
+
builder = Builder::XmlMarkup.new(options)
|
25
|
+
builder.story do |story|
|
26
|
+
Story.elements.each do |element_type|
|
27
|
+
element = send(element_type.name)
|
28
|
+
eval("story.#{element_type.name}('#{element.to_s}')") if element
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_param
|
34
|
+
id.to_s
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'restclient'
|
2
|
+
require 'happymapper'
|
3
|
+
require 'builder'
|
4
|
+
require 'cgi'
|
5
|
+
|
6
|
+
|
7
|
+
# initial definition, to avoid circular dependencies when declaring happymappings
|
8
|
+
class Story; end
|
9
|
+
class Iteration; end
|
10
|
+
class Project; end
|
11
|
+
|
12
|
+
require 'pivotal-tracker/extensions'
|
13
|
+
require 'pivotal-tracker/project'
|
14
|
+
require 'pivotal-tracker/story'
|
15
|
+
require 'pivotal-tracker/iteration'
|
16
|
+
|
17
|
+
class PivotalTracker
|
18
|
+
def initialize(project_id, token, options = {})
|
19
|
+
@project_id, @token = project_id, token
|
20
|
+
|
21
|
+
@base_url = "http://www.pivotaltracker.com/services/v2"
|
22
|
+
@base_url.gsub! 'http', 'https' if options[:use_ssl]
|
23
|
+
end
|
24
|
+
|
25
|
+
def project
|
26
|
+
response = project_resource.get
|
27
|
+
Project.parse(response)
|
28
|
+
end
|
29
|
+
|
30
|
+
def stories
|
31
|
+
response = stories_resource.get
|
32
|
+
Story.parse(response)
|
33
|
+
end
|
34
|
+
|
35
|
+
def current_iteration
|
36
|
+
response = iterations_resource("/current").get
|
37
|
+
Iteration.parse(response).first
|
38
|
+
end
|
39
|
+
|
40
|
+
def iterations
|
41
|
+
response = iterations_resource.get
|
42
|
+
Iteration.parse(response)
|
43
|
+
end
|
44
|
+
|
45
|
+
def find(*filters)
|
46
|
+
filter_query = CGI::escape coerce_to_filter(filters)
|
47
|
+
response = stories_resource["?filter=#{filter_query}"].get
|
48
|
+
Story.parse(response)
|
49
|
+
end
|
50
|
+
|
51
|
+
def find_story(id)
|
52
|
+
response = story_resource(id).get
|
53
|
+
Story.parse(response).first
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_story(story)
|
57
|
+
stories_resource.post story.to_xml
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_story(story)
|
61
|
+
story_resource(story).put story.to_xml
|
62
|
+
end
|
63
|
+
|
64
|
+
def delete_story(story)
|
65
|
+
story_resource(story).delete
|
66
|
+
end
|
67
|
+
|
68
|
+
def deliver_all_finished_stories
|
69
|
+
response = stories_resource['/deliver_all_finished'].put ''
|
70
|
+
Story.parse(response)
|
71
|
+
end
|
72
|
+
|
73
|
+
protected
|
74
|
+
|
75
|
+
def projects_resource
|
76
|
+
RestClient::Resource.new "#{@base_url}/projects",
|
77
|
+
:headers => {
|
78
|
+
'X-TrackerToken' => @token,
|
79
|
+
'Content-Type' => 'application/xml'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
def project_resource(project = @project_id)
|
84
|
+
projects_resource["/#{@project_id}"]
|
85
|
+
end
|
86
|
+
|
87
|
+
def iterations_resource(specific_iteration = "")
|
88
|
+
project_resource["/iterations#{specific_iteration}"]
|
89
|
+
end
|
90
|
+
|
91
|
+
def stories_resource
|
92
|
+
project_resource['/stories']
|
93
|
+
end
|
94
|
+
|
95
|
+
def story_resource(story)
|
96
|
+
stories_resource["/#{story.to_param}"]
|
97
|
+
end
|
98
|
+
|
99
|
+
def coerce_to_filter(object)
|
100
|
+
case object
|
101
|
+
when String, Integer,NilClass
|
102
|
+
object.to_s.inspect
|
103
|
+
when Hash
|
104
|
+
object.collect do |key, value|
|
105
|
+
"#{key}:#{coerce_to_filter(value)}"
|
106
|
+
end.join(' ')
|
107
|
+
when Array
|
108
|
+
object.collect do |each|
|
109
|
+
coerce_to_filter(each)
|
110
|
+
end.join(' ')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{pivotal-tracker}
|
5
|
+
s.version = "0.0.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Justin Smestad", "Josh Nichols", "Terence Lee"]
|
9
|
+
s.date = %q{2009-06-07}
|
10
|
+
s.email = %q{justin.smestad@gmail.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
18
|
+
"LICENSE",
|
19
|
+
"README",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"lib/pivotal-tracker.rb",
|
23
|
+
"lib/pivotal-tracker/extensions.rb",
|
24
|
+
"lib/pivotal-tracker/iteration.rb",
|
25
|
+
"lib/pivotal-tracker/project.rb",
|
26
|
+
"lib/pivotal-tracker/story.rb",
|
27
|
+
"pivotal-tracker.gemspec",
|
28
|
+
"test/extensions_test.rb",
|
29
|
+
"test/pivotal_tracker_test.rb",
|
30
|
+
"test/test_helper.rb"
|
31
|
+
]
|
32
|
+
s.has_rdoc = true
|
33
|
+
s.homepage = %q{http://github.com/jsmestad/pivotal-tracker}
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.1}
|
37
|
+
s.summary = %q{Ruby wrapper for the Pivotal Tracker API}
|
38
|
+
s.test_files = [
|
39
|
+
"test/extensions_test.rb",
|
40
|
+
"test/pivotal_tracker_test.rb",
|
41
|
+
"test/test_helper.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 2
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<happymapper>, [">= 0.2.4"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
53
|
+
s.add_dependency(%q<happymapper>, [">= 0.2.4"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
57
|
+
s.add_dependency(%q<happymapper>, [">= 0.2.4"])
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ExtensionTest < Test::Unit::TestCase
|
4
|
+
context String do
|
5
|
+
should "return the string for to_param" do
|
6
|
+
string = "my string!"
|
7
|
+
assert_same string, string.to_param
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context Integer do
|
12
|
+
should "return a string representation for to_param" do
|
13
|
+
integer = 5
|
14
|
+
assert_equal "5", integer.to_param
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hone-pivotal-tracker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Smestad
|
8
|
+
- Josh Nichols
|
9
|
+
- Terence Lee
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2009-06-07 00:00:00 -07:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rest-client
|
19
|
+
type: :runtime
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "0"
|
26
|
+
version:
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: happymapper
|
29
|
+
type: :runtime
|
30
|
+
version_requirement:
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.2.4
|
36
|
+
version:
|
37
|
+
description:
|
38
|
+
email: justin.smestad@gmail.com
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files:
|
44
|
+
- LICENSE
|
45
|
+
- README
|
46
|
+
files:
|
47
|
+
- .document
|
48
|
+
- .gitignore
|
49
|
+
- LICENSE
|
50
|
+
- README
|
51
|
+
- Rakefile
|
52
|
+
- VERSION
|
53
|
+
- lib/pivotal-tracker.rb
|
54
|
+
- lib/pivotal-tracker/extensions.rb
|
55
|
+
- lib/pivotal-tracker/iteration.rb
|
56
|
+
- lib/pivotal-tracker/project.rb
|
57
|
+
- lib/pivotal-tracker/story.rb
|
58
|
+
- pivotal-tracker.gemspec
|
59
|
+
- test/extensions_test.rb
|
60
|
+
- test/pivotal_tracker_test.rb
|
61
|
+
- test/test_helper.rb
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: http://github.com/jsmestad/pivotal-tracker
|
64
|
+
licenses:
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options:
|
67
|
+
- --charset=UTF-8
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.3.5
|
86
|
+
signing_key:
|
87
|
+
specification_version: 2
|
88
|
+
summary: Ruby wrapper for the Pivotal Tracker API
|
89
|
+
test_files:
|
90
|
+
- test/extensions_test.rb
|
91
|
+
- test/pivotal_tracker_test.rb
|
92
|
+
- test/test_helper.rb
|