trello_tool 0.6.0 → 0.7.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/trello_tool/trello_client.rb +9 -3
- data/lib/trello_tool/version.rb +1 -1
- data/lib/trello_tool_thor.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84c1b337fcadccc4027363a3f4610519c2708a4787324f31fbe5ba855869ad30
|
|
4
|
+
data.tar.gz: b94417d688d1b508defd797eafeb8836ec96235f535194c6089a71abe29ee10d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e919e579523a39911b8695b40f9fe5168f295b30aacf86f19f5bcb7b67f68bfb68ab0a4cfbd257e7be5b76873b434a281f8bb4bf55e138546747c0bf091d62e7
|
|
7
|
+
data.tar.gz: 90cddd46749bdd2f99d60d0bb9f5ecda4c337403e95e27b8a1059e9f57fb3d83dd3cb534cdf3db82ec02d15c1be16e876373d68f9daf3327651b8a7870e95516
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -105,6 +105,7 @@ Changing cards:
|
|
|
105
105
|
text, or the only item containing it
|
|
106
106
|
* `bin/trello_tool rename_item CARD "item text" "new text" (--checklist NAME)` -- renames the item with that
|
|
107
107
|
text, or the only item containing it
|
|
108
|
+
* `bin/trello_tool rename_checklist CARD "Name" "New name"` -- renames the card's checklist of that name
|
|
108
109
|
* `bin/trello_tool remove_item CARD "item text" (--checklist NAME)` -- deletes that item. The one command that
|
|
109
110
|
destroys something, so keep it behind a prompt where agents run the tool
|
|
110
111
|
* `bin/trello_tool move CARD (LIST_NAME (BOARD_URL)) (--top | --bottom)` -- to the bottom (or top) of a list; without
|
|
@@ -108,6 +108,11 @@ module TrelloTool
|
|
|
108
108
|
client.delete("/cards/#{card.id}/checkItem/#{item['id']}")
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# @param checklist [Trello::Checklist]
|
|
112
|
+
def rename_checklist(checklist, name:)
|
|
113
|
+
client.put("/checklists/#{checklist.id}", name: name)
|
|
114
|
+
end
|
|
115
|
+
|
|
111
116
|
# @return [Trello::Member] the member the token belongs to
|
|
112
117
|
def me
|
|
113
118
|
client.find(:members, "me")
|
|
@@ -125,12 +130,13 @@ module TrelloTool
|
|
|
125
130
|
board_of(card).members
|
|
126
131
|
end
|
|
127
132
|
|
|
133
|
+
COMMENT_PARAMS = { "filter" => "commentCard", "fields" => "data,date", "memberCreator" => "true",
|
|
134
|
+
"memberCreator_fields" => "username" }.freeze
|
|
135
|
+
|
|
128
136
|
# @param card [Trello::Card]
|
|
129
137
|
# @return [Array<Hash>] the card's comments, oldest first: author (username), date, text
|
|
130
138
|
def card_comments(card)
|
|
131
|
-
|
|
132
|
-
"memberCreator" => "true", "memberCreator_fields" => "username")
|
|
133
|
-
JSON.parse(response.body).reverse.map do |action|
|
|
139
|
+
JSON.parse(client.get("/cards/#{card.id}/actions", COMMENT_PARAMS).body).reverse.map do |action|
|
|
134
140
|
{ author: action.dig("memberCreator", "username"), date: action["date"], text: action.dig("data", "text") }
|
|
135
141
|
end
|
|
136
142
|
end
|
data/lib/trello_tool/version.rb
CHANGED
data/lib/trello_tool_thor.rb
CHANGED
|
@@ -350,6 +350,22 @@ class TrelloToolThor < Thor
|
|
|
350
350
|
say "removed #{item['name'].inspect} from #{card.url}"
|
|
351
351
|
end
|
|
352
352
|
|
|
353
|
+
desc "rename_checklist CARD_ID_OR_URL NAME NEW_NAME", "renames the card's checklist of that name"
|
|
354
|
+
|
|
355
|
+
def rename_checklist(card_id_or_url, name, new_name)
|
|
356
|
+
raise Thor::Error, "the new name is empty" if new_name.to_s.strip.empty?
|
|
357
|
+
|
|
358
|
+
card = client.find_card(extract_card_id(card_id_or_url))
|
|
359
|
+
checklist = card.checklists.detect { |candidate| candidate.name == name }
|
|
360
|
+
unless checklist
|
|
361
|
+
raise Thor::Error, "no checklist called #{name.inspect} on #{card.url}. " \
|
|
362
|
+
"Checklists: #{card.checklists.map { |candidate| candidate.name.inspect }.join(', ')}"
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
client.rename_checklist(checklist, name: new_name)
|
|
366
|
+
say "renamed checklist #{name.inspect} to #{new_name.inspect} on #{card.url}"
|
|
367
|
+
end
|
|
368
|
+
|
|
353
369
|
private
|
|
354
370
|
|
|
355
371
|
# @param present [Array<Trello::Label>] labels the card already had
|