pivotal-tracker-api 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/pivotal-tracker-api/comment.rb +19 -0
- data/lib/pivotal-tracker-api/pivotal_service.rb +7 -0
- data/lib/pivotal-tracker-api/story.rb +3 -16
- data/pivotal-tracker-api.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 359d263b3e317435d1e1e33d05364f5b7d29c0e6
|
4
|
+
data.tar.gz: cad7be8e004e74660c38a837edb8205e7cc0b203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 540addcafdfd2583e43789a60cd87cb62332dab39f975cfeb11a2e15e9ac3946bda92101fa1be18b409e892961bf9a89116e28e5d85ecaedceb4c6dce4d7ad72
|
7
|
+
data.tar.gz: 5b216a4b8822e3f12fcb7761e8e9eff940591691f20a90fe6ac1abe313fab87d0e293b8e6fbe8f41be735829c38deb814741d1390ee6acb2d7148670f3d26c49
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -3,6 +3,25 @@ module Scorer
|
|
3
3
|
|
4
4
|
attr_accessor :story, :project_id, :story_id, :id, :text, :author, :created_at, :updated_at
|
5
5
|
|
6
|
+
def self.fields
|
7
|
+
['person', 'text', 'updated_at', 'id', 'created_at', 'story_id']
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse_json_comments(json_comments, story)
|
11
|
+
comments = Array.new
|
12
|
+
json_comments.each do |comment|
|
13
|
+
comments << new({
|
14
|
+
id: comment[:id].to_i,
|
15
|
+
text: comment[:text],
|
16
|
+
author: Scorer::Person.parse_json_person(comment[:person]),
|
17
|
+
created_at: DateTime.parse(comment[:created_at].to_s).to_s,
|
18
|
+
updated_at: DateTime.parse(comment[:updated_at].to_s).to_s,
|
19
|
+
story: story
|
20
|
+
})
|
21
|
+
end
|
22
|
+
comments
|
23
|
+
end
|
24
|
+
|
6
25
|
def initialize(attributes={})
|
7
26
|
if attributes[:owner]
|
8
27
|
self.story = attributes.delete(:owner)
|
@@ -100,6 +100,13 @@ class PivotalService
|
|
100
100
|
Scorer::Client.put(api_url, updates)
|
101
101
|
end
|
102
102
|
|
103
|
+
def comments(project_id, story, fields)
|
104
|
+
api_url = append_fields('/projects' + "/#{project_id}/stories/#{story.id}/comments", fields)
|
105
|
+
response = Scorer::Client.get_with_caching(api_url)
|
106
|
+
json_comments = JSON.parse(response, {:symbolize_names => true})
|
107
|
+
Scorer::Comment.parse_json_comments(json_comments, story)
|
108
|
+
end
|
109
|
+
|
103
110
|
private
|
104
111
|
|
105
112
|
def append_fields(api_url, fields)
|
@@ -39,7 +39,7 @@ module Scorer
|
|
39
39
|
deadline: json_story[:deadline]
|
40
40
|
})
|
41
41
|
|
42
|
-
parsed_story.comments =
|
42
|
+
parsed_story.comments = get_story_comments(project_id, parsed_story)
|
43
43
|
parsed_story.tasks = parse_tasks(json_story[:tasks], json_story)
|
44
44
|
parsed_story.attachments = []
|
45
45
|
parsed_story
|
@@ -53,21 +53,8 @@ module Scorer
|
|
53
53
|
stories
|
54
54
|
end
|
55
55
|
|
56
|
-
def self.
|
57
|
-
comments
|
58
|
-
if notes
|
59
|
-
notes.each do |note|
|
60
|
-
comments << Scorer::Comment.new({
|
61
|
-
id: note[:id].to_i,
|
62
|
-
text: note[:text],
|
63
|
-
author: note[:person_id],
|
64
|
-
created_at: DateTime.parse(note[:created_at].to_s).to_s,
|
65
|
-
updated_at: DateTime.parse(note[:updated_at].to_s).to_s,
|
66
|
-
story: story
|
67
|
-
})
|
68
|
-
end
|
69
|
-
end
|
70
|
-
comments
|
56
|
+
def self.get_story_comments(project_id, story)
|
57
|
+
PivotalService.comments(project_id, story, Scorer::Comment.fields)
|
71
58
|
end
|
72
59
|
|
73
60
|
def self.parse_tasks(tasks, story)
|
data/pivotal-tracker-api.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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.2 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.2"
|
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"]
|