pivotal_sync 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "rest-client"
4
- gem "happymapper"
4
+ gem "happymapper"
5
+
6
+ group :test do
7
+ gem "rspec"
8
+ gem "nokogiri"
9
+ end
data/README.md CHANGED
@@ -6,93 +6,105 @@ Gives access to projects, iterations, stories, memberships, attachments, comment
6
6
  ### Mappings
7
7
 
8
8
  #### Project
9
- id, Integer
10
- name, String
11
- iteration_length, Integer
12
- week_start, String
13
- point_scale, String
14
- velocity_scheme, String
15
- current_velocity, Integer
16
- initial_velocity, Integer
17
- number_of_done_iterations_to_show, Integer
18
- labels, String
19
- allow_attachments, Boolean
20
- public, Boolean
21
- use_https, Boolean
22
- bugs_and_chores_are_estimatable, Boolean
23
- comit_mode, Boolean
24
- last_activity_at, DateTime
25
-
26
-
27
- #### Iteraion
28
- id, Integer
29
- number, Integer
30
- start, DateTime
31
- finish, DateTime
32
- team_strength, Float
9
+ id, Integer
10
+ name, String
11
+ created_at, DateTime
12
+ version, Integer
13
+ iteration_length, Integer
14
+ week_start_day, String
15
+ point_scale, String
16
+ account, String
17
+ first_iteration_start_time, DateTime
18
+ current_iteration_number, Integer
19
+ enable_tasks, Boolean
20
+ velocity_scheme, String
21
+ current_velocity, Integer
22
+ initial_velocity, Integer
23
+ number_of_done_iterations_to_show, Integer
24
+ labels, String
25
+ allow_attachments, Boolean
26
+ public, Boolean
27
+ use_https, Boolean
28
+ bugs_and_chores_are_estimatable, Boolean
29
+ comit_mode, Boolean
30
+ last_activity_at, DateTime
31
+
32
+ #### Iteration
33
+ id, Integer
34
+ number, Integer
35
+ start, DateTime
36
+ finish, DateTime
37
+ team_strength, Float
33
38
 
34
39
  #### Story
35
- id, Integer
36
- project_id, Integer
37
- story_type, String
38
- url, String
39
- estimate_type, Float
40
- current_state, String
41
- description, String
42
- name, String
43
- requested_by, String
44
- owned_by, String
45
- created_at, DateTime
46
- accepted_at, DateTime
47
- labels, String
48
-
40
+ id, Integer
41
+ project_id, Integer
42
+ story_type, String
43
+ url, String
44
+ estimate, Float
45
+ current_state, String
46
+ description, String
47
+ name, String
48
+ created_at, DateTime
49
+ updated_at, DateTime
50
+ accepted_at, DateTime
51
+ labels, String
52
+
49
53
  #### Task
50
- id, Integer
51
- description, String
52
- position, Integer
53
- complete, Boolean
54
- created_at, DateTime
54
+ id, Integer
55
+ description, String
56
+ position, Integer
57
+ complete, Boolean
58
+ created_at, DateTime
55
59
 
56
60
  #### Comment
57
- id, Integer
58
- text, String
59
- created_at, DateTime
60
- person_name, String
61
- person_initials, String
61
+ id, Integer
62
+ text, String
63
+ created_at, DateTime
62
64
 
63
65
  #### Integration
64
- id, Integer
65
- type, String
66
- name, String
67
- field_name, String
68
- field_label, String
69
- active, Boolean
66
+ id, Integer
67
+ type, String
68
+ name, String
69
+ field_name, String
70
+ field_label, String
71
+ active, Boolean
70
72
 
71
73
  #### Attachment
72
- id, Integer
73
- filename, String
74
- description, String
75
- uploaded_by, String
76
- uploaded_at, DateTime
77
- url, String
78
-
74
+ id, Integer
75
+ filename, String
76
+ url, String
77
+ uploaded_at, DateTime
78
+
79
79
  #### Membership
80
- id, Integer
81
- role, String
82
- name, String
83
- email, String
84
- initials, String
80
+ id, Integer
81
+ role, String
82
+ user_id, Integer
83
+ name, String
84
+ email, String
85
+ initials, String
86
+
87
+ #### Person
88
+ id, Integer
89
+ email, String
90
+ name, String
91
+ initials, String
85
92
 
86
93
  ### Associations
87
94
 
88
- `project has_many :iterations`
89
- `project has_many :stories, through: :iterations`
90
- `iteration has_many :stories`
91
- `story belongs_to :project`
92
- `story has_many :attachments`
93
- `story has_many :tasks`
94
- `story has_many :comments`
95
-
95
+ project has_many :iterations
96
+ project has_many :stories, through: :iterations
97
+ iteration has_many :stories
98
+ story belongs_to :project
99
+ story has_many :attachments
100
+ story has_many :tasks
101
+ story has_many :comments
102
+
103
+ attachment has_one :uploaded_by (Person)
104
+ comment has_one :author (Person)
105
+ story has_one :owned_by (Person)
106
+ story has_one :requested_by (Person)
107
+
96
108
  ## Installation
97
109
 
98
110
  Add this line to your application's Gemfile:
@@ -109,8 +121,8 @@ Or install it yourself as:
109
121
 
110
122
  ## Usage
111
123
 
112
- `PivotalSync::Client.token = "your token"`
113
- `projects = PivotalSync::Project.all`
124
+ PivotalSync::Client.token = "your token"
125
+ projects = PivotalSync::Project.all
114
126
 
115
127
  ## Contributing
116
128
 
@@ -0,0 +1,11 @@
1
+ module PivotalSync
2
+ class Attachment
3
+ include HappyMapper
4
+
5
+ element :id, Integer
6
+ element :filename, String
7
+ element :url, String
8
+ element :uploaded_at, DateTime
9
+ has_one :uploaded_by, Person
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ module PivotalSync
2
+
3
+ class Client
4
+
5
+ class << self
6
+
7
+ attr_writer :token
8
+
9
+ def connection
10
+ raise NoToken if @token.to_s.empty?
11
+
12
+ @connections ||= {}
13
+ @connections[@token] ||= RestClient::Resource.new("#{tracker_url}#{api_path}", :headers => {
14
+ "X-TrackerToken" => @token,
15
+ "Content-Type" => "application/xml"
16
+ })
17
+ end
18
+
19
+ def clear_connections
20
+ @connections = nil
21
+ end
22
+
23
+ protected
24
+
25
+ def tracker_url
26
+ "https://www.pivotaltracker.com"
27
+ end
28
+
29
+ def api_path
30
+ "/services/v4/"
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,18 @@
1
+ module PivotalSync
2
+ class Comment
3
+ include HappyMapper
4
+
5
+ class << self
6
+
7
+ def all(project_id, story_id)
8
+ parse(Client.connection["projects/#{project_id}/stories/#{story_id}/comments"].get)
9
+ end
10
+
11
+ end
12
+
13
+ element :id, Integer
14
+ element :text, String
15
+ element :created_at, DateTime
16
+ has_one :author, Person
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ module PivotalSync
2
+ class Integration
3
+ include HappyMapper
4
+
5
+ element :id, Integer
6
+ element :type, String
7
+ element :name, String
8
+ element :field_name, String
9
+ element :field_label, String
10
+ element :active, Boolean
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ module PivotalSync
2
+ class Iteration
3
+ include HappyMapper
4
+
5
+ class << self
6
+
7
+ def all(project_id)
8
+ @all ||= parse(Client.connection["projects/#{project_id}/iterations"].get)
9
+ end
10
+
11
+ end
12
+
13
+ element :id, Integer
14
+ element :number, Integer
15
+ element :start, DateTime
16
+ element :finish, DateTime
17
+ element :team_strength, Float
18
+ has_many :stories, Story
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ module PivotalSync
2
+ class Membership
3
+ include HappyMapper
4
+
5
+ element :id, Integer
6
+ element :role, String
7
+ element :user_id, Integer, tag: "id", deep: true
8
+ element :name, String, deep: true
9
+ element :email, String, deep: true
10
+ element :initials, String, deep: true
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module PivotalSync
2
+ class Person
3
+ include HappyMapper
4
+
5
+ element :id, Integer, deep: true
6
+ element :email, String, deep: true
7
+ element :name, String, deep: true
8
+ element :initials, String, deep: true
9
+ end
10
+ end
@@ -0,0 +1,57 @@
1
+ module PivotalSync
2
+ class Project
3
+ include HappyMapper
4
+
5
+ class << self
6
+
7
+ def all
8
+ @all ||= parse(Client.connection["projects"].get)
9
+ end
10
+
11
+ def find(id)
12
+ if @all
13
+ @all.detect { |project| project.id == id}
14
+ else
15
+ parse(Client.connection["projects/#{id}"].get)
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ element :id, Integer
22
+ element :name, String
23
+ element :created_at, DateTime
24
+ element :version, Integer
25
+ element :iteration_length, Integer
26
+ element :week_start_day, String
27
+ element :point_scale, String
28
+ element :account, String
29
+ element :first_iteration_start_time, DateTime
30
+ element :current_iteration_number, Integer
31
+ element :enable_tasks, Boolean
32
+ element :velocity_scheme, String
33
+ element :current_velocity, Integer
34
+ element :initial_velocity, Integer
35
+ element :number_of_done_iterations_to_show, Integer
36
+ element :labels, String
37
+ element :allow_attachments, Boolean
38
+ element :public, Boolean
39
+ element :use_https, Boolean
40
+ element :bugs_and_chores_are_estimatable, Boolean
41
+ element :comit_mode, Boolean
42
+ element :last_activity_at, DateTime
43
+ has_many :memberships, Membership
44
+ has_many :integrations, Integration
45
+
46
+ def iterations
47
+ @iterations ||= {}
48
+ @iterations[id] ||= Iteration.all(id)
49
+ end
50
+
51
+ def stories
52
+ @stories ||= {}
53
+ @stories[id] ||= iterations.map { |i| i.stories }.flatten
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,53 @@
1
+ module PivotalSync
2
+ class Story
3
+ include HappyMapper
4
+
5
+ class << self
6
+
7
+ def all(project_id)
8
+ @all ||= {}
9
+ @all[project_id] ||= parse(Client.connection["projects/#{project_id}/stories"].get)
10
+ end
11
+
12
+ def find(id)
13
+ if @all
14
+ @all.detect { |story| story.id == id}
15
+ else
16
+ parse(Client.connection["stories/#{id}"].get)
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+ element :id, Integer
23
+ element :project_id, Integer
24
+ element :story_type, String
25
+ element :url, String
26
+ element :estimate, Float
27
+ element :current_state, String
28
+ element :description, String
29
+ element :name, String
30
+ element :created_at, DateTime
31
+ element :updated_at, DateTime
32
+ element :accepted_at, DateTime
33
+ element :labels, String
34
+ has_one :owned_by, Person
35
+ has_one :requested_by, Person
36
+ has_many :attachments, Attachment
37
+
38
+ def project
39
+ Project.find(project_id)
40
+ end
41
+
42
+ def comments
43
+ @comments ||= {}
44
+ @comments[id] ||= Comment.all(project_id, id)
45
+ end
46
+
47
+ def tasks
48
+ @tasks ||= {}
49
+ @tasks[id] ||= Task.all(project_id, id)
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,19 @@
1
+ module PivotalSync
2
+ class Task
3
+ include HappyMapper
4
+
5
+ class << self
6
+
7
+ def all(project_id, story_id)
8
+ parse(Client.connection["projects/#{project_id}/stories/#{story_id}/tasks"].get)
9
+ end
10
+
11
+ end
12
+
13
+ element :id, Integer
14
+ element :description, String
15
+ element :position, Integer
16
+ element :complete, Boolean
17
+ element :created_at, DateTime
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module PivotalSync
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/pivotal_sync.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "rest_client"
2
2
  require "happymapper"
