topprospect-pivotal-tracker 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +40 -0
- data/LICENSE +20 -0
- data/README.rdoc +77 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/pivotal-tracker.rb +38 -0
- data/lib/pivotal-tracker/activity.rb +45 -0
- data/lib/pivotal-tracker/attachment.rb +16 -0
- data/lib/pivotal-tracker/client.rb +35 -0
- data/lib/pivotal-tracker/extensions.rb +11 -0
- data/lib/pivotal-tracker/iteration.rb +34 -0
- data/lib/pivotal-tracker/membership.rb +20 -0
- data/lib/pivotal-tracker/note.rb +58 -0
- data/lib/pivotal-tracker/project.rb +58 -0
- data/lib/pivotal-tracker/proxy.rb +66 -0
- data/lib/pivotal-tracker/story.rb +149 -0
- data/lib/pivotal-tracker/task.rb +53 -0
- data/lib/pivotal-tracker/validation.rb +68 -0
- data/lib/pivotal_tracker.rb +2 -0
- data/pivotal-tracker.gemspec +120 -0
- data/spec/fixtures/activity.xml +177 -0
- data/spec/fixtures/created_note.xml +14 -0
- data/spec/fixtures/created_story.xml +14 -0
- data/spec/fixtures/iterations_all.xml +237 -0
- data/spec/fixtures/iterations_backlog.xml +163 -0
- data/spec/fixtures/iterations_current.xml +47 -0
- data/spec/fixtures/iterations_done.xml +33 -0
- data/spec/fixtures/memberships.xml +42 -0
- data/spec/fixtures/notes.xml +33 -0
- data/spec/fixtures/project.xml +51 -0
- data/spec/fixtures/project_activity.xml +177 -0
- data/spec/fixtures/projects.xml +103 -0
- data/spec/fixtures/stale_fish.yml +100 -0
- data/spec/fixtures/stories.xml +293 -0
- data/spec/fixtures/tasks.xml +24 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/stale_fish_fixtures.rb +67 -0
- data/spec/unit/pivotal-tracker/activity_spec.rb +23 -0
- data/spec/unit/pivotal-tracker/attachment_spec.rb +62 -0
- data/spec/unit/pivotal-tracker/iteration_spec.rb +52 -0
- data/spec/unit/pivotal-tracker/membership_spec.rb +20 -0
- data/spec/unit/pivotal-tracker/note_spec.rb +61 -0
- data/spec/unit/pivotal-tracker/project_spec.rb +55 -0
- data/spec/unit/pivotal-tracker/story_spec.rb +185 -0
- data/spec/unit/pivotal-tracker/task_spec.rb +21 -0
- metadata +246 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
group :runtime do
|
4
|
+
gem 'rest-client', '~> 1.6.0'
|
5
|
+
gem 'happymapper', '>= 0.3.2'
|
6
|
+
gem 'builder'
|
7
|
+
gem 'nokogiri', '~> 1.4.3.1'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'rspec', '~> 1.3.0', :require => 'spec'
|
12
|
+
gem 'rake'
|
13
|
+
gem 'jeweler'
|
14
|
+
gem 'stale_fish', '~> 1.3.0'
|
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
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Justin Smestad
|
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.rdoc
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
= pivotal-tracker.rb
|
2
|
+
|
3
|
+
Ruby wrapper for Pivotal Tracker API, no frameworks required. Simply Ruby.
|
4
|
+
|
5
|
+
== Features
|
6
|
+
|
7
|
+
* Compatible with Pivotal Tracker API version 3
|
8
|
+
* ActiveRecord-style Wrapper API
|
9
|
+
* Support for SSL protected repositories
|
10
|
+
|
11
|
+
== Overview
|
12
|
+
|
13
|
+
PivotalTracker::Client.token('myusername@email.com', 'secretpassword') # Automatically fetch API Token
|
14
|
+
PivotalTracker::Client.token = 'jkfduisj97823974j2kl24899234' # Manually set API Token
|
15
|
+
|
16
|
+
@projects = PivotalTracker::Project.all # return all projects
|
17
|
+
@a_project = PivotalTracker::Project.find(84739) # find project with a given ID
|
18
|
+
|
19
|
+
@a_project.stories.all # return all stories for "a_project"
|
20
|
+
@a_project.stories.all(:label => 'overdue', :story_type => ['bug', 'chore']) # return all stories that match the passed filters
|
21
|
+
@a_project.stories.find(847762630) # find story with a given ID
|
22
|
+
|
23
|
+
@a_project.stories.create(:name => 'My Story', :story_type => 'feature') # create a story for this project
|
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
|
+
|
32
|
+
@story = @a_project.stories.find(847762630)
|
33
|
+
@story.notes.all # return all notes (comments) for a story
|
34
|
+
@story.notes.create(:text => 'A new comment', :noted_at => '06/29/2010 05:00 EST') # add a new note
|
35
|
+
|
36
|
+
|
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
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
The API is based on the following this gist: http://gist.github.com/283120
|
51
|
+
|
52
|
+
== Getting Started
|
53
|
+
|
54
|
+
* Installing:
|
55
|
+
|
56
|
+
$ gem install pivotal-tracker
|
57
|
+
|
58
|
+
* Contributing (requires Bundler >= 0.9.7):
|
59
|
+
|
60
|
+
$ git clone git://github.com/jsmestad/pivotal-tracker
|
61
|
+
$ cd pivotal-tracker
|
62
|
+
$ bundle install
|
63
|
+
$ bundle exec rake
|
64
|
+
|
65
|
+
== Additional Information
|
66
|
+
|
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
|
70
|
+
|
71
|
+
== Contributors along the way
|
72
|
+
|
73
|
+
* Justin Smestad (http://github.com/jsmestad)
|
74
|
+
* Josh Nichols (http://github.com/technicalpickles)
|
75
|
+
* Terence Lee (http://github.com/hone)
|
76
|
+
* Jon Mischo (http://github.com/supertaz)
|
77
|
+
* Gabor Ratky (http://github.com/rgabo)
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gem|
|
6
|
+
gem.name = "pivotal-tracker"
|
7
|
+
gem.summary = %Q{Ruby wrapper for the Pivotal Tracker API}
|
8
|
+
gem.email = "justin.smestad@gmail.com"
|
9
|
+
gem.homepage = "http://github.com/jsmestad/pivotal-tracker"
|
10
|
+
gem.authors = ["Justin Smestad", "Josh Nichols", "Terence Lee"]
|
11
|
+
|
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'
|
21
|
+
end
|
22
|
+
Jeweler::GemcutterTasks.new
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'spec/rake/spectask'
|
28
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
31
|
+
end
|
32
|
+
|
33
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
34
|
+
spec.libs << 'lib' << 'spec'
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
begin
|
42
|
+
require 'yard'
|
43
|
+
YARD::Rake::YardocTask.new
|
44
|
+
rescue LoadError
|
45
|
+
task :yardoc do
|
46
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.1
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'happymapper'
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'validation')
|
8
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'extensions')
|
9
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'proxy')
|
10
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'client')
|
11
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'project')
|
12
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'attachment')
|
13
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'story')
|
14
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'task')
|
15
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'membership')
|
16
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'activity')
|
17
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'iteration')
|
18
|
+
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'note')
|
19
|
+
|
20
|
+
module PivotalTracker
|
21
|
+
|
22
|
+
# define error types
|
23
|
+
class ProjectNotSpecified < StandardError; end
|
24
|
+
|
25
|
+
def self.encode_options(options)
|
26
|
+
options_strings = options.inject({}) do |m, (k,v)|
|
27
|
+
if [:limit, :offset].include?(k.to_sym)
|
28
|
+
m.update k => v
|
29
|
+
else
|
30
|
+
filter_query = %{#{k}:#{[v].flatten.join(",")}}
|
31
|
+
m.update :filter => (m[:filter] ? "#{m[:filter]} #{filter_query}" : filter_query)
|
32
|
+
end
|
33
|
+
end.map {|k,v| "#{k}=#{CGI.escape(v.to_s)}"}
|
34
|
+
|
35
|
+
%{?#{options_strings.join("&")}} unless options_strings.empty?
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
class Activity
|
3
|
+
include HappyMapper
|
4
|
+
class << self
|
5
|
+
def all(project=nil, options={})
|
6
|
+
params = self.encode_options(options)
|
7
|
+
if project
|
8
|
+
parse(Client.connection["/projects/#{project.id}/activities#{params}"].get)
|
9
|
+
else
|
10
|
+
parse(Client.connection["/activities#{params}"].get)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def encode_options(options)
|
17
|
+
return nil if !options.is_a?(Hash) || options.empty?
|
18
|
+
|
19
|
+
options_string = []
|
20
|
+
options_string << "limit=#{options.delete(:limit)}" if options[:limit]
|
21
|
+
options_string << "newer_than_version=#{options.delete(:newer_than_version)}" if options[:newer_than_version]
|
22
|
+
|
23
|
+
if options[:occurred_since]
|
24
|
+
options_string << "occurred_since_date=\"#{options[:occurred_since].utc}\""
|
25
|
+
elsif options[:occurred_since_date]
|
26
|
+
options_string << "occurred_since_date=\"#{options[:occurred_since_date]}\""
|
27
|
+
end
|
28
|
+
|
29
|
+
return "?#{options_string.join('&')}"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
element :id, Integer
|
35
|
+
element :version, Integer
|
36
|
+
element :event_type, String
|
37
|
+
element :occurred_at, DateTime
|
38
|
+
element :author, String
|
39
|
+
element :project_id, Integer
|
40
|
+
element :description, String
|
41
|
+
|
42
|
+
has_many :stories, Story
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -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
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
class Client
|
3
|
+
|
4
|
+
class << self
|
5
|
+
attr_writer :use_ssl, :token
|
6
|
+
|
7
|
+
def use_ssl
|
8
|
+
@use_ssl || false
|
9
|
+
end
|
10
|
+
|
11
|
+
def token(username, password, method='post')
|
12
|
+
return @token if @token
|
13
|
+
response = if method == 'post'
|
14
|
+
RestClient.post 'https://www.pivotaltracker.com/services/v3/tokens/active', :username => username, :password => password
|
15
|
+
else
|
16
|
+
RestClient.get "https://#{username}:#{password}@www.pivotaltracker.com/services/v3/tokens/active"
|
17
|
+
end
|
18
|
+
@token= Nokogiri::XML(response.body).search('guid').inner_html
|
19
|
+
end
|
20
|
+
|
21
|
+
# this is your connection for the entire module
|
22
|
+
def connection(options={})
|
23
|
+
@connection ||= RestClient::Resource.new("#{protocol}://www.pivotaltracker.com/services/v3", :headers => {'X-TrackerToken' => @token, 'Content-Type' => 'application/xml'})
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def protocol
|
29
|
+
use_ssl ? 'https' : 'http'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Happymapper patch for RestClient API Change (response => response.body)
|
2
|
+
|
3
|
+
module HappyMapper
|
4
|
+
module ClassMethods
|
5
|
+
alias_method :orig_parse, :parse
|
6
|
+
def parse(xml, options={})
|
7
|
+
xml = xml.to_s if xml.is_a?(RestClient::Response)
|
8
|
+
orig_parse(xml, options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
class Iteration
|
3
|
+
include HappyMapper
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def all(project, options={})
|
7
|
+
params = PivotalTracker.encode_options(options)
|
8
|
+
parse(Client.connection["/projects/#{project.id}/iterations#{params}"].get)
|
9
|
+
end
|
10
|
+
|
11
|
+
def current(project)
|
12
|
+
array = parse(Client.connection["projects/#{project.id}/iterations/current"].get)
|
13
|
+
array.first if array
|
14
|
+
end
|
15
|
+
|
16
|
+
def done(project, options={})
|
17
|
+
params = PivotalTracker.encode_options(options)
|
18
|
+
parse(Client.connection["/projects/#{project.id}/iterations/done#{params}"].get)
|
19
|
+
end
|
20
|
+
|
21
|
+
def backlog(project, options={})
|
22
|
+
params = PivotalTracker.encode_options(options)
|
23
|
+
parse(Client.connection["/projects/#{project.id}/iterations/backlog#{params}"].get)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
element :id, Integer
|
28
|
+
element :number, Integer
|
29
|
+
element :start, DateTime
|
30
|
+
element :finish, DateTime
|
31
|
+
has_many :stories, Story
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
class Membership
|
3
|
+
include HappyMapper
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def all(project, options={})
|
7
|
+
parse(Client.connection["/projects/#{project.id}/memberships"].get)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
element :id, Integer
|
12
|
+
element :role, String
|
13
|
+
|
14
|
+
# Flattened Attributes from <person>...</person>
|
15
|
+
element :name, String, :deep => true
|
16
|
+
element :email, String, :deep => true
|
17
|
+
element :initials, String, :deep => true
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
class Note
|
3
|
+
include HappyMapper
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def all(story, options={})
|
7
|
+
notes = parse(Client.connection["/projects/#{story.project_id}/stories/#{story.id}/notes"].get)
|
8
|
+
notes.each { |n| n.project_id, n.story_id = story.project_id, story.id }
|
9
|
+
return notes
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :project_id, :story_id
|
14
|
+
|
15
|
+
element :id, Integer
|
16
|
+
element :text, String
|
17
|
+
element :author, String
|
18
|
+
element :noted_at, DateTime
|
19
|
+
has_one :story, Story
|
20
|
+
|
21
|
+
def initialize(attributes={})
|
22
|
+
if attributes[:owner]
|
23
|
+
self.story = attributes.delete(:owner)
|
24
|
+
self.project_id = self.story.project_id
|
25
|
+
self.story_id = self.story.id
|
26
|
+
end
|
27
|
+
|
28
|
+
update_attributes(attributes)
|
29
|
+
end
|
30
|
+
|
31
|
+
def create
|
32
|
+
response = Client.connection["/projects/#{project_id}/stories/#{story_id}/notes"].post(self.to_xml, :content_type => 'application/xml')
|
33
|
+
return Note.parse(response)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Pivotal Tracker API doesn't seem to support updating or deleting notes at this time.
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def to_xml
|
41
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
42
|
+
xml.note {
|
43
|
+
#xml.author "#{author}"
|
44
|
+
xml.text_ "#{text}"
|
45
|
+
xml.noted_at "#{noted_at}"
|
46
|
+
}
|
47
|
+
end
|
48
|
+
return builder.to_xml
|
49
|
+
end
|
50
|
+
|
51
|
+
def update_attributes(attrs)
|
52
|
+
attrs.each do |key, value|
|
53
|
+
self.send("#{key}=", value.is_a?(Array) ? value.join(',') : value )
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|