Module: Tacokit::Client::Cards
- Included in:
- Tacokit::Client
- Defined in:
- lib/tacokit/client/cards.rb
Overview
Methods for the Cards API
Instance Method Summary (collapse)
-
- (Object) add_checklist(card_id, name)
(also: #start_checklist)
Start a new checklist on card.
-
- (Object) add_comment(card_id, text, options = {})
(also: #create_card_comment)
Add a comment to a card.
-
- (Object) add_label(card_id, color, options = {})
Add label to card.
-
- (Object) add_member_to_card(card_id, member_id)
Add a member to a card.
-
- (Object) add_sticker(card_id, image_name, options = {})
(also: #create_sticker)
Add sticker to card.
-
- (Object) archive_card(card_id)
Archive a card.
-
- (Object) attach_file(card_id, url, mime_type = nil, options = {})
(also: #create_card_attachment)
Attach a file to a card.
-
- (Tacokit::Resource<Attachment>) attachment(card_id, attachment_id, options = {})
Retrieve a card attachment.
-
- (Tacokit::Collection<Attachment>) attachments(card_id, options = {})
(also: #card_attachments)
Retrieve card attachments.
-
- (Tacokit::Resource<Card>) card(card_id, options = nil)
Retrieve a card by id or shortlink.
-
- (Tacokit::Collection<Action>) card_actions(card_id, options = {})
Retrieve card actions.
-
- (Tacokit::Resource<Board>) card_board(card_id, options = {})
Retrieve a card board.
-
- (Tacokit::Resource<List>) card_list(card_id, options = {})
Retrive a card list.
-
- (Tacokit::Collection) card_members(card_id, options = {})
Retrieve card members.
-
- (Tacokit::Collection) card_members_voted(card_id, options = {})
Retrieve members who voted on a card.
-
- (Tacokit::Collection) check_item_states(card_id, options = {})
Retrieve card checklist item states.
-
- (Tacokit::Collection<Checklist>) checklists(card_id, options = {})
Retrieve card checklists.
-
- (Object) convert_to_card(card_id, checklist_id, check_item_id)
Convert a checklist item to a card.
-
- (Object) copy_checklist(card_id, checklist_id)
Copy another checklist to card.
-
- (Object) create_card(list_id, name = nil, options = {})
Create a new card.
-
- (Object) create_card_resource(card_id, resource, *paths)
Create a card resource.
-
- (Object) delete_card(card_id)
Delete a card.
-
- (Object) move_card(card_id, options)
Move card to another position, board and/or list.
-
- (Object) remove_attachment(card_id, attachment_id)
(also: #delete_attachement)
Remove an attachment.
-
- (Object) remove_card_member(card_id, member_id)
(also: #delete_card_member)
Remove a member from a card.
-
- (Object) remove_checklist(card_id, checklist_id)
(also: #delete_checklist)
Remove checklist.
-
- (Object) remove_comment(card_id, comment_id)
(also: #delete_comment)
Remove a comment.
-
- (Object) remove_label(card_id, color)
(also: #delete_label)
Remove label from card.
-
- (Object) remove_sticker(card_id, sticker_id)
(also: #delete_sticker)
Remove a sticker from a card.
-
- (Object) remove_vote(card_id, member_id)
(also: #delete_vote)
Remove a vote from a card.
-
- (Object) restore_card(card_id)
Restore an archived card.
-
- (Tacokit::Collection) stickers(card_id, options = {})
Retrieve card stickers.
-
- (Object) subscribe_to_card(card_id)
Subscribe to card.
-
- (Object) unsubscribe_from_card(card_id)
Unubscribe from card.
-
- (Object) update_card(card_id, options = {})
Update card attributes.
-
- (Object) update_card_name(card_id, name)
Update card name.
-
- (Object) update_card_resource(card_id, resource, *paths)
Update any card resource.
-
- (Object) update_check_item(card_id, checklist_id, check_item_id, options = {})
Update checklist item text, position or state.
-
- (Object) update_comment(card_id, comment_id, text, options = {})
(also: #edit_comment)
Update comment text.
-
- (Object) vote(card_id, member_id)
(also: #create_vote)
Cast vote for card.
Instance Method Details
- (Object) add_checklist(card_id, name) Also known as: start_checklist
Start a new checklist on card
327 328 329 |
# File 'lib/tacokit/client/cards.rb', line 327 def add_checklist(card_id, name) create_card_resource(card_id, "checklists", name: name) end |
- (Object) add_comment(card_id, text, options = {}) Also known as: create_card_comment
Add a comment to a card
273 274 275 276 |
# File 'lib/tacokit/client/cards.rb', line 273 def add_comment(card_id, text, = {}) .update text: text create_card_resource card_id, "actions", "comments", end |
- (Object) add_label(card_id, color, options = {})
Add label to card
365 366 367 |
# File 'lib/tacokit/client/cards.rb', line 365 def add_label(card_id, color, = {}) create_card_resource(card_id, "labels", .merge(color: color)) end |
- (Object) add_member_to_card(card_id, member_id)
Add a member to a card
354 355 356 |
# File 'lib/tacokit/client/cards.rb', line 354 def add_member_to_card(card_id, member_id) create_card_resource(card_id, "idMembers", value: resource_id(member_id)) end |
- (Object) add_sticker(card_id, image_name, options = {}) Also known as: create_sticker
Add sticker to card
388 389 390 391 |
# File 'lib/tacokit/client/cards.rb', line 388 def add_sticker(card_id, image_name, = {}) defaults = { top: 0, left: 0, z_index: 1 } create_card_resource(card_id, "stickers", defaults.merge(.merge(image: image_name))) end |
- (Object) archive_card(card_id)
Archive a card
187 188 189 |
# File 'lib/tacokit/client/cards.rb', line 187 def archive_card(card_id) update_card(card_id, closed: true) end |
- (Object) attach_file(card_id, url, mime_type = nil, options = {}) Also known as: create_card_attachment
Attach a file to a card
289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/tacokit/client/cards.rb', line 289 def attach_file(card_id, url, mime_type = nil, = {}) = mime_type if mime_type.is_a?(Hash) uri = URI.parse(url) if uri.scheme =~ %r{https?} .update url: uri.to_s, mime_type: mime_type else file = Faraday::UploadIO.new(uri.to_s, mime_type) .update file: file, mime_type: file.content_type end create_card_resource card_id, "attachments", end |
- (Tacokit::Resource<Attachment>) attachment(card_id, attachment_id, options = {})
Retrieve a card attachment
54 55 56 |
# File 'lib/tacokit/client/cards.rb', line 54 def (card_id, , = {}) card_resource(card_id, "attachments/#{resource_id()}", ) end |
- (Tacokit::Collection<Attachment>) attachments(card_id, options = {}) Also known as: card_attachments
Retrieve card attachments
40 41 42 |
# File 'lib/tacokit/client/cards.rb', line 40 def (card_id, = {}) card_resource(card_id, "attachments", ) end |
- (Tacokit::Resource<Card>) card(card_id, options = nil)
Retrieve a card by id or shortlink
16 17 18 |
# File 'lib/tacokit/client/cards.rb', line 16 def card(card_id, = nil) get card_path(card_id), end |
- (Tacokit::Collection<Action>) card_actions(card_id, options = {})
Retrieve card actions
28 29 30 |
# File 'lib/tacokit/client/cards.rb', line 28 def card_actions(card_id, = {}) paginated_card_resource(card_id, "actions", ) end |
- (Tacokit::Resource<Board>) card_board(card_id, options = {})
Retrieve a card board
66 67 68 |
# File 'lib/tacokit/client/cards.rb', line 66 def card_board(card_id, = {}) card_resource(card_id, "board", ) end |
- (Tacokit::Resource<List>) card_list(card_id, options = {})
Retrive a card list
101 102 103 |
# File 'lib/tacokit/client/cards.rb', line 101 def card_list(card_id, = {}) card_resource(card_id, "list", ) end |
- (Tacokit::Collection) card_members(card_id, options = {})
Retrieve card members
113 114 115 |
# File 'lib/tacokit/client/cards.rb', line 113 def card_members(card_id, = {}) card_resource(card_id, "members", ) end |
- (Tacokit::Collection) card_members_voted(card_id, options = {})
Retrieve members who voted on a card
125 126 127 |
# File 'lib/tacokit/client/cards.rb', line 125 def card_members_voted(card_id, = {}) card_resource(card_id, "members_voted", ) end |
- (Tacokit::Collection) check_item_states(card_id, options = {})
Retrieve card checklist item states
77 78 79 |
# File 'lib/tacokit/client/cards.rb', line 77 def check_item_states(card_id, = {}) card_resource(card_id, "check_item_states", ) end |
- (Tacokit::Collection<Checklist>) checklists(card_id, options = {})
Retrieve card checklists
89 90 91 |
# File 'lib/tacokit/client/cards.rb', line 89 def checklists(card_id, = {}) card_resource(card_id, "checklists", ) end |
- (Object) convert_to_card(card_id, checklist_id, check_item_id)
Convert a checklist item to a card
315 316 317 318 |
# File 'lib/tacokit/client/cards.rb', line 315 def convert_to_card(card_id, checklist_id, check_item_id) create_card_resource card_id, "checklist", resource_id(checklist_id), "checkItem", resource_id(check_item_id), "convertToCard" end |
- (Object) copy_checklist(card_id, checklist_id)
Copy another checklist to card
340 341 342 |
# File 'lib/tacokit/client/cards.rb', line 340 def copy_checklist(card_id, checklist_id) create_card_resource(card_id, "checklists", checklist_source_id: resource_id(checklist_id)) end |
- (Object) create_card(list_id, name = nil, options = {})
Create a new card
262 263 264 |
# File 'lib/tacokit/client/cards.rb', line 262 def create_card(list_id, name = nil, = {}) post "cards", .merge(name: name, list_id: resource_id(list_id)) end |
- (Object) create_card_resource(card_id, resource, *paths)
Create a card resource
396 397 398 399 |
# File 'lib/tacokit/client/cards.rb', line 396 def create_card_resource(card_id, resource, *paths) paths, = (camp(resource), *paths) post card_path(card_id, *paths), end |
- (Object) delete_card(card_id)
Delete a card
407 408 409 |
# File 'lib/tacokit/client/cards.rb', line 407 def delete_card(card_id) delete card_path(resource_id(card_id)) end |
- (Object) move_card(card_id, options)
Move card to another position, board and/or list
211 212 213 214 215 216 |
# File 'lib/tacokit/client/cards.rb', line 211 def move_card(card_id, ) unless .is_a?(Hash) && ([:board_id, :list_id, :pos].any? { |key| .key? key }) raise ArgumentError, "Required option: :pos, :board_id and/or :list_id" end update_card(card_id, ) end |
- (Object) remove_attachment(card_id, attachment_id) Also known as: delete_attachement
Remove an attachment
432 433 434 |
# File 'lib/tacokit/client/cards.rb', line 432 def (card_id, ) delete_card_resource card_id, "attachments", resource_id() end |
- (Object) remove_card_member(card_id, member_id) Also known as: delete_card_member
Remove a member from a card
459 460 461 |
# File 'lib/tacokit/client/cards.rb', line 459 def remove_card_member(card_id, member_id) delete_card_resource card_id, "idMembers", resource_id(member_id) end |
- (Object) remove_checklist(card_id, checklist_id) Also known as: delete_checklist
Remove checklist
444 445 446 |
# File 'lib/tacokit/client/cards.rb', line 444 def remove_checklist(card_id, checklist_id) delete_card_resource card_id, "checklists", checklist_id end |
- (Object) remove_comment(card_id, comment_id) Also known as: delete_comment
Remove a comment
419 420 421 |
# File 'lib/tacokit/client/cards.rb', line 419 def remove_comment(card_id, comment_id) delete_card_resource card_id, "actions", resource_id(comment_id), "comments" end |
- (Object) remove_label(card_id, color) Also known as: delete_label
Remove label from card
470 471 472 |
# File 'lib/tacokit/client/cards.rb', line 470 def remove_label(card_id, color) delete_card_resource card_id, "labels", color end |
- (Object) remove_sticker(card_id, sticker_id) Also known as: delete_sticker
Remove a sticker from a card
494 495 496 |
# File 'lib/tacokit/client/cards.rb', line 494 def remove_sticker(card_id, sticker_id) delete_card_resource card_id, "stickers", resource_id(sticker_id) end |
- (Object) remove_vote(card_id, member_id) Also known as: delete_vote
Remove a vote from a card
482 483 484 |
# File 'lib/tacokit/client/cards.rb', line 482 def remove_vote(card_id, member_id) delete_card_resource card_id, "membersVoted", resource_id(member_id) end |
- (Object) restore_card(card_id)
Restore an archived card
196 197 198 |
# File 'lib/tacokit/client/cards.rb', line 196 def restore_card(card_id) update_card(card_id, closed: false) end |
- (Tacokit::Collection) stickers(card_id, options = {})
Retrieve card stickers
137 138 139 |
# File 'lib/tacokit/client/cards.rb', line 137 def stickers(card_id, = {}) card_resource(card_id, "stickers", ) end |
- (Object) subscribe_to_card(card_id)
Subscribe to card
233 234 235 |
# File 'lib/tacokit/client/cards.rb', line 233 def subscribe_to_card(card_id) put card_path(card_id, "subscribed"), value: true end |
- (Object) unsubscribe_from_card(card_id)
Unubscribe from card
242 243 244 |
# File 'lib/tacokit/client/cards.rb', line 242 def unsubscribe_from_card(card_id) put card_path(card_id, "subscribed"), value: false end |
- (Object) update_card(card_id, options = {})
Update card attributes
148 149 150 |
# File 'lib/tacokit/client/cards.rb', line 148 def update_card(card_id, = {}) put card_path(card_id), end |
- (Object) update_card_name(card_id, name)
Update card name
224 225 226 |
# File 'lib/tacokit/client/cards.rb', line 224 def update_card_name(card_id, name) put card_path(card_id, "name"), value: name end |
- (Object) update_card_resource(card_id, resource, *paths)
Update any card resource
250 251 252 253 |
# File 'lib/tacokit/client/cards.rb', line 250 def update_card_resource(card_id, resource, *paths) paths, = (camp(resource), *paths) put card_path(card_id, *paths), end |
- (Object) update_check_item(card_id, checklist_id, check_item_id, options = {})
Update checklist item text, position or state
173 174 175 176 177 178 179 180 |
# File 'lib/tacokit/client/cards.rb', line 173 def update_check_item(card_id, checklist_id, check_item_id, = {}) update_card_resource card_id, "checklist", resource_id(checklist_id), "checkItem", resource_id(check_item_id), end |
- (Object) update_comment(card_id, comment_id, text, options = {}) Also known as: edit_comment
Update comment text
162 163 164 |
# File 'lib/tacokit/client/cards.rb', line 162 def update_comment(card_id, comment_id, text, = {}) update_card_resource(card_id, "actions", resource_id(comment_id), "comments", .merge(text: text)) end |
- (Object) vote(card_id, member_id) Also known as: create_vote
Cast vote for card
376 377 378 |
# File 'lib/tacokit/client/cards.rb', line 376 def vote(card_id, member_id) create_card_resource(card_id, "membersVoted", value: resource_id(member_id)) end |