trello_lead_time 0.1.4 → 0.1.5

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: f4146d251bd7bc7af5b386ddb33e3c78d2db3ec8
4
- data.tar.gz: 27e3c1c0d326f7fc6df00f982687caeab04280a2
3
+ metadata.gz: 228aa9fb04035b427fedc85d2864aef89e386de1
4
+ data.tar.gz: ea8fe5895b6c8d13e4bc6ded7b820fba7127a887
5
5
  SHA512:
6
- metadata.gz: 22241cbba0aca85985c957dfe2878bf9bee17798e1969c15f685b31733b4fa4783b1a9a7767b70032bb07022c91b20b9c0fea6f5746d8f71291a445466e58088
7
- data.tar.gz: 23187baa0d6c5e129cdc66f70bfea12fe43bb2c90e4a319dc689dcd17849af4ced92e12f48b8fbb8aeaf17be33275891eb42abc0b01094e87ab572a6daf1b797
6
+ metadata.gz: 43945a74d2d605fa1ac65add0f464f1b9b5fe004c2d741dc77f162b37d55e98bfa11c3914fc017a3c81600f2e9c8cf6c5de1b87c80f21102b0a50f889c82ec32
7
+ data.tar.gz: c86655aa015464a6118d8f40aab623ce2be5d6dc61a3b0d9cc3a61a2b9616d077561ba6daabe85607b795c2265cacb62aa89f6cbc9abdee4cb9711343abf618b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trello_lead_time (0.1.4)
4
+ trello_lead_time (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -49,7 +49,7 @@ module TrelloLeadTime
49
49
  end
50
50
 
51
51
  def filtered_actions
52
- @trello_card.actions(filter: 'createCard,updateCard:idList,updateCard:closed').map { |action| Action.from_trello_action(action) }
52
+ @trello_card.actions(filter: 'copyCard,moveCardToBoard,createCard,updateCard:idList,updateCard:closed').map { |action| Action.from_trello_action(action) }
53
53
  end
54
54
 
55
55
  def creation_date
@@ -58,6 +58,7 @@ module TrelloLeadTime
58
58
  end
59
59
 
60
60
  def calculate_age_in_seconds(start_time, end_time)
61
+ return 0 unless start_time && end_time
61
62
  (end_time - start_time).round(0)
62
63
  end
63
64
 
@@ -122,7 +123,7 @@ module TrelloLeadTime
122
123
  end
123
124
 
124
125
  def list_from_result_of_action(action)
125
- if action.type == "createCard"
126
+ if %w{createCard copyCard moveCardToBoard}.include?(action.type)
126
127
  action.data["list"]
127
128
  elsif action.type == "updateCard" && action.data.has_key?("old") && action.data["old"].has_key?("idList")
128
129
  action.data["listAfter"]
@@ -1,3 +1,3 @@
1
1
  module TrelloLeadTime
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -0,0 +1,152 @@
1
+ [
2
+ {
3
+ "id": "53879d88875d3e408d7cc1a9",
4
+ "idMemberCreator": "5148b990bb8ad6045b003b1f",
5
+ "data": {
6
+ "listAfter": {
7
+ "name": "Done for 2014-05-16",
8
+ "id": "536d4d530b76b3fe7435a072"
9
+ },
10
+ "listBefore": {
11
+ "name": "Development",
12
+ "id": "520d5ac74fd0cd3a5d000b80"
13
+ },
14
+ "board": {
15
+ "shortLink": "2nROp5bq",
16
+ "name": "Transp Backend",
17
+ "id": "520d5aa09b5a997f5a000e6b"
18
+ },
19
+ "card": {
20
+ "shortLink": "jht1p9H4",
21
+ "idShort": 1144,
22
+ "name": "TEST: Copied card in done column",
23
+ "id": "538797063ecd8f643503316e",
24
+ "idList": "536d4d530b76b3fe7435a072"
25
+ },
26
+ "old": {
27
+ "idList": "520d5ac74fd0cd3a5d000b80"
28
+ }
29
+ },
30
+ "type": "updateCard",
31
+ "date": "2014-05-29T20:50:16.375Z",
32
+ "memberCreator": {
33
+ "id": "5148b990bb8ad6045b003b1f",
34
+ "avatarHash": "4e71215f2b8bfed0e9812634e35d5648",
35
+ "fullName": "Scott Baldwin",
36
+ "initials": "SSB",
37
+ "username": "scottsbaldwin"
38
+ }
39
+ },
40
+ {
41
+ "id": "53879d78281ca563163800fd",
42
+ "idMemberCreator": "5148b990bb8ad6045b003b1f",
43
+ "data": {
44
+ "listAfter": {
45
+ "name": "Development",
46
+ "id": "520d5ac74fd0cd3a5d000b80"
47
+ },
48
+ "listBefore": {
49
+ "name": "Acceptance",
50
+ "id": "520d5ad05327daf13100050a"
51
+ },
52
+ "board": {
53
+ "shortLink": "2nROp5bq",
54
+ "name": "Transp Backend",
55
+ "id": "520d5aa09b5a997f5a000e6b"
56
+ },
57
+ "card": {
58
+ "shortLink": "jht1p9H4",
59
+ "idShort": 1144,
60
+ "name": "TEST: Copied card in done column",
61
+ "id": "538797063ecd8f643503316e",
62
+ "idList": "520d5ac74fd0cd3a5d000b80"
63
+ },
64
+ "old": {
65
+ "idList": "520d5ad05327daf13100050a"
66
+ }
67
+ },
68
+ "type": "updateCard",
69
+ "date": "2014-05-29T20:50:00.913Z",
70
+ "memberCreator": {
71
+ "id": "5148b990bb8ad6045b003b1f",
72
+ "avatarHash": "4e71215f2b8bfed0e9812634e35d5648",
73
+ "fullName": "Scott Baldwin",
74
+ "initials": "SSB",
75
+ "username": "scottsbaldwin"
76
+ }
77
+ },
78
+ {
79
+ "id": "53879d6fc3b3e6c69e4e09bf",
80
+ "idMemberCreator": "5148b990bb8ad6045b003b1f",
81
+ "data": {
82
+ "listAfter": {
83
+ "name": "Acceptance",
84
+ "id": "520d5ad05327daf13100050a"
85
+ },
86
+ "listBefore": {
87
+ "name": "Done for 2014-05-16",
88
+ "id": "536d4d530b76b3fe7435a072"
89
+ },
90
+ "board": {
91
+ "shortLink": "2nROp5bq",
92
+ "name": "Transp Backend",
93
+ "id": "520d5aa09b5a997f5a000e6b"
94
+ },
95
+ "card": {
96
+ "shortLink": "jht1p9H4",
97
+ "idShort": 1144,
98
+ "name": "TEST: Copied card in done column",
99
+ "id": "538797063ecd8f643503316e",
100
+ "idList": "520d5ad05327daf13100050a"
101
+ },
102
+ "old": {
103
+ "idList": "536d4d530b76b3fe7435a072"
104
+ }
105
+ },
106
+ "type": "updateCard",
107
+ "date": "2014-05-29T20:49:51.716Z",
108
+ "memberCreator": {
109
+ "id": "5148b990bb8ad6045b003b1f",
110
+ "avatarHash": "4e71215f2b8bfed0e9812634e35d5648",
111
+ "fullName": "Scott Baldwin",
112
+ "initials": "SSB",
113
+ "username": "scottsbaldwin"
114
+ }
115
+ },
116
+ {
117
+ "id": "538797063ecd8f643503316f",
118
+ "idMemberCreator": "5148b990bb8ad6045b003b1f",
119
+ "data": {
120
+ "cardSource": {
121
+ "shortLink": "7odj0Q15",
122
+ "idShort": 1143,
123
+ "name": "TEST: Created card in done column",
124
+ "id": "538796f94b1ed3dad0b28330"
125
+ },
126
+ "board": {
127
+ "shortLink": "2nROp5bq",
128
+ "name": "Transp Backend",
129
+ "id": "520d5aa09b5a997f5a000e6b"
130
+ },
131
+ "list": {
132
+ "name": "Done for 2014-05-16",
133
+ "id": "536d4d530b76b3fe7435a072"
134
+ },
135
+ "card": {
136
+ "shortLink": "jht1p9H4",
137
+ "idShort": 1144,
138
+ "name": "TEST: Copied card in done column",
139
+ "id": "538797063ecd8f643503316e"
140
+ }
141
+ },
142
+ "type": "copyCard",
143
+ "date": "2014-05-29T20:22:30.817Z",
144
+ "memberCreator": {
145
+ "id": "5148b990bb8ad6045b003b1f",
146
+ "avatarHash": "4e71215f2b8bfed0e9812634e35d5648",
147
+ "fullName": "Scott Baldwin",
148
+ "initials": "SSB",
149
+ "username": "scottsbaldwin"
150
+ }
151
+ }
152
+ ]
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "id": "538797063ecd8f643503316f",
4
+ "idMemberCreator": "5148b990bb8ad6045b003b1f",
5
+ "data": {
6
+ "cardSource": {
7
+ "shortLink": "7odj0Q15",
8
+ "idShort": 1143,
9
+ "name": "TEST: Created card in done column",
10
+ "id": "538796f94b1ed3dad0b28330"
11
+ },
12
+ "board": {
13
+ "shortLink": "2nROp5bq",
14
+ "name": "Transp Backend",
15
+ "id": "520d5aa09b5a997f5a000e6b"
16
+ },
17
+ "list": {
18
+ "name": "Done for 2014-05-16",
19
+ "id": "536d4d530b76b3fe7435a072"
20
+ },
21
+ "card": {
22
+ "shortLink": "jht1p9H4",
23
+ "idShort": 1144,
24
+ "name": "TEST: Copied card in done column",
25
+ "id": "538797063ecd8f643503316e"
26
+ }
27
+ },
28
+ "type": "copyCard",
29
+ "date": "2014-05-29T20:22:30.817Z",
30
+ "memberCreator": {
31
+ "id": "5148b990bb8ad6045b003b1f",
32
+ "avatarHash": "4e71215f2b8bfed0e9812634e35d5648",
33
+ "fullName": "Scott Baldwin",
34
+ "initials": "SSB",
35
+ "username": "scottsbaldwin"
36
+ }
37
+ }
38
+ ]
@@ -0,0 +1,43 @@
1
+ {
2
+ "badges": {
3
+ "attachments": 1,
4
+ "checkItems": 0,
5
+ "checkItemsChecked": 0,
6
+ "comments": 8,
7
+ "description": true,
8
+ "due": "2014-06-13T16:00:00.000Z",
9
+ "fogbugz": "",
10
+ "subscribed": false,
11
+ "viewingMemberVoted": false,
12
+ "votes": 0
13
+ },
14
+ "checkItemStates": [],
15
+ "closed": false,
16
+ "dateLastActivity": "2014-05-20T20:57:27.749Z",
17
+ "desc": "Sorting dropdown is not available in right corner of results page for CSX members.",
18
+ "descData": null,
19
+ "due": "2014-06-13T16:00:00.000Z",
20
+ "id": "53725c8bdff8e1fa15e372e4",
21
+ "idAttachmentCover": "53725c8cdff8e1fa15e372e6",
22
+ "idBoard": "520d5aa09b5a997f5a000e6b",
23
+ "idChecklists": [],
24
+ "idList": "536d4d530b76b3fe7435a072",
25
+ "idMembers": [
26
+ "520a6b6fd1d45394140038dc",
27
+ "5205800dd1e439ae31002495",
28
+ "520557cd7c576964440039ed",
29
+ "5304d05539da911e1c7f8674"
30
+ ],
31
+ "idShort": 1112,
32
+ "labels": [
33
+ {
34
+ "color": "purple",
35
+ "name": "CapEx"
36
+ }
37
+ ],
38
+ "manualCoverAttachment": false,
39
+ "name": "SPIKE: Sorting dropdown is not available for CSX members.(DEF020110)",
40
+ "pos": 144,
41
+ "shortUrl": "https://trello.com/c/ACYh6u9c",
42
+ "url": "https://trello.com/c/ACYh6u9c/1112-spike-sorting-dropdown-is-not-available-for-csx-members-def020110"
43
+ }
@@ -217,7 +217,7 @@ describe TrelloLeadTime::Board do
217
217
 
