Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
2 parents a61d650 + 62c44f0 commit 5f395be25ec199fded8c22011d1b8f97aa30a9dc @sbleon committed Feb 5, 2013
Showing with 3,193 additions and 1,683 deletions.
  1. +4 −1 .gitignore
  2. +1 −0 .rspec
  3. +5 −0 .travis.yml
  4. +7 −6 Gemfile
  5. +57 −0 Gemfile.lock
  6. +1 −1 LICENSE
  7. +32 −15 README.rdoc
  8. +18 −18 Rakefile
  9. +1 −1 VERSION
  10. +14 −14 lib/pivotal-tracker.rb
  11. +1 −1 lib/pivotal-tracker/activity.rb
  12. +16 −0 lib/pivotal-tracker/attachment.rb
  13. +55 −8 lib/pivotal-tracker/client.rb
  14. +7 −1 lib/pivotal-tracker/iteration.rb
  15. +48 −1 lib/pivotal-tracker/project.rb
  16. +8 −9 lib/pivotal-tracker/proxy.rb
  17. +64 −8 lib/pivotal-tracker/story.rb
  18. +24 −1 lib/pivotal-tracker/task.rb
  19. +69 −0 lib/pivotal-tracker/validation.rb
  20. +104 −76 pivotal-tracker.gemspec
  21. +107 −148 spec/fixtures/activity.xml
  22. +279 −0 spec/fixtures/bugs.xml
  23. +6 −6 spec/fixtures/created_note.xml
  24. +6 −6 spec/fixtures/created_story.xml
  25. +293 −0 spec/fixtures/features.xml
  26. +197 −46 spec/fixtures/iterations_all.xml
  27. +139 −67 spec/fixtures/iterations_backlog.xml
  28. +18 −62 spec/fixtures/iterations_current.xml
  29. +211 −0 spec/fixtures/iterations_current_backlog.xml
  30. +21 −29 spec/fixtures/iterations_done.xml
  31. +25 −12 spec/fixtures/memberships.xml
  32. +26 −10 spec/fixtures/notes.xml
  33. +28 −17 spec/fixtures/project.xml
  34. +85 −89 spec/fixtures/project_activity.xml
  35. +41 −632 spec/fixtures/projects.xml
  36. +93 −26 spec/fixtures/stale_fish.yml
  37. +197 −131 spec/fixtures/stories.xml
  38. +37 −0 spec/fixtures/story-4459994.xml
  39. +46 −0 spec/fixtures/story-4460038.xml
  40. +32 −0 spec/fixtures/story-4460598.xml
  41. +48 −0 spec/fixtures/story-4473735.xml
  42. +6 −6 spec/fixtures/tasks.xml
  43. +8 −0 spec/fixtures/update_tasks.xml
  44. +32 −0 spec/pivotal-tracker/activity_spec.rb
  45. +62 −0 spec/pivotal-tracker/attachment_spec.rb
  46. +148 −0 spec/pivotal-tracker/client_spec.rb
  47. +25 −1 spec/{unit → }/pivotal-tracker/iteration_spec.rb
  48. +3 −3 spec/{unit → }/pivotal-tracker/membership_spec.rb
  49. +13 −13 spec/{unit → }/pivotal-tracker/note_spec.rb
  50. +98 −0 spec/pivotal-tracker/project_spec.rb
  51. +247 −0 spec/pivotal-tracker/story_spec.rb
  52. +33 −0 spec/pivotal-tracker/task_spec.rb
  53. +26 −9 spec/spec_helper.rb
  54. +21 −13 spec/support/stale_fish_fixtures.rb
  55. +0 −23 spec/unit/pivotal-tracker/activity_spec.rb
  56. +0 −47 spec/unit/pivotal-tracker/project_spec.rb
  57. +0 −105 spec/unit/pivotal-tracker/story_spec.rb
  58. +0 −21 spec/unit/pivotal-tracker/task_spec.rb
View
@@ -3,5 +3,8 @@
coverage
rdoc
pkg
-
+vendor
.bundle
+.idea
+request_test.rb
+stale_fish-tmp.yml
View
1 .rspec
@@ -0,0 +1 @@
+--colour
View
@@ -0,0 +1,5 @@
+language: ruby
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
View
13 Gemfile
@@ -1,16 +1,17 @@
source 'http://rubygems.org'
group :runtime do
- gem 'rest-client', '~> 1.5.1'
- gem 'happymapper', '>= 0.2.4'
+ gem 'rest-client', '~> 1.6.0'
+ gem 'nokogiri-happymapper', '>= 0.5.4', :require => 'happymapper'
gem 'builder'
- gem 'nokogiri', '~> 1.4.1'
+ gem 'nokogiri', '>= 1.5.5'
+ gem 'crack'
end
group :test do
- gem 'rspec', :require => 'spec'
+ gem 'rspec'
gem 'rake'
- gem 'bundler', '~> 0.9.5'
gem 'jeweler'
- gem 'stale_fish', '~> 1.3.0'
+ gem 'stale_fish', '~> 1.3.2'
+ gem 'autotest'
end
View
@@ -0,0 +1,57 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ ZenTest (4.8.2)
+ activesupport (3.2.9)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ autotest (4.4.6)
+ ZenTest (>= 4.4.1)
+ builder (3.1.4)
+ crack (0.3.1)
+ diff-lcs (1.1.3)
+ fakeweb (1.3.0)
+ git (1.2.5)
+ i18n (0.6.1)
+ jeweler (1.8.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ rdoc
+ json (1.7.5)
+ mime-types (1.19)
+ multi_json (1.3.7)
+ nokogiri (1.5.5)
+ nokogiri-happymapper (0.5.6)
+ nokogiri (~> 1.5)
+ rake (10.0.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rspec (2.12.0)
+ rspec-core (~> 2.12.0)
+ rspec-expectations (~> 2.12.0)
+ rspec-mocks (~> 2.12.0)
+ rspec-core (2.12.0)
+ rspec-expectations (2.12.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.12.0)
+ stale_fish (1.3.2)
+ activesupport
+ fakeweb
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ autotest
+ builder
+ crack
+ jeweler
+ nokogiri (>= 1.5.5)
+ nokogiri-happymapper (>= 0.5.4)
+ rake
+ rest-client (~> 1.6.0)
+ rspec
+ stale_fish (~> 1.3.2)
View
@@ -1,4 +1,4 @@
-Copyright (c) 2009 Justin Smestad, Josh Nichols
+Copyright (c) 2009 Justin Smestad
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -2,9 +2,8 @@
Ruby wrapper for Pivotal Tracker API, no frameworks required. Simply Ruby.
-== Note
-
-Version 0.0.8 and above are incompatible with previous versions.
+{<img src="https://secure.travis-ci.org/jsmestad/pivotal-tracker.png" />}[http://travis-ci.org/jsmestad/pivotal-tracker]
+{<img src="https://badge.fury.io/rb/pivotal-tracker.png" alt="Gem Version" />}[http://rubygems.org/gems/pivotal-tracker]
== Features
@@ -16,27 +15,42 @@ Version 0.0.8 and above are incompatible with previous versions.
PivotalTracker::Client.token('myusername@email.com', 'secretpassword') # Automatically fetch API Token
PivotalTracker::Client.token = 'jkfduisj97823974j2kl24899234' # Manually set API Token
-
+
@projects = PivotalTracker::Project.all # return all projects
@a_project = PivotalTracker::Project.find(84739) # find project with a given ID
-
+
@a_project.stories.all # return all stories for "a_project"
@a_project.stories.all(:label => 'overdue', :story_type => ['bug', 'chore']) # return all stories that match the passed filters
@a_project.stories.find(847762630) # find story with a given ID
-
+
@a_project.stories.create(:name => 'My Story', :story_type => 'feature') # create a story for this project
+ # all tracker defined filters are allowed, as well as :limit & :offset for pagination
+
+ # The below pattern below is planned to be added to the final release:
+
+ @a_project.stories << PivotalTracker::Story.new(84739, :name => 'Ur Story') # same as earlier story creation, useful for copying/cloning from proj
+
+
@story = @a_project.stories.find(847762630)
@story.notes.all # return all notes (comments) for a story
- @story.notes.create(:text => 'A new coment', :noted_at => '06/29/2010 05:00 EST') # add a new story
-
+ @story.notes.create(:text => 'A new comment', :noted_at => '06/29/2010 05:00 EST') # add a new note
- # all tracker defined filters are allowed, as well as :limit & :offset for pagination
- # The below are planned to be added to the final release:
+ @story.attachments # return an array of all attachment items (data only, not the files)
+ @story.upload_attachment(file_path) # add a file attachment to @story that can be found at file_path
+
- @a_project.stories << PivotalTracker::Story.new(84739, :name => 'Ur Story') # same as above, useful for copying/cloning from proj
+ # All 4 examples below return a PivotalTracker::Story from the new project, with the same story ID
+ @story.move_to_project(123456) # move @story to the project with ID 123456
+ @story.move_to_project('123456') # same as above
+ @story.move_to_project(@project) # move @story to @project
+ @story.move_to_project(@another_story) # move @story into the same project as @another_story
+
+
+ # Connect to custom API endpoint
+ PivotalTracker::Client.tracker_host = 'www.my-pivotal-tracker.com'
The API is based on the following this gist: http://gist.github.com/283120
@@ -52,14 +66,17 @@ The API is based on the following this gist: http://gist.github.com/283120
$ cd pivotal-tracker
$ bundle install
$ bundle exec rake
-
+
== Additional Information
-Wiki: http://wiki.github.com/jsmestad/pivotal-tracker
-Documentation: http://rdoc.info/projects/jsmestad/pivotal-tracker
+* Wiki: http://wiki.github.com/jsmestad/pivotal-tracker
+* Documentation: http://rdoc.info/projects/jsmestad/pivotal-tracker
+* Pivotal API v3 Docs: http://www.pivotaltracker.com/help/api?version=v3
-== Contributers
+== Contributors along the way
* Justin Smestad (http://github.com/jsmestad)
* Josh Nichols (http://github.com/technicalpickles)
* Terence Lee (http://github.com/hone)
+* Jon Mischo (http://github.com/supertaz)
+* Gabor Ratky (http://github.com/rgabo)
View
@@ -1,5 +1,9 @@
-require 'rake'
-require 'bundler'
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
begin
require 'jeweler'
@@ -10,28 +14,24 @@ begin
gem.homepage = "http://github.com/jsmestad/pivotal-tracker"
gem.authors = ["Justin Smestad", "Josh Nichols", "Terence Lee"]
- bundle = Bundler::Definition.from_gemfile('Gemfile')
- bundle.dependencies.each do |dep|
- next unless dep.groups.include?(:runtime)
- gem.add_dependency(dep.name, dep.requirement.to_s)
- end
+ gem.add_dependency 'rest-client', '~> 1.6.0'
+ gem.add_dependency 'happymapper', '>= 0.3.2'
+ gem.add_dependency 'builder'
+ gem.add_dependency 'nokogiri', '>= 1.4.3'
+
+ gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'bundler', '~> 1.0.12'
+ gem.add_development_dependency 'jeweler'
+ gem.add_development_dependency 'stale_fish', '~> 1.3.0'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
-require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
-end
-
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
-end
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec)
task :default => :spec
View
@@ -1 +1 @@
-0.2.0
+0.5.11
View
@@ -4,10 +4,12 @@
require 'nokogiri'
+require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'validation')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'extensions')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'proxy')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'client')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'project')
+require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'attachment')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'story')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'task')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'membership')
@@ -21,20 +23,18 @@ module PivotalTracker
class ProjectNotSpecified < StandardError; end
def self.encode_options(options)
- return nil if !options.is_a?(Hash) || options.empty?
-
- options_string = []
- options_string << "limit=#{options.delete(:limit)}" if options[:limit]
- options_string << "offset=#{options.delete(:offset)}" if options[:offset]
-
- filters = []
- options.each do |key, value|
- values = value.is_a?(Array) ? value.map {|x| CGI.escape(x) }.join(',') : CGI.escape(value)
- filters << "#{key}%3A#{values}" # %3A => :
- end
- options_string << "filter=#{filters.join('%20')}" unless filters.empty? # %20 => &amp;
-
- return "?#{options_string.join('&')}"
+ options_strings = options.inject({}) do |m, (k,v)|
+ if [:limit, :offset].include?(k.to_sym)
+ m.update k => v
+ elsif k.to_sym == :search
+ m.update :filter => v
+ else
+ filter_query = %{#{k}:#{[v].flatten.join(",")}}
+ m.update :filter => (m[:filter] ? "#{m[:filter]} #{filter_query}" : filter_query)
+ end
+ end.map {|k,v| "#{k}=#{CGI.escape(v.to_s)}"}
+
+ %{?#{options_strings.join("&")}} unless options_strings.empty?
end
end
@@ -23,7 +23,7 @@ def encode_options(options)
if options[:occurred_since]
options_string << "occurred_since_date=\"#{options[:occurred_since].utc}\""
elsif options[:occurred_since_date]
- options_string << "occurred_since_date=\"#{options[:occurred_since_date]}\""
+ options_string << "occurred_since_date=#{URI.escape options[:occurred_since_date].strftime("%Y/%m/%d %H:%M:%S %Z")}"
end
return "?#{options_string.join('&')}"
@@ -0,0 +1,16 @@
+module PivotalTracker
+ class Attachment
+ include HappyMapper
+
+ tag 'attachment'
+
+ element :id, Integer
+ element :filename, String
+ element :description, String
+ element :uploaded_by, String
+ element :uploaded_at, DateTime
+ element :url, String
+ element :status, String
+
+ end
+end
Oops, something went wrong.

0 comments on commit 5f395be

Please sign in to comment.