trajectory 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +6 -0
  6. data/Gemfile +19 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +57 -0
  9. data/Rakefile +18 -0
  10. data/config/env.yml +3 -0
  11. data/lib/trajectory/client.rb +24 -0
  12. data/lib/trajectory/core_ext/hash.rb +8 -0
  13. data/lib/trajectory/core_ext.rb +1 -0
  14. data/lib/trajectory/data_access/api.rb +54 -0
  15. data/lib/trajectory/data_access/data_store.rb +70 -0
  16. data/lib/trajectory/data_access.rb +2 -0
  17. data/lib/trajectory/domain/idea.rb +70 -0
  18. data/lib/trajectory/domain/ideas.rb +23 -0
  19. data/lib/trajectory/domain/iteration.rb +85 -0
  20. data/lib/trajectory/domain/iterations.rb +46 -0
  21. data/lib/trajectory/domain/project.rb +168 -0
  22. data/lib/trajectory/domain/projects.rb +55 -0
  23. data/lib/trajectory/domain/stories.rb +56 -0
  24. data/lib/trajectory/domain/story.rb +119 -0
  25. data/lib/trajectory/domain/update.rb +17 -0
  26. data/lib/trajectory/domain/user.rb +28 -0
  27. data/lib/trajectory/domain/users.rb +30 -0
  28. data/lib/trajectory/domain.rb +11 -0
  29. data/lib/trajectory/exceptions/bad_environment_error.rb +7 -0
  30. data/lib/trajectory/exceptions/missing_attribute_error.rb +12 -0
  31. data/lib/trajectory/exceptions/velocity_equal_to_zero_error.rb +11 -0
  32. data/lib/trajectory/exceptions.rb +3 -0
  33. data/lib/trajectory/version.rb +3 -0
  34. data/lib/trajectory.rb +15 -0
  35. data/spec/fabricators/iteration_fabricator.rb +18 -0
  36. data/spec/fabricators/project_fabricator.rb +11 -0
  37. data/spec/fabricators/story_fabricator.rb +18 -0
  38. data/spec/fixtures/vcr_cassettes/client.yml +853 -0
  39. data/spec/fixtures/vcr_cassettes/projects_and_ideas.yml +98 -0
  40. data/spec/fixtures/vcr_cassettes/projects_and_ideas_association.yml +52 -0
  41. data/spec/fixtures/vcr_cassettes/projects_and_iterations.yml +49 -0
  42. data/spec/fixtures/vcr_cassettes/projects_and_iterations_association.yml +49 -0
  43. data/spec/fixtures/vcr_cassettes/projects_and_stories.yml +101 -0
  44. data/spec/fixtures/vcr_cassettes/projects_and_stories_association.yml +147 -0
  45. data/spec/integration/client_spec.rb +96 -0
  46. data/spec/spec_helper.rb +13 -0
  47. data/spec/support/env.rb +11 -0
  48. data/spec/support/fabrication.rb +1 -0
  49. data/spec/support/simple_cov.rb +11 -0
  50. data/spec/support/timecop.rb +1 -0
  51. data/spec/support/vcr.rb +8 -0
  52. data/spec/unit/client_spec.rb +27 -0
  53. data/spec/unit/core_ext/hash_spec.rb +11 -0
  54. data/spec/unit/data_access/api_spec.rb +100 -0
  55. data/spec/unit/data_access/data_store_spec.rb +86 -0
  56. data/spec/unit/domain/idea_spec.rb +46 -0
  57. data/spec/unit/domain/ideas_spec.rb +22 -0
  58. data/spec/unit/domain/iteration_spec.rb +51 -0
  59. data/spec/unit/domain/iterations_spec.rb +47 -0
  60. data/spec/unit/domain/project_spec.rb +163 -0
  61. data/spec/unit/domain/projects_spec.rb +84 -0
  62. data/spec/unit/domain/stories_spec.rb +84 -0
  63. data/spec/unit/domain/story_spec.rb +71 -0
  64. data/spec/unit/domain/user_spec.rb +29 -0
  65. data/spec/unit/domain/users_spec.rb +36 -0
  66. data/spec/unit/exceptions/bad_environment_error_spec.rb +9 -0
  67. data/spec/unit/exceptions/missing_attribute_error_spec.rb +10 -0
  68. data/spec/unit/exceptions/velocity_equal_to_zero_error_spec.rb +10 -0
  69. data/trajectory.gemspec +21 -0
  70. metadata +174 -0
