pivotal-tracker 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/pivotal-tracker.rb +10 -12
- data/lib/pivotal-tracker/client.rb +2 -1
- data/lib/pivotal-tracker/proxy.rb +1 -0
- data/lib/pivotal-tracker/story.rb +10 -0
- data/lib/pivotal-tracker/task.rb +1 -0
- data/pivotal-tracker.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/pivotal-tracker.rb
CHANGED
@@ -23,19 +23,17 @@ module PivotalTracker
|
|
23
23
|
|
24
24
|
def self.encode_options(options)
|
25
25
|
return nil if !options.is_a?(Hash) || options.empty?
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
filters = []
|
32
|
-
options.each do |key, value|
|
33
|
-
values = value.is_a?(Array) ? value.map {|x| CGI.escape(x) }.join(',') : CGI.escape(value)
|
34
|
-
filters << "#{key}%3A#{values}" # %3A => :
|
26
|
+
options_strings = []
|
27
|
+
# remove options which are not filters, and encode them as such
|
28
|
+
[:limit, :offset].each do |o|
|
29
|
+
options_strings << "#{CGI.escape(o.to_s)}=#{CGI.escape(options.delete(o))}" if options[o]
|
35
30
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
# assume remaining key-value pairs describe filters, and encode them as such.
|
32
|
+
filters_string = options.map do |key, value|
|
33
|
+
[value].flatten.map {|v| "#{CGI.escape(key.to_s)}%3A#{CGI.escape(v)}"}.join('&filter=')
|
34
|
+
end
|
35
|
+
options_strings << "filter=#{filters_string}" unless filters_string.empty?
|
36
|
+
return "?#{options_strings.join('&')}"
|
39
37
|
end
|
40
38
|
|
41
39
|
end
|
@@ -9,12 +9,13 @@ module PivotalTracker
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def token(username, password, method='post')
|
12
|
+
return @token if @token
|
12
13
|
response = if method == 'post'
|
13
14
|
RestClient.post 'https://www.pivotaltracker.com/services/v3/tokens/active', :username => username, :password => password
|
14
15
|
else
|
15
16
|
RestClient.get "https://#{username}:#{password}@www.pivotaltracker.com/services/v3/tokens/active"
|
16
17
|
end
|
17
|
-
@token
|
18
|
+
@token= Nokogiri::XML(response.body).search('guid').inner_html
|
18
19
|
end
|
19
20
|
|
20
21
|
# this is your connection for the entire module
|
@@ -9,6 +9,16 @@ module PivotalTracker
|
|
9
9
|
stories.each { |s| s.project_id = project.id }
|
10
10
|
return stories
|
11
11
|
end
|
12
|
+
|
13
|
+
def find(param, project_id)
|
14
|
+
begin
|
15
|
+
story = parse(Client.connection["/projects/#{project_id}/stories/#{param}"].get)
|
16
|
+
story.project_id = project_id
|
17
|
+
rescue RestClient::ExceptionWithResponse
|
18
|
+
story = nil
|
19
|
+
end
|
20
|
+
return story
|
21
|
+
end
|
12
22
|
end
|
13
23
|
|
14
24
|
tag "story"
|
data/lib/pivotal-tracker/task.rb
CHANGED
data/pivotal-tracker.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pivotal-tracker}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
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-
|
12
|
+
s.date = %q{2010-11-04}
|
13
13
|
s.email = %q{justin.smestad@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Smestad
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-11-04 00:00:00 -06:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|