3llo 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1300b804be6b52455dbe8f1f19d3f119a741a5a
4
- data.tar.gz: 9152a06a84c5f6235b7852c607b4aef5eebb58ec
3
+ metadata.gz: 1e7e2c44a64f8a1b7ce84549c9ecc8c65c7bf793
4
+ data.tar.gz: bac8d528a87bc23510aefc254002392b3062de08
5
5
  SHA512:
6
- metadata.gz: 0705fac219acee3fde1905cd7eb6e88d7b257d54d50eb237527741368ae1150efce13e198ba0682d6b8aeebada11a26f1f3e419271e9287511a44cfd2219d25b
7
- data.tar.gz: 17dcdd73147536a92e244c4977c767d0d7939c8a92dc4ccc1e38be827b63ee01ef628609586b059a6cc2ed66645e55d4fb1185f1f0eb09eee3e1f2eb9a2efd99
6
+ metadata.gz: c8d31fcd43b99d64453d7a0fe3cb79f691316b5438641c3cff14e494a81fcb8e7167672193cceaff61e970ac6a2014de3cf9d63047b1c2b447cd8f445f21e44a
7
+ data.tar.gz: 9b535ae6a132468c0d9c10372f65019d587836518cd2c5f4cd111c909165c744a5572c4d06cf21480b835dcc69d7d94f66d26f6f2ab6ecd694532ae6a4449993
data/README.md CHANGED
@@ -46,6 +46,7 @@ There are a couple of commands available in 3llo.
46
46
  * `card move <card_id> <list_id>`: Move card to a specified list.
47
47
  * `card self-assign <card_id>`: Self-assign a card.
48
48
  * `card comments <card_id>`: Show recent comments of a card.
49
+ * `card comment <card_id>`: Add a comment to a card.
49
50
  * `list list`: List all the lists of the active board.
50
51
  * `help`: Show help menu.
51
52
  * `exit`: Exit.
data/lib/3llo/api/card.rb CHANGED
@@ -104,6 +104,19 @@ module Tr3llo
104
104
  )
105
105
  end
106
106
 
107
+ def comment(card_id, text)
108
+ url = "/cards/#{card_id}/actions/comments"
109
+ JSON.parse(
110
+ client.post(
111
+ url,
112
+ key: api_key,
113
+ token: api_token,
114
+ text: text
115
+ ),
116
+ symbolize_names: true
117
+ )
118
+ end
119
+
107
120
  private
108
121
 
109
122
  def api_key
@@ -5,6 +5,7 @@ require '3llo/commands/card/move'
5
5
  require '3llo/commands/card/self_assign'
6
6
  require '3llo/commands/card/invalid'
7
7
  require '3llo/commands/card/comments'
8
+ require '3llo/commands/card/comment'
8
9
  require '3llo/commands/card/add'
9
10
 
10
11
  module Tr3llo
@@ -35,6 +36,9 @@ module Tr3llo
35
36
  when 'comments'
36
37
  card_id, _ = args
37
38
  Command::Card::CommentsCommand.new(card_id)
39
+ when 'comment'
40
+ card_id, _ = args
41
+ Command::Card::CommentCommand.new(card_id)
38
42
  when 'move'
39
43
  card_id, _ = args
40
44
  board_id = $container.resolve(:board)[:id]
@@ -0,0 +1,34 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Card
4
+ class CommentCommand
5
+ def initialize(card_id)
6
+ @card_id = card_id
7
+ end
8
+
9
+ def execute
10
+ interface.print_frame do
11
+ text = interface.input.ask("Comment:")
12
+
13
+ interface.puts(
14
+ create_comment!(text) &&
15
+ "Comment created"
16
+ )
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ attr_reader :card_id
23
+
24
+ def create_comment!(text)
25
+ API::Card.comment(@card_id, text)
26
+ end
27
+
28
+ def interface
29
+ $container.resolve(:interface)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -22,6 +22,7 @@ module Tr3llo
22
22
  card move <card_id> - Move card to a list
23
23
  card self-assign <card_id> - Self-assign a card
24
24
  card comments <card_id> - Load recent comments of a card
25
+ card comment <card_id> - Add a comment to a card
25
26
  }
26
27
  end
27
28
 
@@ -26,6 +26,9 @@ module Tr3llo
26
26
  "Name: ".labelize + card[:name] + " (#{label_str})" "\n" +
27
27
  "Description: ".labelize + card[:desc] + "\n" +
28
28
  "List: ".labelize + card[:list][:name] + "\n" +
29
+ "Subscribed: ".labelize + (card[:badges][:subscribed] ? "Yes" : "No") + "\n" +
30
+ "Comments: ".labelize + card[:badges][:comments].to_s + "\n" +
31
+ "Attachments: ".labelize + card[:badges][:attachments].to_s + "\n" +
29
32
  "Link: ".labelize + card[:shortUrl] + "\n"
30
33
  )
31
34
  end
@@ -29,6 +29,7 @@ module Tr3llo
29
29
  card move <card_id> - Move card to a list
30
30
  card self-assign <card_id> - Self-assign a card
31
31
  card comments <card_id> - Load recent comments of a card
32
+ card comment <card_id> - Add a comment to a card
32
33
  list list - Show all lists
33
34
  list cards <list_id> - Show all cards in list
34
35
  help - Show help menu
data/lib/3llo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tr3llo
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3llo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cẩm Huỳnh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -56,6 +56,7 @@ files:
56
56
  - lib/3llo/commands/board/list.rb
57
57
  - lib/3llo/commands/board/select.rb
58
58
  - lib/3llo/commands/card/add.rb
59
+ - lib/3llo/commands/card/comment.rb
59
60
  - lib/3llo/commands/card/comments.rb
60
61
  - lib/3llo/commands/card/invalid.rb
61
62
  - lib/3llo/commands/card/list.rb