Module: ActiveProject::Adapters::Trello::Comments
- Included in:
- ActiveProject::Adapters::TrelloAdapter
- Defined in:
- lib/active_project/adapters/trello/comments.rb
Instance Method Summary collapse
-
#add_comment(card_id, comment_body, _context = {}) ⇒ ActiveProject::Resources::Comment
Adds a comment to a Card in Trello.
-
#delete_comment(comment_id, context = {}) ⇒ Boolean
Deletes a comment from a Card in Trello.
-
#update_comment(comment_id, body, context = {}) ⇒ ActiveProject::Resources::Comment
Updates a comment on a Card in Trello.
Instance Method Details
#add_comment(card_id, comment_body, _context = {}) ⇒ ActiveProject::Resources::Comment
Adds a comment to a Card in Trello.
12 13 14 15 16 17 |
# File 'lib/active_project/adapters/trello/comments.rb', line 12 def add_comment(card_id, comment_body, _context = {}) path = "cards/#{card_id}/actions/comments" query_params = { text: comment_body } comment_data = make_request(:post, path, nil, query_params) map_comment_action_data(comment_data, card_id) end |
#delete_comment(comment_id, context = {}) ⇒ Boolean
Deletes a comment from a Card in Trello.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/active_project/adapters/trello/comments.rb', line 41 def delete_comment(comment_id, context = {}) card_id = context[:card_id] unless card_id raise ArgumentError, "Missing required context: :card_id must be provided for TrelloAdapter#delete_comment" end path = "cards/#{card_id}/actions/#{comment_id}/comments" make_request(:delete, path) true end |
#update_comment(comment_id, body, context = {}) ⇒ ActiveProject::Resources::Comment
Updates a comment on a Card in Trello.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/active_project/adapters/trello/comments.rb', line 24 def update_comment(comment_id, body, context = {}) card_id = context[:card_id] unless card_id raise ArgumentError, "Missing required context: :card_id must be provided for TrelloAdapter#update_comment" end path = "cards/#{card_id}/actions/#{comment_id}/comments" query_params = { text: body } comment_data = make_request(:put, path, nil, query_params) map_comment_action_data(comment_data, card_id) end |