pivotal-tracker-api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec4113fd877a3f6412585278193c64114bc53529
|
4
|
+
data.tar.gz: 0c48160b2eba2e5ea807f723dbd2fb2dacb79514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a60363ee4d3558f2422591659cbb1875796cd6597ab6dd139f1c0aef79a5735de7087bbab05a246d90cf7fbcdc5718fe61f4e1bc916280cdbe99ef00b824129
|
7
|
+
data.tar.gz: 24a7538caed3da39fdb66acfde8e8757d6bcc5d6db2081b6aaa2fe0e7434d73bb2c90e78083af5d9cf718d32f8d2fd5df2ca4aa5db71bd0441ede5fa7384a938
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -10,10 +10,14 @@ module Scorer
|
|
10
10
|
def self.parse_json_comments(json_comments, story)
|
11
11
|
comments = Array.new
|
12
12
|
json_comments.each do |comment|
|
13
|
+
person = Scorer::Person.parse_json_person({id: '0', name: 'Unkown', initials: 'Unkown', username: 'Unkown', email: 'Unkown'})
|
14
|
+
if comment[:person]
|
15
|
+
person = Scorer::Person.parse_json_person(comment[:person])
|
16
|
+
end
|
13
17
|
comments << new({
|
14
18
|
id: comment[:id].to_i,
|
15
19
|
text: comment[:text],
|
16
|
-
author:
|
20
|
+
author: person,
|
17
21
|
created_at: DateTime.parse(comment[:created_at].to_s).to_s,
|
18
22
|
updated_at: DateTime.parse(comment[:updated_at].to_s).to_s,
|
19
23
|
story: story
|
@@ -7,10 +7,20 @@ module Scorer
|
|
7
7
|
update_attributes(attributes)
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.parse_json_iteration_with_comments(json_iteration)
|
11
|
+
parse_iteration(json_iteration, true)
|
12
|
+
end
|
13
|
+
|
10
14
|
def self.parse_json_iteration(json_iteration)
|
15
|
+
parse_iteration(json_iteration, false)
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def self.parse_iteration(json_iteration, with_comments)
|
11
21
|
new({
|
12
22
|
project_id: json_iteration[:project_id].to_i,
|
13
|
-
stories: parse_stories(json_iteration[:stories], json_iteration[:project_id].to_i),
|
23
|
+
stories: parse_stories(json_iteration[:stories], json_iteration[:project_id].to_i, with_comments),
|
14
24
|
story_ids: json_iteration[:story_ids],
|
15
25
|
number: json_iteration[:number],
|
16
26
|
team_strength: json_iteration[:team_strength],
|
@@ -20,13 +30,11 @@ module Scorer
|
|
20
30
|
})
|
21
31
|
end
|
22
32
|
|
23
|
-
|
24
|
-
|
25
|
-
def self.parse_stories(stories, project_id)
|
33
|
+
def self.parse_stories(stories, project_id, with_comments)
|
26
34
|
story_ids = Array.new
|
27
35
|
stories.each { |story| story_ids << story[:id].to_i if !story[:id].nil? }
|
28
36
|
project = PivotalService.one_project(project_id)
|
29
|
-
PivotalService.stories(project, true, story_ids, Scorer::Story.fields)
|
37
|
+
PivotalService.stories(project, true, with_comments, story_ids, Scorer::Story.fields)
|
30
38
|
end
|
31
39
|
|
32
40
|
def update_attributes(attrs)
|
@@ -33,7 +33,7 @@ class PivotalService
|
|
33
33
|
Scorer::Activity.parse_json_activity(json_activity, project_id)
|
34
34
|
end
|
35
35
|
|
36
|
-
def iterations(project_id, scope, fields=[], limit=1, offset=1)
|
36
|
+
def iterations(project_id, scope, get_comments, fields=[], limit=1, offset=1)
|
37
37
|
return @iteration if !@iteration.nil? && @iteration.project_id == project_id
|
38
38
|
|
39
39
|
api_url = "/projects/#{project_id}/iterations?"
|
@@ -46,7 +46,12 @@ class PivotalService
|
|
46
46
|
api_url = append_fields(api_url, fields)
|
47
47
|
response = Scorer::Client.get_with_caching(api_url)
|
48
48
|
json_iterations = JSON.parse(response, {:symbolize_names => true})
|
49
|
-
|
49
|
+
if get_comments
|
50
|
+
@iteration = Scorer::Iteration.parse_json_iteration_with_comments(json_iterations[0])
|
51
|
+
else
|
52
|
+
@iteration = Scorer::Iteration.parse_json_iteration(json_iterations[0])
|
53
|
+
end
|
54
|
+
@iteration
|
50
55
|
end
|
51
56
|
|
52
57
|
def all_stories(project_label, project, fields=[])
|
@@ -65,7 +70,7 @@ class PivotalService
|
|
65
70
|
Scorer::Story.parse_json_story(json_story, project.id)
|
66
71
|
end
|
67
72
|
|
68
|
-
def stories(project, should_cache, ids=[], fields=[])
|
73
|
+
def stories(project, should_cache, get_comments, ids=[], fields=[])
|
69
74
|
@stories = Array.new
|
70
75
|
api_url = append_fields('/projects' + "/#{project.id}/stories", fields)
|
71
76
|
api_url = api_url.rindex('?fields=') ? "#{api_url}&filter=id%3A" : "#{api_url}?filter=id%3A"
|
@@ -77,7 +82,7 @@ class PivotalService
|
|
77
82
|
response = Scorer::Client.get(api_url)
|
78
83
|
end
|
79
84
|
json_story = JSON.parse(response, {:symbolize_names => true})
|
80
|
-
@stories << Scorer::Story.parse_json_story(json_story[0], project.id)
|
85
|
+
@stories << Scorer::Story.parse_json_story(json_story[0], project.id, get_comments)
|
81
86
|
else
|
82
87
|
story_ids = ''
|
83
88
|
ids.each do |id|
|
@@ -90,7 +95,7 @@ class PivotalService
|
|
90
95
|
response = Scorer::Client.get(api_url)
|
91
96
|
end
|
92
97
|
json_stories = JSON.parse(response, {:symbolize_names => true})
|
93
|
-
@stories = Scorer::Story.parse_json_stories(json_stories, project.id)
|
98
|
+
@stories = Scorer::Story.parse_json_stories(json_stories, project.id, get_comments)
|
94
99
|
end
|
95
100
|
end
|
96
101
|
|
@@ -17,7 +17,7 @@ module Scorer
|
|
17
17
|
'deadline', 'comments', 'tasks']
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.parse_json_story(json_story, project_id)
|
20
|
+
def self.parse_json_story(json_story, project_id, get_comments)
|
21
21
|
requested_by = json_story[:requested_by][:name] if !json_story[:requested_by].nil?
|
22
22
|
story_id = json_story[:id].to_i
|
23
23
|
estimate = json_story[:estimate] ? json_story[:estimate].to_i : -1
|
@@ -39,16 +39,20 @@ module Scorer
|
|
39
39
|
deadline: json_story[:deadline]
|
40
40
|
})
|
41
41
|
|
42
|
-
|
42
|
+
if get_comments
|
43
|
+
parsed_story.comments = get_story_comments(project_id, parsed_story)
|
44
|
+
else
|
45
|
+
parsed_story.comments = Scorer::Comment.parse_json_comments(json_story[:comments], parsed_story)
|
46
|
+
end
|
43
47
|
parsed_story.tasks = parse_tasks(json_story[:tasks], json_story)
|
44
48
|
parsed_story.attachments = []
|
45
49
|
parsed_story
|
46
50
|
end
|
47
51
|
|
48
|
-
def self.parse_json_stories(json_stories, project_id)
|
52
|
+
def self.parse_json_stories(json_stories, project_id, get_comments)
|
49
53
|
stories = Array.new
|
50
54
|
json_stories.each do |story|
|
51
|
-
stories << parse_json_story(story, project_id)
|
55
|
+
stories << parse_json_story(story, project_id, get_comments)
|
52
56
|
end
|
53
57
|
stories
|
54
58
|
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.3 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.3"
|
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-01-
|
14
|
+
s.date = "2014-01-31"
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jfox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|