tracker_api 1.4.0 → 1.4.1

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: 95c257d1d093f0fbf0a014e2c25457cd9dd03c05
4
- data.tar.gz: 844127ea9d688f84adede932ed234e2d7523fc06
3
+ metadata.gz: e04aedc8708304e386bbe7903a4131de2ca092d8
4
+ data.tar.gz: 2afa59b30acd497e994dd334275506e5d89e093d
5
5
  SHA512:
6
- metadata.gz: a349ba891f44d3fd42945b7a7c1ddaefff6c682670203b98b6e3b0a0a1b97b22700ea9cf83e88d497cc37bfa75a4bb8c77c9a559f20cee49f63131c7d0f28e57
7
- data.tar.gz: b848641dd32595362167d334cb394a6873e1ecc0a7148f673b0776efce040ce110e7183e9bf35ed5043c49d6c168adaf05ea0aa79246bb812394148ddc214466
6
+ metadata.gz: 36f26c84ab4c2dca14d8d5ebc177bf09b317eaf556308495972eec5128287048290abc9ec877c8715bf2990ae261a4ae495c3930ea301cb086bfda7378cbbc97
7
+ data.tar.gz: d7f09db0d13b324ba48cb0edcf32aa749288791487b25da7beb18aecc537253e8b383ab73fdf7688eca2cd8680df61862769bf76922081fc1a40e476a03916d6
data/README.md CHANGED
@@ -17,7 +17,7 @@ It’s powered by [Faraday](https://github.com/lostisland/faraday) and [Virtus](
17
17
 
18
18
  Add this line to your application's Gemfile:
19
19
  ```ruby
20
- gem 'tracker_api', '~> 0.2.0'
20
+ gem 'tracker_api'
21
21
  ```
22
22
 
23
23
  And then execute:
@@ -74,7 +74,7 @@ module TrackerApi
74
74
  end
75
75
 
76
76
  # Use attribute writer to get coercion and dirty tracking.
77
- self.labels = @labels.dup.push(new_label)
77
+ self.labels = (labels ? labels.dup : []).push(new_label)
78
78
  end
79
79
 
80
80
  # Provides a list of all the activity performed on the story.
@@ -1,3 +1,3 @@
1
1
  module TrackerApi
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
data/test/story_test.rb CHANGED
@@ -7,6 +7,7 @@ describe TrackerApi::Resources::Story do
7
7
  let(:project) { VCR.use_cassette('get project') { client.project(project_id) } }
8
8
  let(:story_id) { '66728004' }
9
9
  let(:another_story_id) { '66728000' }
10
+ let(:story_id_no_existing_labels) { '82330712' }
10
11
  let(:story) { VCR.use_cassette('get story') { project.story(story_id) } }
11
12
 
12
13
  it 'can update an existing story' do
@@ -50,6 +51,21 @@ describe TrackerApi::Resources::Story do
50
51
  story.labels.map(&:name).must_include new_label_name
51
52
  end
52
53
 
54
+ it 'can add new labels to an existing story without existing labels' do
55
+ story = VCR.use_cassette('get story no existing labels') { project.story(story_id_no_existing_labels) }
56
+ story.labels.must_be_nil
57
+
58
+ new_label_name = "super-special-label"
59
+ story.add_label(new_label_name)
60
+
61
+ VCR.use_cassette('save previously no label story with new label', record: :new_episodes) do
62
+ story.save
63
+ end
64
+
65
+ story.labels.wont_be_empty
66
+ story.labels.map(&:name).must_include new_label_name
67
+ end
68
+
53
69
  it 'does not send unmodified fields when saving' do
54
70
  story_with_one_change = TrackerApi::Resources::Story::UpdateRepresenter.new(TrackerApi::Resources::Story.new(name: "new_name"))
55
71
  expected_json = MultiJson.dump({name: "new_name"})
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"get","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/82330712","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Ruby/2.2.1 (x86_64-darwin14; ruby) TrackerApi/1.4.0 Faraday/0.9.2"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"]}},"response":{"status":{"code":200,"message":null},"headers":{"Content-Type":["application/json; charset=utf-8"],"Status":["200 OK"],"Cache-Control":["max-age=0, private, must-revalidate"],"Date":["Wed, 19 Oct 2016 22:02:43 GMT"],"X-Tracker-Project-Version":["152"],"X-Request-Id":["0785925ab787c672fc149a4fc45a5a4c"],"X-UA-Compatible":["IE=Edge,chrome=1"],"ETag":["\"c417249619fc699ecb6ef773d35cf7dd\""],"X-Runtime":["0.050834"],"X-Rack-Cache":["miss"],"X-Powered-By":["Phusion Passenger Enterprise"],"Server":["nginx + Phusion Passenger"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Credentials":["false"],"Access-Control-Allow-Methods":["GET, POST, PUT, DELETE, OPTIONS"],"Access-Control-Allow-Headers":["X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is"],"X-Tracker-Client-Pinger-Interval":["12"]},"body":{"encoding":"ASCII-8BIT","string":"{\"kind\":\"story\",\"id\":82330712,\"created_at\":\"2014-11-08T00:23:58Z\",\"updated_at\":\"2015-01-27T00:35:58Z\",\"estimate\":1,\"story_type\":\"feature\",\"name\":\"Test story\",\"current_state\":\"started\",\"requested_by_id\":1266314,\"url\":\"https://www.pivotaltracker.com/story/show/82330712\",\"project_id\":1027488,\"owner_ids\":[1266316,1266314],\"labels\":[],\"owned_by_id\":1266316}"},"http_version":null},"recorded_at":"Wed, 19 Oct 2016 22:02:43 GMT"}],"recorded_with":"VCR 3.0.3"}
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"put","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/82330712","body":{"encoding":"UTF-8","string":"{\"labels\":[{\"name\":\"super-special-label\"}]}"},"headers":{"User-Agent":["Ruby/2.2.1 (x86_64-darwin14; ruby) TrackerApi/1.4.0 Faraday/0.9.2"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"],"Content-Type":["application/json"]}},"response":{"status":{"code":200,"message":null},"headers":{"Content-Type":["application/json; charset=utf-8"],"Status":["200 OK"],"Cache-Control":["max-age=0, private, must-revalidate"],"Date":["Wed, 19 Oct 2016 22:03:47 GMT"],"X-Tracker-Project-Version":["153"],"X-Request-Id":["9309467ba390eac143a26031f9efcbcd"],"X-UA-Compatible":["IE=Edge,chrome=1"],"ETag":["\"702ec0ceab01c6c09792aeba14f63817\""],"X-Runtime":["0.199548"],"X-Rack-Cache":["invalidate, pass"],"X-Powered-By":["Phusion Passenger Enterprise"],"Server":["nginx + Phusion Passenger"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Credentials":["false"],"Access-Control-Allow-Methods":["GET, POST, PUT, DELETE, OPTIONS"],"Access-Control-Allow-Headers":["X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is"],"X-Tracker-Client-Pinger-Interval":["12"]},"body":{"encoding":"ASCII-8BIT","string":"{\"kind\":\"story\",\"id\":82330712,\"project_id\":1027488,\"name\":\"Test story\",\"story_type\":\"feature\",\"current_state\":\"started\",\"estimate\":1,\"requested_by_id\":1266314,\"owned_by_id\":1266316,\"owner_ids\":[1266316,1266314],\"labels\":[{\"kind\":\"label\",\"id\":14060665,\"project_id\":1027488,\"name\":\"super-special-label\",\"created_at\":\"2016-02-12T23:45:13Z\",\"updated_at\":\"2016-02-12T23:45:13Z\"}],\"created_at\":\"2014-11-08T00:23:58Z\",\"updated_at\":\"2016-10-19T22:03:47Z\",\"url\":\"https://www.pivotaltracker.com/story/show/82330712\"}"},"http_version":null},"recorded_at":"Wed, 19 Oct 2016 22:03:47 GMT"}],"recorded_with":"VCR 3.0.3"}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracker_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Forest Carlisle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-14 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -298,6 +298,7 @@ files:
298
298
  - test/vcr/cassettes/get_story.json