3
3
 
4
- %w{version client attachment comment integration membership task story iteration project}.each do |req|
4
+ %w{version client person attachment comment integration membership task story iteration project}.each do |req|
5
5
  require File.join(File.dirname(__FILE__), "pivotal_sync", req)
6
6
  end
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <comments type="array">
3
+ <comment>
4
+ <id type="integer">39331775</id>
5
+ <text>Adding some comments here</text>
6
+ <author>
7
+ <person>
8
+ <id type="integer">126384</id>
9
+ <name>Brandon Hansen</name>
10
+ <initials>BH</initials>
11
+ </person>
12
+ </author>
13
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
14
+ </comment>
15
+ <comment>
16
+ <id type="integer">39331777</id>
17
+ <text>And a picture</text>
18
+ <author>
19
+ <person>
20
+ <id type="integer">126384</id>
21
+ <name>Brandon Hansen</name>
22
+ <initials>BH</initials>
23
+ </person>
24
+ </author>
25
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
26
+ </comment>
27
+ </comments>
@@ -0,0 +1,109 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <iterations type="array">
3
+ <iteration>
4
+ <id type="integer">1</id>
5
+ <number type="integer">1</number>
6
+ <start type="datetime">2013/03/18 07:00:00 UTC</start>
7
+ <finish type="datetime">2013/03/25 07:00:00 UTC</finish>
8
+ <team_strength type="float">1</team_strength>
9
+ <stories type="array">
10
+ <story>
11
+ <id type="integer">46499703</id>
12
+ <project_id type="integer">784123</project_id>
13
+ <story_type>feature</story_type>
14
+ <url>http://www.pivotaltracker.com/story/show/46499703</url>
15
+ <estimate type="float">1</estimate>
16
+ <current_state>unstarted</current_state>
17
+ <description>Sed et nisi sit amet leo tempus pulvinar nec vel magna. Pellentesque arcu metus, iaculis eget sollicitudin sit amet, scelerisque ut quam. Nullam mollis ligula at massa viverra luctus. Nulla non erat id arcu feugiat feugiat quis eget augue. Donec vestibulum pretium mi non porttitor. Nulla dapibus gravida mauris vel posuere. Sed dictum ultricies tellus vel venenatis.
18
+
19
+ &#402;&#172;&#729;&#8706;&#730;&#223;&#8710;&#729;&#402;</description>
20
+ <name>Just a little test</name>
21
+ <requested_by>
22
+ <person>
23
+ <id type="integer">126384</id>
24
+ <name>Brandon Hansen</name>
25
+ <initials>BH</initials>
26
+ </person>
27
+ </requested_by>
28
+ <owned_by>
29
+ <person>
30
+ <id type="integer">126384</id>
31
+ <name>Brandon Hansen</name>
32
+ <initials>BH</initials>
33
+ </person>
34
+ </owned_by>
35
+ <created_at type="datetime">2013/03/19 21:25:26 UTC</created_at>
36
+ <updated_at type="datetime">2013/03/19 21:33:26 UTC</updated_at>
37
+ <labels>123,testing,&#8710;&#730;&#730;&#8706;&#229;&#402;</labels>
38
+ <comments type="array">
39
+ <comment>
40
+ <id type="integer">39331775</id>
41
+ <text>Adding some comments here</text>
42
+ <author>
43
+ <person>
44
+ <id type="integer">126384</id>
45
+ <name>Brandon Hansen</name>
46
+ <initials>BH</initials>
47
+ </person>
48
+ </author>
49
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
50
+ </comment>
51
+ <comment>
52
+ <id type="integer">39331777</id>
53
+ <text>And a picture</text>
54
+ <author>
55
+ <person>
56
+ <id type="integer">126384</id>
57
+ <name>Brandon Hansen</name>
58
+ <initials>BH</initials>
59
+ </person>
60
+ </author>
61
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
62
+ </comment>
63
+ </comments>
64
+ <attachments type="array">
65
+ <attachment>
66
+ <id type="integer">17148567</id>
67
+ <filename>Screen_Shot_2013-03-19_at_12.01.09_PM.png</filename>
68
+ <uploaded_by>
69
+ <person>
70
+ <id type="integer">126384</id>
71
+ <name>Brandon Hansen</name>
72
+ <initials>BH</initials>
73
+ </person>
74
+ </uploaded_by>
75
+ <s3_resource>
76
+ <url>https://s3.amazonaws.com/prod.tracker2/resource/17148567/Screen_Shot_2013-03-19_at_12.01.09_PM.png?AWSAccessKeyId=AKIAIKWOAN6H4H3QMJ6Q&amp;Expires=1363730609&amp;Signature=1pyBFrkP86%2FqfErB%2FlP63H%2Bo41s%3D</url>
77
+ <expires type="datetime">2013/03/19 22:03:29 UTC</expires>
78
+ </s3_resource>
79
+ <uploaded_at type="datetime">2013/03/19 21:25:21 UTC</uploaded_at>
80
+ <url>https://www.pivotaltracker.com/resource/download/17148567</url>
81
+ </attachment>
82
+ </attachments>
83
+ <tasks type="array">
84
+ <task>
85
+ <id type="integer">13346287</id>
86
+ <description>Get</description>
87
+ <position type="integer">1</position>
88
+ <complete type="boolean">false</complete>
89
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
90
+ </task>
91
+ <task>
92
+ <id type="integer">13346289</id>
93
+ <description>It</description>
94
+ <position type="integer">2</position>
95
+ <complete type="boolean">false</complete>
96
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
97
+ </task>
98
+ <task>
99
+ <id type="integer">13346291</id>
100
+ <description>Done</description>
101
+ <position type="integer">3</position>
102
+ <complete type="boolean">true</complete>
103
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
104
+ </task>
105
+ </tasks>
106
+ </story>
107
+ </stories>
108
+ </iteration>
109
+ </iterations>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <memberships type="array">
3
+ <membership>
4
+ <id type="integer">2930385</id>
5
+ <member>
6
+ <person>
7
+ <id type="integer">126384</id>
8
+ <name>Brandon Hansen</name>
9
+ <initials>BH</initials>
10
+ </person>
11
+ </member>
12
+ <role>Owner</role>
13
+ <project>
14
+ <id type="integer">784123</id>
15
+ <name>Pivotal Sync Rspec</name>
16
+ </project>
17
+ </membership>
18
+ </memberships>
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projects type="array">
3
+ <project>
4
+ <id type="integer">784131</id>
5
+ <name>Rspec</name>
6
+ <created_at type="datetime">2013/03/19 21:18:10 UTC</created_at>
7
+ <version>1</version>
8
+ <iteration_length type="integer">1</iteration_length>
9
+ <week_start_day>Monday</week_start_day>
10
+ <point_scale>0,1,2,3</point_scale>
11
+ <account>Pivotal Tracker Sync</account>
12
+ <first_iteration_start_time type="datetime">2013/03/18 07:00:00 UTC</first_iteration_start_time>
13
+ <current_iteration_number type="integer">1</current_iteration_number>
14
+ <enable_tasks type="boolean">true</enable_tasks>
15
+ <velocity_scheme>Average of 3 iterations</velocity_scheme>
16
+ <current_velocity type="integer">10</current_velocity>
17
+ <initial_velocity type="integer">10</initial_velocity>
18
+ <number_of_done_iterations_to_show type="integer">12</number_of_done_iterations_to_show>
19
+ <labels></labels>
20
+ <allow_attachments type="boolean">true</allow_attachments>
21
+ <public type="boolean">true</public>
22
+ <use_https type="boolean">false</use_https>
23
+ <bugs_and_chores_are_estimatable type="boolean">false</bugs_and_chores_are_estimatable>
24
+ <commit_mode type="boolean">false</commit_mode>
25
+ <memberships type="array">
26
+ <membership>
27
+ <id type="integer">2930395</id>
28
+ <member>
29
+ <person>
30
+ <id type="integer">954155</id>
31
+ <email>pivotaltrackersync@gmail.com</email>
32
+ <name>Pivotal Tracker Sync</name>
33
+ <initials>PTS</initials>
34
+ </person>
35
+ </member>
36
+ <role>Owner</role>
37
+ </membership>
38
+ </memberships>
39
+ <integrations type="array">
40
+ </integrations>
41
+ </project>
42
+ </projects>
@@ -0,0 +1,100 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <stories type="array">
3
+ <story>
4
+ <id type="integer">46499703</id>
5
+ <project_id type="integer">784123</project_id>
6
+ <story_type>feature</story_type>
7
+ <url>http://www.pivotaltracker.com/story/show/46499703</url>
8
+ <estimate type="float">1</estimate>
9
+ <current_state>unstarted</current_state>
10
+ <description>Sed et nisi sit amet leo tempus pulvinar nec vel magna. Pellentesque arcu metus, iaculis eget sollicitudin sit amet, scelerisque ut quam. Nullam mollis ligula at massa viverra luctus. Nulla non erat id arcu feugiat feugiat quis eget augue. Donec vestibulum pretium mi non porttitor. Nulla dapibus gravida mauris vel posuere. Sed dictum ultricies tellus vel venenatis.
11
+
12
+ &#402;&#172;&#729;&#8706;&#730;&#223;&#8710;&#729;&#402;</description>
13
+ <name>Just a little test</name>
14
+ <requested_by>
15
+ <person>
16
+ <id type="integer">126384</id>
17
+ <name>Brandon Hansen</name>
18
+ <initials>BH</initials>
19
+ </person>
20
+ </requested_by>
21
+ <owned_by>
22
+ <person>
23
+ <id type="integer">126384</id>
24
+ <name>Brandon Hansen</name>
25
+ <initials>BH</initials>
26
+ </person>
27
+ </owned_by>
28
+ <created_at type="datetime">2013/03/19 21:25:26 UTC</created_at>
29
+ <updated_at type="datetime">2013/03/19 21:33:26 UTC</updated_at>
30
+ <labels>123,testing,&#8710;&#730;&#730;&#8706;&#229;&#402;</labels>
31
+ <comments type="array">
32
+ <comment>
33
+ <id type="integer">39331775</id>
34
+ <text>Adding some comments here</text>
35
+ <author>
36
+ <person>
37
+ <id type="integer">126384</id>
38
+ <name>Brandon Hansen</name>
39
+ <initials>BH</initials>
40
+ </person>
41
+ </author>
42
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
43
+ </comment>
44
+ <comment>
45
+ <id type="integer">39331777</id>
46
+ <text>And a picture</text>
47
+ <author>
48
+ <person>
49
+ <id type="integer">126384</id>
50
+ <name>Brandon Hansen</name>
51
+ <initials>BH</initials>
52
+ </person>
53
+ </author>
54
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
55
+ </comment>
56
+ </comments>
57
+ <attachments type="array">
58
+ <attachment>
59
+ <id type="integer">17148567</id>
60
+ <filename>Screen_Shot_2013-03-19_at_12.01.09_PM.png</filename>
61
+ <uploaded_by>
62
+ <person>
63
+ <id type="integer">126384</id>
64
+ <name>Brandon Hansen</name>
65
+ <initials>BH</initials>
66
+ </person>
67
+ </uploaded_by>
68
+ <s3_resource>
69
+ <url>https://s3.amazonaws.com/prod.tracker2/resource/17148567/Screen_Shot_2013-03-19_at_12.01.09_PM.png?AWSAccessKeyId=AKIAIKWOAN6H4H3QMJ6Q&amp;Expires=1363730677&amp;Signature=5ZiyAer7jZ9eHqZXcxX%2FNKJYahU%3D</url>
70
+ <expires type="datetime">2013/03/19 22:04:37 UTC</expires>
71
+ </s3_resource>
72
+ <uploaded_at type="datetime">2013/03/19 21:25:21 UTC</uploaded_at>
73
+ <url>https://www.pivotaltracker.com/resource/download/17148567</url>
74
+ </attachment>
75
+ </attachments>
76
+ <tasks type="array">
77
+ <task>
78
+ <id type="integer">13346287</id>
79
+ <description>Get</description>
80
+ <position type="integer">1</position>
81
+ <complete type="boolean">false</complete>
82
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
83
+ </task>
84
+ <task>
85
+ <id type="integer">13346289</id>
86
+ <description>It</description>
87
+ <position type="integer">2</position>
88
+ <complete type="boolean">false</complete>
89
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
90
+ </task>
91
+ <task>
92
+ <id type="integer">13346291</id>
93
+ <description>Done</description>
94
+ <position type="integer">3</position>
95
+ <complete type="boolean">true</complete>
96
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
97
+ </task>
98
+ </tasks>
99
+ </story>
100
+ </stories>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <tasks type="array">
3
+ <task>
4
+ <id type="integer">13346287</id>
5
+ <description>Get</description>
6
+ <position type="integer">1</position>
7
+ <complete type="boolean">false</complete>
8
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
9
+ </task>
10
+ <task>
11
+ <id type="integer">13346289</id>
12
+ <description>It</description>
13
+ <position type="integer">2</position>
14
+ <complete type="boolean">false</complete>
15
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
16
+ </task>
17
+ <task>
18
+ <id type="integer">13346291</id>
19
+ <description>Done</description>
20
+ <position type="integer">3</position>
21
+ <complete type="boolean">true</complete>
22
+ <created_at type="datetime">2013/03/19 21:25:27 UTC</created_at>
23
+ </task>
24
+ </tasks>
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Attachment do
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Client do
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Comment do
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Integration do
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Iteration do
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Membership do
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Person do
4
+
5
+ end
@@ -0,0 +1,69 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Project do
4
+
5
+ before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}projects.xml", "rb") }
6
+ after(:each) { @file.close }
7
+
8
+ let(:projects) { PivotalSync::Project.parse(@file.read) }
9
+ let(:project) { projects.first }
10
+
11
+ context "data" do
12
+
13
+ it "should be an array of projects" do
14
+ projects.should be_a(Array)
15
+ end
16
+
17
+ it "should have id" do
18
+ project.id.should_not be_nil
19
+ end
20
+
21
+ it "should have name" do
22
+ project.name.should_not be_nil
23
+ end
24
+
25
+ end
26
+
27
+ context "associations" do
28
+
29
+ context "memberships" do
30
+
31
+ let(:membership) { project.memberships.first }
32
+
33
+ it "should have many memberships" do
34
+ project.memberships.should be_a(Array)
35
+ end
36
+
37
+ it "should have an id" do
38
+ membership.id.should_not be_nil
39
+ end
40
+
41
+ it "should have a name" do
42
+ membership.name.should_not be_nil
43
+ end
44
+
45
+ end
46
+
47
+ context "iterations" do
48
+
49
+ it "should have many iterations" do
50
+ project.iterations.should be_a(Array)
51
+ end
52
+
53
+ end
54
+
55
+ context "stories" do
56
+
57
+ it "should have many stories" do
58
+ project.stories.should be_a(Array)
59
+ end
60
+
61
+ end
62
+
63
+ it "should have many integrations" do
64
+ project.integrations.should be_a(Array)
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,115 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Story do
4
+
5
+ before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}stories.xml", "rb") }
6
+ after(:each) { @file.close }
7
+
8
+ let(:stories) { PivotalSync::Story.parse(@file.read) }
9
+ let(:story) { stories.first }
10
+
11
+ context "data" do
12
+
13
+ it "should be an array of stories" do
14
+ stories.should be_a(Array)
15
+ end
16
+
17
+ it "should have id" do
18
+ story.id.should_not be_nil
19
+ end
20
+
21
+ it "should have labels" do
22
+ story.labels.should_not be_nil
23
+ end
24
+
25
+ end
26
+
27
+ context "associations" do
28
+
29
+ context "owner" do
30
+
31
+ let(:owned_by) { story.owned_by }
32
+
33
+ it "should belong to a owner" do
34
+ story.should respond_to(:owned_by)
35
+ end
36
+
37
+ it "should be of class person" do
38
+ owned_by.should be_a(PivotalSync::Person)
39
+ end
40
+
41
+ it "should have an id" do
42
+ owned_by.id.should == 126384
43
+ end
44
+
45
+ it "should be owned by brandon" do
46
+ owned_by.name.should == "Brandon Hansen"
47
+ end
48
+
49
+ it "should have initials BH" do
50
+ owned_by.initials.should == "BH"
51
+ end
52
+
53
+ end
54
+
55
+ context "requester" do
56
+
57
+ let(:requested_by) { story.requested_by }
58
+
59
+ it "should belong to a owner" do
60
+ story.should respond_to(:requested_by)
61
+ end
62
+
63
+ it "should be of class person" do
64
+ requested_by.should be_a(PivotalSync::Person)
65
+ end
66
+
67
+ it "should have an id" do
68
+ requested_by.id.should == 126384
69
+ end
70
+
71
+ it "should be requested by brandon" do
72
+ requested_by.name.should == "Brandon Hansen"
73
+ end
74
+
75
+ it "should have initials BH" do
76
+ requested_by.initials.should == "BH"
77
+ end
78
+
79
+ end
80
+
81
+ context "attachments" do
82
+
83
+ it "should have many attachments" do
84
+ story.tasks.should be_a(Array)
85
+ end
86
+
87
+ end
88
+
89
+ context "project" do
90
+
91
+ it "should belong to a project" do
92
+ story.should respond_to(:project)
93
+ end
94
+
95
+ end
96
+
97
+ context "comments" do
98
+
99
+ it "should have many comments" do
100
+ story.comments.should be_a(Array)
101
+ end
102
+
103
+ end
104
+
105
+ context "tasks" do
106
+
107
+ it "should have many tasks" do
108
+ story.tasks.should be_a(Array)
109
+ end
110
+
111
+ end
112
+
113
+ end
114
+
115
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe PivotalSync::Task do
4
+
5
+ end
@@ -0,0 +1,28 @@
1
+ require "bundler"
2
+ require "fileutils"
3
+
4
+ Bundler.require(:default, :runtime, :test)
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
7
+
8
+ require "pivotal_sync"
9
+ require "rspec"
10
+ require "rspec/autorun"
11
+
12
+ PROJECT_ID = ENV["PROJECT_ID"] || 784131
13
+ TOKEN = "f95c5605f1658de48719ec0daa2f24ca"
14
+
15
+
16
+ PivotalSync::Client.token = TOKEN
17
+ # Requires supporting files with custom matchers and macros, etc,
18
+ # in ./support/ and its subdirectories.
19
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),"support","**","*.rb"))].each {|f| require f}
20
+
21
+
22
+ RSpec.configure do |config|
23
+ config.add_setting :fixture_path
24
+ config.fixture_path = "#{File.expand_path(File.dirname(__FILE__))}/fixtures/"
25
+ config.before :each do
26
+ PivotalSync::Client.clear_connections
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -51,13 +51,41 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
+ - .rspec
54
55
  - Gemfile