218
218
  def stub_card_requests
219
219
  %w{1111 2222 3333 4444}.each do |card_id|
220
- stub_request(:get, "https://api.trello.com/1/cards/#{card_id}/actions?filter=createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
220
+ stub_request(:get, "https://api.trello.com/1/cards/#{card_id}/actions?filter=copyCard,moveCardToBoard,createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
221
221
  with(headers).
222
222
  to_return(stub_returns(actions_json[card_id]))
223
223
 
@@ -3,78 +3,116 @@ require 'spec_helper'
3
3
  describe TrelloLeadTime::Card do
4
4
  let(:key) { 'key' }
5
5
  let(:token) { 'token' }
6
- let(:card_json) {
7
- File.read(File.expand_path("../../../fixtures/card.json", __FILE__))
8
- }
9
- let(:actions_json) {
10
- File.read(File.expand_path("../../../fixtures/actions.1111.json", __FILE__))
11
- }
12
- let(:labels_json) {
13
- File.read(File.expand_path("../../../fixtures/labels.json", __FILE__))
14
- }
15
- let(:comments_json) {
16
- File.read(File.expand_path("../../../fixtures/comments.json", __FILE__))
17
- }
18
-
19
- subject { TrelloLeadTime::Card.from_trello_card(Trello::Card.parse(card_json)) }
20
-
21
- def do_stubs(key, token)
22
- stub_request(:get, "https://api.trello.com/1/cards/533dd01513e035206902124c/actions?filter=createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
23
- with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
24
- to_return(:status => 200, :body => actions_json, :headers => {})
25
-
26
- stub_request(:get, "https://api.trello.com/1/cards/533dd01513e035206902124c/labels?key=#{key}&token=#{token}").
27
- with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
28
- to_return(:status => 200, :body => labels_json, :headers => {})
29
-
30
- stub_request(:get, "https://api.trello.com/1/cards/533dd01513e035206902124c/actions?filter=commentCard&key=#{key}&token=#{token}").
31
- with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
32
- to_return(:status => 200, :body => comments_json, :headers => {})
33
- end
34
6
 
35
- describe ".done" do
36
- it "should be a card" do
37
- do_stubs(key, token)
38
- subject.should be_an_instance_of(TrelloLeadTime::Card)
7
+ context "card with more than one action" do
8
+ let(:card_json) {
9
+ File.read(File.expand_path("../../../fixtures/card.json", __FILE__))
10
+ }
11
+ let(:actions_json) {
12
+ File.read(File.expand_path("../../../fixtures/actions.1111.json", __FILE__))
13
+ }
14
+ let(:labels_json) {
15
+ File.read(File.expand_path("../../../fixtures/labels.json", __FILE__))
16
+ }
17
+ let(:comments_json) {
18
+ File.read(File.expand_path("../../../fixtures/comments.json", __FILE__))
19
+ }
20
+
21
+ subject { TrelloLeadTime::Card.from_trello_card(Trello::Card.parse(card_json)) }
22
+
23
+ before(:each) {
24
+ key = 'key'
25
+ token = 'token'
26
+
27
+ stub_request(:get, "https://api.trello.com/1/cards/533dd01513e035206902124c/actions?filter=copyCard,moveCardToBoard,createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
28
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
29
+ to_return(:status => 200, :body => actions_json, :headers => {})
30
+
31
+ stub_request(:get, "https://api.trello.com/1/cards/533dd01513e035206902124c/labels?key=#{key}&token=#{token}").
32
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
33
+ to_return(:status => 200, :body => labels_json, :headers => {})
34
+
35
+ stub_request(:get, "https://api.trello.com/1/cards/533dd01513e035206902124c/actions?filter=commentCard&key=#{key}&token=#{token}").
36
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
37
+ to_return(:status => 200, :body => comments_json, :headers => {})
38
+ }
39
+
40
+ describe ".done" do
41
+ it "should be a card" do
42
+ subject.should be_an_instance_of(TrelloLeadTime::Card)
43
+ end
39
44
  end
40
- end
41
45
 
42
- describe ".hash_tags" do
43
- it "should have a hash tag" do
44
- do_stubs(key, token)
45
- expect(subject.hash_tags).to eq(%w{#tag1 #tag2 #tag3})
46
+ describe ".hash_tags" do
47
+ it "should have a hash tag" do
48
+ expect(subject.hash_tags).to eq(%w{#tag1 #tag2 #tag3})
49
+ end
46
50
  end
47
- end
48
51
 
49
- describe ".labels" do
50
- it "should have labels" do
51
- do_stubs(key, token)
52
- expect(subject.labels.collect(&:name)).to eq(%w{iOS API})
52
+ describe ".labels" do
53
+ it "should have labels" do
54
+ expect(subject.labels.collect(&:name)).to eq(%w{iOS API})
53
55
 
56
+ end
54
57
  end
55
- end
56
58
 
57
- describe ".has_label_name?" do
58
- it "should not have a named label" do
59
- do_stubs(key, token)
60
- subject.has_label_name?("blah").should be_false
59
+ describe ".has_label_name?" do
60
+ it "should not have a named label" do
61
+ subject.has_label_name?("blah").should be_false
62
+ end
63
+
64
+ it "should have a named label" do
65
+ subject.has_label_name?("ios").should be_true
66
+ end
61
67
  end
62
68
 
63
- it "should have a named label" do
64
- do_stubs(key, token)
65
- subject.has_label_name?("ios").should be_true
69
+ describe ".has_label_color?" do
70
+ it "should not have a color label" do
71
+ subject.has_label_color?("yellow").should be_false
72
+ end
73
+
74
+ it "should have a color label" do
75
+ subject.has_label_color?("Green").should be_true
76
+ end
66
77
  end
67
78
  end
68
79
 
69
- describe ".has_label_color?" do
70
- it "should not have a color label" do
71
- do_stubs(key, token)
72
- subject.has_label_color?("yellow").should be_false
80
+ context "copied card" do
81
+ let(:card_id) { '53725c8bdff8e1fa15e372e4' }
82
+ let(:copied_card_json) {
83
+ File.read(File.expand_path("../../../fixtures/card.copied.json", __FILE__))
84
+ }
85
+
86
+ subject { TrelloLeadTime::Card.from_trello_card(Trello::Card.parse(copied_card_json)) }
87
+
88
+ context "with a single action" do
89
+ let(:copied_actions_json) {
90
+ File.read(File.expand_path("../../../fixtures/actions.copied.single.json", __FILE__))
91
+ }
92
+
93
+ it "should have an age of 0 seconds" do
94
+ stub_request(:get, "https://api.trello.com/1/cards/#{card_id}/actions?filter=copyCard,moveCardToBoard,createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
95
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
96
+ to_return(:status => 200, :body => copied_actions_json, :headers => {})
97
+
98
+ subject.age_in_seconds.should == 0
99
+ end
73
100
  end
74
101
 
75
- it "should have a color label" do
76
- do_stubs(key, token)
77
- subject.has_label_color?("Green").should be_true
102
+ context "with many actions" do
103
+ let(:copied_actions_json) {
104
+ File.read(File.expand_path("../../../fixtures/actions.copied.many.json", __FILE__))
105
+ }
106
+
107
+ it "should have an age of 0 seconds" do
108
+ stub_request(:get, "https://api.trello.com/1/cards/#{card_id}/actions?filter=copyCard,moveCardToBoard,createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
109
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
110
+ to_return(:status => 200, :body => copied_actions_json, :headers => {})
111
+
112
+ subject.age_in_seconds.should == 1666
113
+ end
78
114
  end
115
+
79
116
  end
117
+
80
118
  end
@@ -202,7 +202,7 @@ describe TrelloLeadTime::List do
202
202
 
203
203
  def stub_card_requests
204
204
  %w{1111 2222 3333 4444}.each do |card_id|
205
- stub_request(:get, "https://api.trello.com/1/cards/#{card_id}/actions?filter=createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
205
+ stub_request(:get, "https://api.trello.com/1/cards/#{card_id}/actions?filter=copyCard,moveCardToBoard,createCard,updateCard:idList,updateCard:closed&key=#{key}&token=#{token}").
206
206
  with(headers).
207
207
  to_return(stub_returns(actions_json[card_id]))
208
208
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_lead_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Baldwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-19 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,10 @@ files:
83
83
  - spec/fixtures/actions.2222.json
84
84
  - spec/fixtures/actions.3333.json
85
85
  - spec/fixtures/actions.4444.json
86
+ - spec/fixtures/actions.copied.many.json
87
+ - spec/fixtures/actions.copied.single.json
86
88
  - spec/fixtures/boards.json
89
+ - spec/fixtures/card.copied.json
87
90
  - spec/fixtures/card.json
88
91
  - spec/fixtures/cards.json
89
92
  - spec/fixtures/comments.1111.json
@@ -136,7 +139,10 @@ test_files:
136
139
  - spec/fixtures/actions.2222.json
137
140
  - spec/fixtures/actions.3333.json
138
141
  - spec/fixtures/actions.4444.json
142
+ - spec/fixtures/actions.copied.many.json
143
+ - spec/fixtures/actions.copied.single.json
139
144
  - spec/fixtures/boards.json
145
+ - spec/fixtures/card.copied.json
140
146
  - spec/fixtures/card.json
141
147
  - spec/fixtures/cards.json
142
148
  - spec/fixtures/comments.1111.json