299
299
  - test/vcr/cassettes/get_story_activity.json
300
300
  - test/vcr/cassettes/get_story_comments.json
301
+ - test/vcr/cassettes/get_story_no_existing_labels.json
301
302
  - test/vcr/cassettes/get_story_owners.json
302
303
  - test/vcr/cassettes/get_story_with_owners.json
303
304
  - test/vcr/cassettes/get_story_with_tasks.json
@@ -308,6 +309,7 @@ files:
308
309
  - test/vcr/cassettes/get_unscheduled_story.json
309
310
  - test/vcr/cassettes/get_workspace.json
310
311
  - test/vcr/cassettes/get_workspace_projects.json
312
+ - test/vcr/cassettes/save_previously_no_label_story_with_new_label.json
311
313
  - test/vcr/cassettes/save_story.json
312
314
  - test/vcr/cassettes/save_story_with_multiple_changes.json
313
315
  - test/vcr/cassettes/save_story_with_new_label.json
@@ -374,6 +376,7 @@ test_files:
374
376
  - test/vcr/cassettes/get_story.json
375
377
  - test/vcr/cassettes/get_story_activity.json
376
378
  - test/vcr/cassettes/get_story_comments.json
379
+ - test/vcr/cassettes/get_story_no_existing_labels.json
377
380
  - test/vcr/cassettes/get_story_owners.json
378
381
  - test/vcr/cassettes/get_story_with_owners.json
379
382
  - test/vcr/cassettes/get_story_with_tasks.json
@@ -384,6 +387,7 @@ test_files:
384
387
  - test/vcr/cassettes/get_unscheduled_story.json
385
388
  - test/vcr/cassettes/get_workspace.json
386
389
  - test/vcr/cassettes/get_workspace_projects.json
390
+ - test/vcr/cassettes/save_previously_no_label_story_with_new_label.json
387
391
  - test/vcr/cassettes/save_story.json
388
392
  - test/vcr/cassettes/save_story_with_multiple_changes.json
389
393
  - test/vcr/cassettes/save_story_with_new_label.json