pivotal-tracker-api 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/pivotal-tracker-api.iml +3 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/pivotal-tracker-api/iteration.rb +4 -4
- data/lib/pivotal-tracker-api/pivotal_service.rb +30 -14
- data/pivotal-tracker-api.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67b72a23f515d4560f96ce3f8de0b3a130afd70f
|
4
|
+
data.tar.gz: 6ba37d5988bee6b8a9a18b0c979dd2551e505e21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8e644d148110175fe463e4914382c3d93e7d026c33dc2e7b6ad48d806d1ab2df5b97bbd8ace146d2e00a8183701e3dd70b07509af562676d54338e2ceb27304
|
7
|
+
data.tar.gz: 6644610d76ad4ef2d5df4e81dc7b0c4fff5ef3280e28593cb3d4d9e6b17316680161e54dd0008f0735de9a509f85f488a41be6eee06cb009d228c6c8498d77e4
|
@@ -1,5 +1,8 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="CompassSettings">
|
4
|
+
<option name="compassSupportEnabled" value="true" />
|
5
|
+
</component>
|
3
6
|
<component name="FacetManager">
|
4
7
|
<facet type="gem" name="Gem">
|
5
8
|
<configuration>
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -7,10 +7,10 @@ module Scorer
|
|
7
7
|
update_attributes(attributes)
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.parse_json_iteration(json_iteration)
|
10
|
+
def self.parse_json_iteration(json_iteration, include_done)
|
11
11
|
new({
|
12
12
|
project_id: json_iteration[:project_id].to_i,
|
13
|
-
stories: parse_stories(json_iteration[:stories], json_iteration[:project_id].to_i),
|
13
|
+
stories: parse_stories(json_iteration[:stories], json_iteration[:project_id].to_i, include_done),
|
14
14
|
story_ids: json_iteration[:story_ids],
|
15
15
|
number: json_iteration[:number],
|
16
16
|
team_strength: json_iteration[:team_strength],
|
@@ -22,11 +22,11 @@ module Scorer
|
|
22
22
|
|
23
23
|
protected
|
24
24
|
|
25
|
-
def self.parse_stories(stories, project_id)
|
25
|
+
def self.parse_stories(stories, project_id, include_done)
|
26
26
|
story_ids = Array.new
|
27
27
|
stories.each { |story| story_ids << story[:id].to_i if !story[:id].nil? }
|
28
28
|
project = PivotalService.one_project(project_id)
|
29
|
-
PivotalService.stories(project, true, story_ids, Scorer::Story.fields)
|
29
|
+
PivotalService.stories(project, true, story_ids, Scorer::Story.fields, include_done)
|
30
30
|
end
|
31
31
|
|
32
32
|
def update_attributes(attrs)
|
@@ -37,16 +37,20 @@ class PivotalService
|
|
37
37
|
return @iteration if !@iteration.nil? && @iteration.project_id == project_id
|
38
38
|
|
39
39
|
api_url = "/projects/#{project_id}/iterations?"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
api_url = api_url
|
40
|
+
|
41
|
+
if scope == 'current'
|
42
|
+
api_url = append_scope(api_url, scope)
|
43
|
+
elsif scope == 'done' || scope == 'backlog' || scope == 'current_backlog'
|
44
|
+
api_url = append_limit_offset(api_url, limit, offset)
|
45
|
+
api_url = append_scope(api_url, scope)
|
46
|
+
else
|
47
|
+
api_url = append_limit_offset(api_url, limit, offset)
|
45
48
|
end
|
49
|
+
|
46
50
|
api_url = append_fields(api_url, fields)
|
47
51
|
response = Scorer::Client.get_with_caching(api_url)
|
48
52
|
json_iterations = JSON.parse(response, {:symbolize_names => true})
|
49
|
-
@iteration = Scorer::Iteration.parse_json_iteration(json_iterations[0])
|
53
|
+
@iteration = Scorer::Iteration.parse_json_iteration(json_iterations[0], (scope == 'done'))
|
50
54
|
end
|
51
55
|
|
52
56
|
def all_stories(project_label, project, fields=[])
|
@@ -65,10 +69,14 @@ class PivotalService
|
|
65
69
|
Scorer::Story.parse_json_story(json_story, project.id)
|
66
70
|
end
|
67
71
|
|
68
|
-
def stories(project, should_cache, ids=[], fields=[])
|
72
|
+
def stories(project, should_cache, ids=[], fields=[], include_done=false)
|
69
73
|
@stories = Array.new
|
70
74
|
api_url = append_fields('/projects' + "/#{project.id}/stories", fields)
|
71
|
-
|
75
|
+
if api_url.rindex('?fields=')
|
76
|
+
api_url = "#{api_url}&filter=includedone%3A#{include_done}%20id%3A"
|
77
|
+
else
|
78
|
+
api_url = "#{api_url}?filter=includedone%3A#{include_done}%20id%3A"
|
79
|
+
end
|
72
80
|
if ids.size == 1
|
73
81
|
api_url = api_url + ids[0].to_s
|
74
82
|
if should_cache
|
@@ -109,13 +117,21 @@ class PivotalService
|
|
109
117
|
|
110
118
|
private
|
111
119
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
117
|
-
url
|
120
|
+
def append_fields(api_url, fields)
|
121
|
+
url = api_url
|
122
|
+
fields.each do |field|
|
123
|
+
url = url.rindex('?fields=') ? url + ",#{field}" : url + "?fields=#{field}"
|
118
124
|
end
|
125
|
+
url
|
126
|
+
end
|
127
|
+
|
128
|
+
def append_scope(api_url, scope)
|
129
|
+
api_url + "&scope=#{scope}"
|
130
|
+
end
|
131
|
+
|
132
|
+
def append_limit_offset(api_url, limit, offset)
|
133
|
+
api_url + "&limit=#{limit}&offset=#{offset}"
|
134
|
+
end
|
119
135
|
|
120
136
|
end
|
121
137
|
end
|
data/pivotal-tracker-api.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: pivotal-tracker-api 0.1.
|
5
|
+
# stub: pivotal-tracker-api 0.1.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "pivotal-tracker-api"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["jfox"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-11-13"
|
15
15
|
s.description = "A ruby gem to communicate with the Picotal Tracker API v5"
|
16
16
|
s.email = "atljeremy@me.com"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivotal-tracker-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jfox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|