55
56
  - LICENSE.txt
56
57
  - README.md
57
58
  - Rakefile
58
59
  - lib/pivotal_sync.rb
60
+ - lib/pivotal_sync/attachment.rb
61
+ - lib/pivotal_sync/client.rb
62
+ - lib/pivotal_sync/comment.rb
63
+ - lib/pivotal_sync/integration.rb
64
+ - lib/pivotal_sync/iteration.rb
65
+ - lib/pivotal_sync/membership.rb
66
+ - lib/pivotal_sync/person.rb
67
+ - lib/pivotal_sync/project.rb
68
+ - lib/pivotal_sync/story.rb
69
+ - lib/pivotal_sync/task.rb
59
70
  - lib/pivotal_sync/version.rb
60
71
  - pivotal_sync.gemspec
72
+ - spec/fixtures/comments.xml
73
+ - spec/fixtures/iterations.xml
74
+ - spec/fixtures/memberships.xml
75
+ - spec/fixtures/projects.xml
76
+ - spec/fixtures/stories.xml
77
+ - spec/fixtures/tasks.xml
78
+ - spec/pivotal_sync/attachment_spec.rb
79
+ - spec/pivotal_sync/client_spec.rb
80
+ - spec/pivotal_sync/comment_spec.rb
81
+ - spec/pivotal_sync/integration_spec.rb
82
+ - spec/pivotal_sync/iteration_spec.rb
83
+ - spec/pivotal_sync/membership_spec.rb
84
+ - spec/pivotal_sync/person_spec.rb
85
+ - spec/pivotal_sync/project_spec.rb
86
+ - spec/pivotal_sync/story_spec.rb
87
+ - spec/pivotal_sync/task_spec.rb
88
+ - spec/spec_helper.rb
61
89
  homepage: https://github.com/ready4god2513/pivotal_sync
62
90
  licenses:
63
91
  - MIT
@@ -83,4 +111,21 @@ rubygems_version: 1.8.25
83
111
  signing_key:
84
112
  specification_version: 3
85
113
  summary: Read from the Pivotal Tracker v4 api
86
- test_files: []
114
+ test_files:
115
+ - spec/fixtures/comments.xml
116
+ - spec/fixtures/iterations.xml
117
+ - spec/fixtures/memberships.xml
118
+ - spec/fixtures/projects.xml
119
+ - spec/fixtures/stories.xml
120
+ - spec/fixtures/tasks.xml
121
+ - spec/pivotal_sync/attachment_spec.rb
122
+ - spec/pivotal_sync/client_spec.rb
123
+ - spec/pivotal_sync/comment_spec.rb
124
+ - spec/pivotal_sync/integration_spec.rb
125
+ - spec/pivotal_sync/iteration_spec.rb
126
+ - spec/pivotal_sync/membership_spec.rb
127
+ - spec/pivotal_sync/person_spec.rb
128
+ - spec/pivotal_sync/project_spec.rb
129
+ - spec/pivotal_sync/story_spec.rb
130
+ - spec/pivotal_sync/task_spec.rb
131
+ - spec/spec_helper.rb