pivotal-tracker-fox 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pivotal-tracker/story.rb +63 -11
- metadata +2 -2
@@ -19,10 +19,68 @@ module PivotalTracker
|
|
19
19
|
end
|
20
20
|
return story
|
21
21
|
end
|
22
|
-
|
23
|
-
def parse_stories(xml_string)
|
24
|
-
|
22
|
+
|
23
|
+
def parse_stories(xml_string, project_id)
|
24
|
+
doc = Nokogiri::XML(xml_string)
|
25
|
+
doc.xpath('//story').map do |xml_story|
|
26
|
+
story = Story.new({
|
27
|
+
id: xml_story.xpath('id').inner_text.to_i,
|
28
|
+
url: xml_story.xpath('url').inner_text,
|
29
|
+
project_id: project_id,
|
30
|
+
name: xml_story.xpath('name').inner_text,
|
31
|
+
description: xml_story.xpath('description').inner_text,
|
32
|
+
story_type: xml_story.xpath('story_type').inner_text,
|
33
|
+
estimate: xml_story.xpath('estimate').inner_text.to_i,
|
34
|
+
current_state: xml_story.xpath('current_state').inner_text,
|
35
|
+
requested_by: xml_story.xpath('requested_by').inner_text,
|
36
|
+
owned_by: xml_story.xpath('owned_by').inner_text,
|
37
|
+
labels: xml_story.xpath('labels').inner_text,
|
38
|
+
jira_id: xml_story.xpath('jira_id').inner_text,
|
39
|
+
jira_url: xml_story.xpath('jira_url').inner_text,
|
40
|
+
other_id: xml_story.xpath('other_id').inner_text,
|
41
|
+
integration_id: xml_story.xpath('integration_id').inner_text,
|
42
|
+
deadline: xml_story.xpath('deadline').inner_text
|
43
|
+
})
|
44
|
+
|
45
|
+
@attachments = xml_story.xpath('attachments')
|
46
|
+
story.attachments = @attachments.xpath('attachment').map do |xml|
|
47
|
+
attachment = Attachment.new
|
48
|
+
attachment.id = xml.xpath('id').inner_text.to_i
|
49
|
+
attachment.filename = xml.xpath('filename').inner_text
|
50
|
+
attachment.description = xml.xpath('description').inner_text
|
51
|
+
attachment.uploaded_by = xml.xpath('uploaded_by').inner_text
|
52
|
+
attachment.uploaded_at = xml.xpath('uploaded_at').inner_text
|
53
|
+
attachment.url = xml.xpath('url').inner_text
|
54
|
+
attachment.status = xml.xpath('status').inner_text
|
55
|
+
attachment
|
56
|
+
end
|
57
|
+
|
58
|
+
@notes = xml_story.xpath('notes')
|
59
|
+
story.notes = @notes.xpath('note').map do |xml|
|
60
|
+
Note.new({
|
61
|
+
id: xml.xpath('id').inner_text.to_i,
|
62
|
+
text: xml.xpath('text').inner_text,
|
63
|
+
author: xml.xpath('author').inner_text,
|
64
|
+
noted_at: DateTime.parse(xml.xpath('noted_at').inner_text.to_s).to_s,
|
65
|
+
story: story
|
66
|
+
})
|
67
|
+
end
|
68
|
+
|
69
|
+
@tasks = xml_story.xpath('tasks')
|
70
|
+
story.tasks = @tasks.xpath('task').map do |xml|
|
71
|
+
Task.new({
|
72
|
+
id: xml.xpath('id').inner_text.to_i,
|
73
|
+
description: xml.xpath('description').inner_text,
|
74
|
+
complete: xml.xpath('complete').inner_text,
|
75
|
+
created_at: DateTime.parse(xml.xpath('created_at').inner_text.to_s).to_s,
|
76
|
+
story: story
|
77
|
+
})
|
78
|
+
end
|
79
|
+
|
80
|
+
story
|
81
|
+
end
|
25
82
|
end
|
83
|
+
|
26
84
|
end
|
27
85
|
|
28
86
|
tag "story"
|
@@ -46,6 +104,8 @@ module PivotalTracker
|
|
46
104
|
element :other_id, String
|
47
105
|
element :integration_id, Integer
|
48
106
|
element :deadline, DateTime # Only available for Release stories
|
107
|
+
element :notes, Array
|
108
|
+
element :tasks, Array
|
49
109
|
|
50
110
|
has_many :attachments, Attachment, :tag => 'attachments', :xpath => '//attachments'
|
51
111
|
|
@@ -79,14 +139,6 @@ module PivotalTracker
|
|
79
139
|
Client.connection["/projects/#{project_id}/stories/#{id}"].delete
|
80
140
|
end
|
81
141
|
|
82
|
-
def notes
|
83
|
-
@notes ||= Proxy.new(self, Note)
|
84
|
-
end
|
85
|
-
|
86
|
-
def tasks
|
87
|
-
@tasks ||= Proxy.new(self, Task)
|
88
|
-
end
|
89
|
-
|
90
142
|
def upload_attachment(filename)
|
91
143
|
Attachment.parse(Client.connection["/projects/#{project_id}/stories/#{id}/attachments"].post(:Filedata => File.new(filename)))
|
92
144
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivotal-tracker-fox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rest-client
|