@@ -0,0 +1,98 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Cache-Control:
18
+ - max-age=0, private, must-revalidate
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Thu, 28 Feb 2013 14:05:44 GMT
23
+ Etag:
24
+ - ! '"4276580bd177fe4b3ffe81cb4bc3a023"'
25
+ Server:
26
+ - thin 1.3.1 codename Triple Espresso
27
+ Set-Cookie:
28
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJThmNGIzYTQxYjc1ZDgyNGQ3MTAyNmM2Y2JiMThlYjJkBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--ecef548e655974c85e5d4194667f533e8ecf89e2;
29
+ path=/; HttpOnly
30
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
31
+ 28-Feb-2014 14:05:44 GMT
32
+ X-Rack-Cache:
33
+ - miss
34
+ X-Request-Id:
35
+ - 8ac27ef6630c06abfe1bff8157bfe3a7
36
+ X-Runtime:
37
+ - '0.057938'
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Transfer-Encoding:
41
+ - chunked
42
+ Connection:
43
+ - keep-alive
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ! '[{"archived":false,"created_at":"2013-02-19T16:32:06+00:00","estimated_velocity":13,"historic_velocity":[1],"id":15504817,"keyword":"test","name":"test-project","updated_at":"2013-02-28T13:40:44+00:00","completed_iterations_count":1,"completed_stories_count":1,"users":[{"created_at":"2013-02-19T16:31:47+00:00","email":"loic.minaudier+fake-user-for-api@gmail.com","id":15506817,"name":"loic-minaudier-fake-user-for-api","updated_at":"2013-02-19T16:31:47+00:00","gravatar_url":"https://secure.gravatar.com/avatar/9ddba4784ddfcd87efaf03ba3b96e51c.png?d=https%3A%2F%2Fwww.apptrajectory.com%2Fassets%2Fuser.png&r=PG&s=150"}],"subscribed_user_names":["loic-minaudier-fake-user-for-api"],"subscribed_user_ids":[15506817],"tags":[]}]'
47
+ http_version:
48
+ recorded_at: Thu, 28 Feb 2013 14:05:48 GMT
49
+ - request:
50
+ method: get
51
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/ideas.json
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ''
55
+ headers:
56
+ Content-Type:
57
+ - application/json
58
+ response:
59
+ status:
60
+ code: 200
61
+ message: OK
62
+ headers:
63
+ Cache-Control:
64
+ - max-age=0, private, must-revalidate
65
+ Content-Type:
66
+ - application/json; charset=utf-8
67
+ Date:
68
+ - Thu, 28 Feb 2013 14:05:48 GMT
69
+ Etag:
70
+ - ! '"e8b6e0e36a2bdc3b3fd44a0b2ff2f0f7"'
71
+ Server:
72
+ - thin 1.3.1 codename Triple Espresso
73
+ Set-Cookie:
74
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWU3YjBhODRjZDg2MWM5ZmFkZDI3ODYyYTk5ZGJhNDYzBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--ea38487a84f534d64a696a95257af1bf828e700d;
75
+ path=/; HttpOnly
76
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
77
+ 28-Feb-2014 14:05:48 GMT
78
+ X-Rack-Cache:
79
+ - miss
80
+ X-Request-Id:
81
+ - 84773b050012acbb7ab52ea80c626913
82
+ X-Runtime:
83
+ - '0.278867'
84
+ X-Ua-Compatible:
85
+ - IE=Edge,chrome=1
86
+ Transfer-Encoding:
87
+ - chunked
88
+ Connection:
89
+ - keep-alive
90
+ body:
91
+ encoding: US-ASCII
92
+ string: ! '[{"body":"Some content for idea 2","comments_count":0,"created_at":"2013-02-28T14:40:44+01:00","id":15505355,"last_activity_at":"2013-02-28T14:40:44+01:00","lookup_hash":"d106c797a22ada9a36c8","project_id":15504817,"subject":"Idea
93
+ 2","updated_at":"2013-02-28T14:40:44+01:00","user_id":15506817,"user":{"created_at":"2013-02-19T17:31:47+01:00","email":"loic.minaudier+fake-user-for-api@gmail.com","id":15506817,"name":"loic-minaudier-fake-user-for-api","updated_at":"2013-02-19T17:31:47+01:00","gravatar_url":"https://secure.gravatar.com/avatar/9ddba4784ddfcd87efaf03ba3b96e51c.png?d=https%3A%2F%2Fwww.apptrajectory.com%2Fassets%2Fuser.png&r=PG&s=150"},"upload_ids":[],"stories_count":0,"accepted_stories_count":0,"last_comment_user_name":null,"subscribed_user_ids":[15506817],"last_activity_at":"2013-02-28T14:40:44+01:00","state":"in-progress","story_ids":[]},{"body":"some
94
+ content for idea 1","comments_count":0,"created_at":"2013-02-28T14:40:25+01:00","id":15505354,"last_activity_at":"2013-02-28T14:40:25+01:00","lookup_hash":"695fb9b05740b30c3a76","project_id":15504817,"subject":"idea
95
+ 1","updated_at":"2013-02-28T14:40:25+01:00","user_id":15506817,"user":{"created_at":"2013-02-19T17:31:47+01:00","email":"loic.minaudier+fake-user-for-api@gmail.com","id":15506817,"name":"loic-minaudier-fake-user-for-api","updated_at":"2013-02-19T17:31:47+01:00","gravatar_url":"https://secure.gravatar.com/avatar/9ddba4784ddfcd87efaf03ba3b96e51c.png?d=https%3A%2F%2Fwww.apptrajectory.com%2Fassets%2Fuser.png&r=PG&s=150"},"upload_ids":[],"stories_count":0,"accepted_stories_count":0,"last_comment_user_name":null,"subscribed_user_ids":[15506817],"last_activity_at":"2013-02-28T14:40:25+01:00","state":"in-progress","story_ids":[]}]'
96
+ http_version:
97
+ recorded_at: Thu, 28 Feb 2013 14:05:52 GMT
98
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/ideas.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Cache-Control:
18
+ - max-age=0, private, must-revalidate
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Thu, 28 Feb 2013 14:05:56 GMT
23
+ Etag:
24
+ - ! '"e8b6e0e36a2bdc3b3fd44a0b2ff2f0f7"'
25
+ Server:
26
+ - thin 1.3.1 codename Triple Espresso
27
+ Set-Cookie:
28
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTkyNjY1ODg3OGNiN2E0MTMwMDIyMzVhYjE1OWEyYjFkBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--0e19c68379d7f1df6711170eab22d66c9fabd660;
29
+ path=/; HttpOnly
30
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
31
+ 28-Feb-2014 14:05:56 GMT
32
+ X-Rack-Cache:
33
+ - miss
34
+ X-Request-Id:
35
+ - b11b7d5bf0faecf4ca717ec1bf8f7ed8
36
+ X-Runtime:
37
+ - '0.089185'
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Transfer-Encoding:
41
+ - chunked
42
+ Connection:
43
+ - keep-alive
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ! '[{"body":"Some content for idea 2","comments_count":0,"created_at":"2013-02-28T14:40:44+01:00","id":15505355,"last_activity_at":"2013-02-28T14:40:44+01:00","lookup_hash":"d106c797a22ada9a36c8","project_id":15504817,"subject":"Idea
47
+ 2","updated_at":"2013-02-28T14:40:44+01:00","user_id":15506817,"user":{"created_at":"2013-02-19T17:31:47+01:00","email":"loic.minaudier+fake-user-for-api@gmail.com","id":15506817,"name":"loic-minaudier-fake-user-for-api","updated_at":"2013-02-19T17:31:47+01:00","gravatar_url":"https://secure.gravatar.com/avatar/9ddba4784ddfcd87efaf03ba3b96e51c.png?d=https%3A%2F%2Fwww.apptrajectory.com%2Fassets%2Fuser.png&r=PG&s=150"},"upload_ids":[],"stories_count":0,"accepted_stories_count":0,"last_comment_user_name":null,"subscribed_user_ids":[15506817],"last_activity_at":"2013-02-28T14:40:44+01:00","state":"in-progress","story_ids":[]},{"body":"some
48
+ content for idea 1","comments_count":0,"created_at":"2013-02-28T14:40:25+01:00","id":15505354,"last_activity_at":"2013-02-28T14:40:25+01:00","lookup_hash":"695fb9b05740b30c3a76","project_id":15504817,"subject":"idea
49
+ 1","updated_at":"2013-02-28T14:40:25+01:00","user_id":15506817,"user":{"created_at":"2013-02-19T17:31:47+01:00","email":"loic.minaudier+fake-user-for-api@gmail.com","id":15506817,"name":"loic-minaudier-fake-user-for-api","updated_at":"2013-02-19T17:31:47+01:00","gravatar_url":"https://secure.gravatar.com/avatar/9ddba4784ddfcd87efaf03ba3b96e51c.png?d=https%3A%2F%2Fwww.apptrajectory.com%2Fassets%2Fuser.png&r=PG&s=150"},"upload_ids":[],"stories_count":0,"accepted_stories_count":0,"last_comment_user_name":null,"subscribed_user_ids":[15506817],"last_activity_at":"2013-02-28T14:40:25+01:00","state":"in-progress","story_ids":[]}]'
50
+ http_version:
51
+ recorded_at: Thu, 28 Feb 2013 14:06:00 GMT
52
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/iterations.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Cache-Control:
18
+ - max-age=0, private, must-revalidate
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Thu, 28 Feb 2013 14:05:49 GMT
23
+ Etag:
24
+ - ! '"2363bebac35f4b90f94ae57cb3f12cd7"'
25
+ Server:
26
+ - thin 1.3.1 codename Triple Espresso
27
+ Set-Cookie:
28
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTE0ZWY4YzlmMTRjZTY4YTY0OTI0ODAyNjMxZjQ4YmFiBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--b8ccede807d80f7cd4dc1e70fc42baf5c8e0f63d;
29
+ path=/; HttpOnly
30
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
31
+ 28-Feb-2014 14:05:49 GMT
32
+ X-Rack-Cache:
33
+ - miss
34
+ X-Request-Id:
35
+ - 091559cc49766c9dbd4708e57bcd5a77
36
+ X-Runtime:
37
+ - '0.055121'
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Transfer-Encoding:
41
+ - chunked
42
+ Connection:
43
+ - keep-alive
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ! '[{"accepted_points":1,"comments_count":0,"complete":true,"created_at":"2013-02-19T17:32:06+01:00","estimated_points":1,"estimated_velocity":20,"id":16055704,"starts_on":"2013-02-18","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":100,"current?":false,"future?":false,"accepted_stories_count":1},{"accepted_points":0,"comments_count":0,"complete":false,"created_at":"2013-02-25T01:05:09+01:00","estimated_points":0,"estimated_velocity":13,"id":16057164,"starts_on":"2013-02-25","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":0,"current?":true,"future?":false,"accepted_stories_count":0}]'
47
+ http_version:
48
+ recorded_at: Thu, 28 Feb 2013 14:05:53 GMT
49
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/iterations.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Cache-Control:
18
+ - max-age=0, private, must-revalidate
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Thu, 28 Feb 2013 14:05:57 GMT
23
+ Etag:
24
+ - ! '"2363bebac35f4b90f94ae57cb3f12cd7"'
25
+ Server:
26
+ - thin 1.3.1 codename Triple Espresso
27
+ Set-Cookie:
28
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWNhOGYyNjk0OGFmMmQ5MjM0YTg3MjA4M2QzYzZjZmM4BjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--0a1555757c70b6b27c0404a0164131c856f3aabf;
29
+ path=/; HttpOnly
30
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
31
+ 28-Feb-2014 14:05:57 GMT
32
+ X-Rack-Cache:
33
+ - miss
34
+ X-Request-Id:
35
+ - 24b9719f0fd1637994fbaf82bec01ff0
36
+ X-Runtime:
37
+ - '0.051028'
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Transfer-Encoding:
41
+ - chunked
42
+ Connection:
43
+ - keep-alive
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ! '[{"accepted_points":1,"comments_count":0,"complete":true,"created_at":"2013-02-19T17:32:06+01:00","estimated_points":1,"estimated_velocity":20,"id":16055704,"starts_on":"2013-02-18","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":100,"current?":false,"future?":false,"accepted_stories_count":1},{"accepted_points":0,"comments_count":0,"complete":false,"created_at":"2013-02-25T01:05:09+01:00","estimated_points":0,"estimated_velocity":13,"id":16057164,"starts_on":"2013-02-25","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":0,"current?":true,"future?":false,"accepted_stories_count":0}]'
47
+ http_version:
48
+ recorded_at: Thu, 28 Feb 2013 14:06:00 GMT
49
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,101 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/stories/completed.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Cache-Control:
18
+ - max-age=0, private, must-revalidate
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Thu, 28 Feb 2013 14:05:50 GMT
23
+ Etag:
24
+ - ! '"b5a3b3e439838c6116224ffa1a348e0a"'
25
+ Last-Modified:
26
+ - Mon, 25 Feb 2013 00:05:09 GMT
27
+ Server:
28
+ - thin 1.3.1 codename Triple Espresso
29
+ Set-Cookie:
30
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWEyYjg4MzcwMzVmNzJjYzVjYzhmZjVjMjQ2NDEyMGNhBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--90a0e19d7e7418abfcb300502dedaf1c16af0912;
31
+ path=/; HttpOnly
32
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
33
+ 28-Feb-2014 14:05:50 GMT
34
+ X-Rack-Cache:
35
+ - miss
36
+ X-Request-Id:
37
+ - cdb861fe9e93d36750dbb91d3f27e0d0
38
+ X-Runtime:
39
+ - '0.086648'
40
+ X-Ua-Compatible:
41
+ - IE=Edge,chrome=1
42
+ Transfer-Encoding:
43
+ - chunked
44
+ Connection:
45
+ - keep-alive
46
+ body:
47
+ encoding: US-ASCII
48
+ string: ! '{"stories":[{"archived":true,"assignee_id":15506817,"branch":"l-story-1","comments_count":0,"created_at":"2013-02-21T16:49:27+01:00","deleted":false,"design_needed":false,"development_needed":false,"id":15623694,"idea_id":null,"iteration_id":16055704,"points":1,"position":100,"state":"accepted","task_type":"Feature","title":"story
49
+ 1","updated_at":"2013-02-22T11:46:44+01:00","user_id":15506817,"state_events":["unaccept"],"comma_separated_tags":null}],"iterations":[{"accepted_points":1,"comments_count":0,"complete":true,"created_at":"2013-02-19T17:32:06+01:00","estimated_points":1,"estimated_velocity":20,"id":16055704,"starts_on":"2013-02-18","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":100,"current?":false,"future?":false,"accepted_stories_count":1}]}'
50
+ http_version:
51
+ recorded_at: Thu, 28 Feb 2013 14:05:53 GMT
52
+ - request:
53
+ method: get
54
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/stories.json
55
+ body:
56
+ encoding: US-ASCII
57
+ string: ''
58
+ headers:
59
+ Content-Type:
60
+ - application/json
61
+ response:
62
+ status:
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ Cache-Control:
67
+ - max-age=0, private, must-revalidate
68
+ Content-Type:
69
+ - application/json; charset=utf-8
70
+ Date:
71
+ - Thu, 28 Feb 2013 14:05:50 GMT
72
+ Etag:
73
+ - ! '"b5a3b3e439838c6116224ffa1a348e0a"'
74
+ Last-Modified:
75
+ - Mon, 25 Feb 2013 00:05:09 GMT
76
+ Server:
77
+ - thin 1.3.1 codename Triple Espresso
78
+ Set-Cookie:
79
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWMyOTFhNTU3ZWJhN2FhOTcxZTVkNzc3N2U4OWJiODVjBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--fd4023b099e0a1577449beeb1224d9a593108580;
80
+ path=/; HttpOnly
81
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
82
+ 28-Feb-2014 14:05:50 GMT
83
+ X-Rack-Cache:
84
+ - miss
85
+ X-Request-Id:
86
+ - c68abc3faa872e76365bbb24064bf11e
87
+ X-Runtime:
88
+ - '0.071767'
89
+ X-Ua-Compatible:
90
+ - IE=Edge,chrome=1
91
+ Transfer-Encoding:
92
+ - chunked
93
+ Connection:
94
+ - keep-alive
95
+ body:
96
+ encoding: US-ASCII
97
+ string: ! '{"stories":[{"archived":false,"assignee_id":null,"branch":null,"comments_count":0,"created_at":"2013-02-21T16:49:31+01:00","deleted":false,"design_needed":false,"development_needed":false,"id":15623695,"idea_id":null,"iteration_id":16057164,"points":0,"position":200,"state":"unstarted","task_type":"Feature","title":"story
98
+ 2","updated_at":"2013-02-25T01:05:09+01:00","user_id":15506817,"state_events":["start"],"comma_separated_tags":null}],"iterations":[{"accepted_points":0,"comments_count":0,"complete":false,"created_at":"2013-02-25T01:05:09+01:00","estimated_points":0,"estimated_velocity":13,"id":16057164,"starts_on":"2013-02-25","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":0,"current?":true,"future?":false,"accepted_stories_count":0}]}'
99
+ http_version:
100
+ recorded_at: Thu, 28 Feb 2013 14:05:54 GMT
101
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,147 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Cache-Control:
18
+ - max-age=0, private, must-revalidate
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Thu, 28 Feb 2013 14:05:54 GMT
23
+ Etag:
24
+ - ! '"bfeab5f9c99936d290d55a9a8fa0e1ea"'
25
+ Server:
26
+ - thin 1.3.1 codename Triple Espresso
27
+ Set-Cookie:
28
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWMzNGY3NzFmMDQ5Y2M4YWM1N2VkYThkMzUyYWIxNjViBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--adfcd90900e0c66d5f993a395706ca90c2c9ba4c;
29
+ path=/; HttpOnly
30
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
31
+ 28-Feb-2014 14:05:54 GMT
32
+ X-Rack-Cache:
33
+ - miss
34
+ X-Request-Id:
35
+ - 189b3846cb449ab5615d0a1924bee886
36
+ X-Runtime:
37
+ - '0.218572'
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Transfer-Encoding:
41
+ - chunked
42
+ Connection:
43
+ - keep-alive
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ! '[{"archived":false,"created_at":"2013-02-19T18:32:06+02:00","estimated_velocity":13,"historic_velocity":[1],"id":15504817,"keyword":"test","name":"test-project","updated_at":"2013-02-28T15:40:44+02:00","completed_iterations_count":1,"completed_stories_count":1,"users":[{"created_at":"2013-02-19T18:31:47+02:00","email":"loic.minaudier+fake-user-for-api@gmail.com","id":15506817,"name":"loic-minaudier-fake-user-for-api","updated_at":"2013-02-19T18:31:47+02:00","gravatar_url":"https://secure.gravatar.com/avatar/9ddba4784ddfcd87efaf03ba3b96e51c.png?d=https%3A%2F%2Fwww.apptrajectory.com%2Fassets%2Fuser.png&r=PG&s=150"}],"subscribed_user_names":["loic-minaudier-fake-user-for-api"],"subscribed_user_ids":[15506817],"tags":[]}]'
47
+ http_version:
48
+ recorded_at: Thu, 28 Feb 2013 14:05:58 GMT
49
+ - request:
50
+ method: get
51
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/stories/completed.json
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ''
55
+ headers:
56
+ Content-Type:
57
+ - application/json
58
+ response:
59
+ status:
60
+ code: 200
61
+ message: OK
62
+ headers:
63
+ Cache-Control:
64
+ - max-age=0, private, must-revalidate
65
+ Content-Type:
66
+ - application/json; charset=utf-8
67
+ Date:
68
+ - Thu, 28 Feb 2013 14:05:55 GMT
69
+ Etag:
70
+ - ! '"b5a3b3e439838c6116224ffa1a348e0a"'
71
+ Last-Modified:
72
+ - Mon, 25 Feb 2013 00:05:09 GMT
73
+ Server:
74
+ - thin 1.3.1 codename Triple Espresso
75
+ Set-Cookie:
76
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTRmYmVlZjBjOWVjZDJmOTFkYjdkNzM5N2VhZTUyZGEzBjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--94df3f0d04b0316524c5065f8ad9c1c7b1bab421;
77
+ path=/; HttpOnly
78
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
79
+ 28-Feb-2014 14:05:55 GMT
80
+ X-Rack-Cache:
81
+ - miss
82
+ X-Request-Id:
83
+ - 10b5650617622d8b76ba636d42a838dd
84
+ X-Runtime:
85
+ - '0.135518'
86
+ X-Ua-Compatible:
87
+ - IE=Edge,chrome=1
88
+ Transfer-Encoding:
89
+ - chunked
90
+ Connection:
91
+ - keep-alive
92
+ body:
93
+ encoding: US-ASCII
94
+ string: ! '{"stories":[{"archived":true,"assignee_id":15506817,"branch":"l-story-1","comments_count":0,"created_at":"2013-02-21T16:49:27+01:00","deleted":false,"design_needed":false,"development_needed":false,"id":15623694,"idea_id":null,"iteration_id":16055704,"points":1,"position":100,"state":"accepted","task_type":"Feature","title":"story
95
+ 1","updated_at":"2013-02-22T11:46:44+01:00","user_id":15506817,"state_events":["unaccept"],"comma_separated_tags":null}],"iterations":[{"accepted_points":1,"comments_count":0,"complete":true,"created_at":"2013-02-19T17:32:06+01:00","estimated_points":1,"estimated_velocity":20,"id":16055704,"starts_on":"2013-02-18","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":100,"current?":false,"future?":false,"accepted_stories_count":1}]}'
96
+ http_version:
97
+ recorded_at: Thu, 28 Feb 2013 14:05:58 GMT
98
+ - request:
99
+ method: get
100
+ uri: https://www.apptrajectory.com/api/76900a72434cfe249da911eea2a6c94a/accounts/fake-user-for-api-test/projects/test/stories.json
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ''
104
+ headers:
105
+ Content-Type:
106
+ - application/json
107
+ response:
108
+ status:
109
+ code: 200
110
+ message: OK
111
+ headers:
112
+ Cache-Control:
113
+ - max-age=0, private, must-revalidate
114
+ Content-Type:
115
+ - application/json; charset=utf-8
116
+ Date:
117
+ - Thu, 28 Feb 2013 14:05:56 GMT
118
+ Etag:
119
+ - ! '"b5a3b3e439838c6116224ffa1a348e0a"'
120
+ Last-Modified:
121
+ - Mon, 25 Feb 2013 00:05:09 GMT
122
+ Server:
123
+ - thin 1.3.1 codename Triple Espresso
124
+ Set-Cookie:
125
+ - _trajectory_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWVkNjViNTliMGM0YzQzZWQwZWE5MTE0NWZlZmRhNTc4BjsAVEkiDWttX3F1ZXVlBjsARlsGWwdJIg1pZGVudGlmeQY7AEZJIhVhY2NvdW50LTE1NTAwMzI5BjsARkkiEGttX2lkZW50aXR5BjsARkAM--212147974bdb74366b4207d19c046f0d9b25a186;
126
+ path=/; HttpOnly
127
+ - remember_token=4771d415418b4cd08b7bf6f671c816788bc98f9d; path=/; expires=Fri,
128
+ 28-Feb-2014 14:05:55 GMT
129
+ X-Rack-Cache:
130
+ - miss
131
+ X-Request-Id:
132
+ - 2c6396028427185ff01761ee8fdc41fd
133
+ X-Runtime:
134
+ - '0.071346'
135
+ X-Ua-Compatible:
136
+ - IE=Edge,chrome=1
137
+ Transfer-Encoding:
138
+ - chunked
139
+ Connection:
140
+ - keep-alive
141
+ body:
142
+ encoding: US-ASCII
143
+ string: ! '{"stories":[{"archived":false,"assignee_id":null,"branch":null,"comments_count":0,"created_at":"2013-02-21T16:49:31+01:00","deleted":false,"design_needed":false,"development_needed":false,"id":15623695,"idea_id":null,"iteration_id":16057164,"points":0,"position":200,"state":"unstarted","task_type":"Feature","title":"story
144
+ 2","updated_at":"2013-02-25T01:05:09+01:00","user_id":15506817,"state_events":["start"],"comma_separated_tags":null}],"iterations":[{"accepted_points":0,"comments_count":0,"complete":false,"created_at":"2013-02-25T01:05:09+01:00","estimated_points":0,"estimated_velocity":13,"id":16057164,"starts_on":"2013-02-25","stories_count":1,"team_strength":100,"updated_at":"2013-02-25T01:05:09+01:00","percent_complete":0,"current?":true,"future?":false,"accepted_stories_count":0}]}'
145
+ http_version:
146
+ recorded_at: Thu, 28 Feb 2013 14:05:59 GMT
147
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,96 @@
1
+ require 'spec_helper'
2
+
3
+ vcr_options = { :cassette_name => "client", :record => :new_episodes }
4
+ describe Trajectory::Client, :vcr => vcr_options do
5
+ it 'raises an exceptions when environment variables are not set' do
6
+ begin
7
+ original_api_key = ENV['TRAJECTORY_API_KEY']
8
+ original_account_keyword = ENV['TRAJECTORY_ACCOUNT_KEYWORD']
9
+ ENV['TRAJECTORY_API_KEY'] = nil
10
+ ENV['TRAJECTORY_ACCOUNT_KEYWORD'] = nil
11
+
12
+ expect do
13
+ Trajectory::Client.new
14
+ end.to raise_error
15
+ ensure
16
+ ENV['TRAJECTORY_API_KEY'] = original_api_key
17
+ ENV['TRAJECTORY_ACCOUNT_KEYWORD'] = original_account_keyword
18
+ end
19
+ end
20
+
21
+ it 'is able to retrieve all projects of the user' do
22
+ projects = Trajectory::Client.new.projects
23
+
24
+ project_1 = Trajectory::Project.new(id: 15504817)
25
+
26
+ projects.should == Trajectory::Projects.new(project_1)
27
+ end
28
+
29
+ it 'is able to retrive all stories of a given project' do
30
+ project = Trajectory::Client.new.projects.first
31
+
32
+ story_1 = Trajectory::Story.new(id: 15623694)
33
+ story_2 = Trajectory::Story.new(id: 15623695)
34
+ project.stories.should == Trajectory::Stories.new(story_1, story_2)
35
+ end
36
+
37
+ it 'is able to retrieve all iterations of a project' do
38
+ project = Trajectory::Client.new.projects.first
39
+
40
+ iteration_1 = Trajectory::Iteration.new(id: 16055704)
41
+ iteration_2 = Trajectory::Iteration.new(id: 16057164)
42
+ project.iterations.should == Trajectory::Iterations.new(iteration_1, iteration_2)
43
+ end
44
+
45
+ it 'is able to retrieve all ideas of a project' do
46
+ project = Trajectory::Client.new.projects.first
47
+
48
+ idea_1 = Trajectory::Idea.new(id: 15505355)
49
+ idea_2 = Trajectory::Idea.new(id: 15505354)
50
+ project.ideas.should == Trajectory::Ideas.new(idea_1, idea_2)
51
+ end
52
+
53
+ it 'is able to retrieve all users of a project' do
54
+ project = Trajectory::Client.new.projects.first
55
+
56
+ user_1 = Trajectory::User.new(id: 15506817)
57
+ project.users.should == Trajectory::Users.new(user_1)
58
+ end
59
+
60
+ it 'is able to retrieve all updates of a project' do
61
+ current_date = DateTime.new(2013, 1, 1, 0, 0, 0)
62
+
63
+ Timecop.freeze(current_date) do
64
+ project = Trajectory::Client.new.projects.first
65
+
66
+ iteration_1 = Trajectory::Iteration.new(id: 16055704)
67
+ iteration_2 = Trajectory::Iteration.new(id: 16057164)
68
+ iteration_3 = Trajectory::Iteration.new(id: 16063751)
69
+
70
+ story_1 = Trajectory::Story.new(id: 15623694)
71
+ story_2 = Trajectory::Story.new(id: 15623695)
72
+
73
+ project.updates(current_date).iterations.should == Trajectory::Iterations.new(iteration_1, iteration_2, iteration_3)
74
+ project.updates(current_date).stories.should == Trajectory::Stories.new(story_1, story_2)
75
+ end
76
+ end
77
+
78
+ it 'creates association from iteration to project' do
79
+ project = Trajectory::Client.new.projects.first
80
+ iteration = project.iterations.first
81
+ iteration.project.should == project
82
+ end
83
+
84
+ it 'creates association from story to project' do
85
+ project = Trajectory::Client.new.projects.first
86
+ story = project.stories.first
87
+
88
+ story.project.should == project
89
+ end
90
+
91
+ it 'creates association from idea to project' do
92
+ project = Trajectory::Client.new.projects.first
93
+ idea = project.ideas.first
94
+ idea.project.should == project
95
+ end
96
+ end
@@ -0,0 +1,13 @@
1
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
2
+ require 'trajectory'
3
+
4
+ RSpec.configure do |config|
5
+ config.treat_symbols_as_metadata_keys_with_true_values = true
6
+ config.run_all_when_everything_filtered = true
7
+ config.filter_run :focus
8
+
9
+ config.order = 'random'
10
+
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ end
13
+
@@ -0,0 +1,11 @@
1
+ require 'yaml'
2
+
3
+ env_file = File.expand_path('../../../config/env.yml', __FILE__)
4
+ api_keys = YAML.load_file(env_file)
5
+ trajectory_api_key = api_keys['test']['trajectory_api_key']
6
+ trajectory_account_keyword = api_keys['test']['trajectory_account_keyword']
7
+
8
+ ENV['TRAJECTORY_API_KEY'] = trajectory_api_key
9
+ ENV['TRAJECTORY_ACCOUNT_KEYWORD'] = trajectory_account_keyword
10
+
11
+
@@ -0,0 +1 @@
1
+ require 'fabrication'
@@ -0,0 +1,11 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.minimum_coverage 100
4
+
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ add_group 'Domain', 'lib/trajectory/domain'
8
+ add_group 'Data Access', 'lib/trajectory/data_access'
9
+ add_group 'Exceptions', 'lib/trajectory/exceptions'
10
+ add_group 'Core Ext', 'lib/trajectory/core_ext'
11
+ end
@@ -0,0 +1 @@
1
+ require 'timecop'
@@ -0,0 +1,8 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
5
+ c.hook_into :webmock # or :fakeweb
6
+ c.configure_rspec_metadata!
7
+ end
8
+