trello_flow 1.1.0 → 1.2.0

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: b9b61ff2672d0fa326c6dc1cbe6bd3c7c9b4038a
4
- data.tar.gz: 17387dd7a408af04b868f598a37982707b27d8ba
3
+ metadata.gz: f99d2bf54687421b7cf14354599c6403cb4296d2
4
+ data.tar.gz: 1267f4c7f3c1bf9b7d71881b07eb8a974b5c48ff
5
5
  SHA512:
6
- metadata.gz: e25a710855067d8b89321fb580e93b88190d81dec096ca6f719f683ce0c736e938159adefc96333e3bff6811844eace52b19681aec43073bc50d3b495dc28f2d
7
- data.tar.gz: d1ddf470c49c36ff2905706478daf619c9d1a5928732ce25b07b40f5f5fa951b1c38cfa8a3d374fbc9c00b8028cdc8c136dab8d95b8d7179cab481ce0e690113
6
+ metadata.gz: a37bf292d08da928d2846dd8c4afdc58a2b5cf50300a87ef094df11fd1e611309da443316ac45146aaa9478db3bd9095290ddf19e7fc55cd7b2c0fe6c2e8db16
7
+ data.tar.gz: 4254950004330b58bee324d9bf34095f7bbe87283bc1b0c09a04c6c8d6a68ef8304edac4f029eea152842f1a7d12f6ed9e9d03773b2231deea664cebf75ae0cf
@@ -12,8 +12,13 @@ module TrelloFlow
12
12
  find(id)
13
13
  end
14
14
 
15
- def self.for(username)
16
- with("members/:username/cards/open").where(username: username)
15
+ def self.for(user)
16
+ with("members/:username/cards/open").where(username: user.username)
17
+ end
18
+
19
+ def add_member(user)
20
+ return if member_ids.include?(user.id)
21
+ self.class.with("cards/:id/members").where(id: id, value: user.id).post
17
22
  end
18
23
 
19
24
  def find_or_create_checklist
@@ -23,6 +28,12 @@ module TrelloFlow
23
28
  def url
24
29
  attributes[:shortUrl]
25
30
  end
31
+
32
+ private
33
+
34
+ def member_ids
35
+ attributes["idMembers"] || []
36
+ end
26
37
  end
27
38
  end
28
39
  end
@@ -28,8 +28,9 @@ module TrelloFlow
28
28
  end
29
29
 
30
30
  def assign(owner)
31
- return if mentions.include?(owner)
32
- self.class.request :put, "cards/#{card_id}/checklist/#{checklist_id}/checkItem/#{id}/name", value: name_without_mentions + " @#{owner}"
31
+ return if mentions.include?(owner.username)
32
+ self.class.request :put, "cards/#{card_id}/checklist/#{checklist_id}/checkItem/#{id}/name", value: name_without_mentions + " @#{owner.username}"
33
+ card.add_member(owner)
33
34
  end
34
35
 
35
36
  def complete
@@ -14,12 +14,12 @@ module TrelloFlow
14
14
 
15
15
  checklist = card.find_or_create_checklist
16
16
  item = checklist.select_or_create_item(name)
17
- item.assign(username)
17
+ item.assign(current_user)
18
18
  Branch.from_item(item).checkout
19
19
  end
20
20
 
21
21
  def open
22
- Branch.current.open_trello(username)
22
+ Branch.current.open_trello(current_user)
23
23
  end
24
24
 
25
25
  def finish
@@ -50,11 +50,11 @@ module TrelloFlow
50
50
  end
51
51
 
52
52
  def pick_existing_card
53
- Table.pick Api::Card.for(username)
53
+ Table.pick Api::Card.for(current_user)
54
54
  end
55
55
 
56
- def username
57
- @_username ||= Api::Member.current.username
56
+ def current_user
57
+ @_current_user ||= Api::Member.current
58
58
  end
59
59
  end
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module TrelloFlow
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/trello_flow.rb CHANGED
@@ -1,13 +1,8 @@
1
1
  require "trello_flow/version"
2
-
3
2
  require "trello_flow/cli"
4
-
5
3
  require "trello_flow/config"
6
-
7
4
  require "trello_flow/branch"
8
-
9
5
  require "trello_flow/cleanup"
10
-
11
6
  require "trello_flow/main"
12
7
 
13
8
  module TrelloFlow
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-05 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler