Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment action #302

Merged
merged 7 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ bundle\:all:
@${RUN} jruby_9_2 bundle install

bundle:
@${RUN} ruby_2_6 bundle install
@${RUN} ruby_3_0 bundle install
dev:
@${RUN} ruby_2_6 bash
@${RUN} ruby_3_0 bash
test:
@${RUN} ruby_2_6 bundle exec rspec $(filter-out $@,$(MAKECMDGOALS))
@${RUN} ruby_3_0 bundle exec rspec $(filter-out $@,$(MAKECMDGOALS))
dev\:ruby_2_5:
@${RUN} ruby_2_5 bash
test\:ruby_2_5:
Expand Down
15 changes: 9 additions & 6 deletions lib/trello/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,36 @@ class Comment < BasicData
attribute :text, update_only: true
end

validates_presence_of :action_id, :text, :date, :creator_id
validates_presence_of :id, :text, :date, :creator_id
validates_length_of :text, in: 1..16384

class << self
def find(action_id)
client.find(:action, action_id)
response = client.get("/actions/#{action_id}")
self.parse response do |data|
data.client = client
end
end
end

# Returns the board this comment is located
def board
Board.from_response client.get("/actions/#{action_id}/board")
Board.from_response client.get("/actions/#{id}/board")
end

# Returns the card the comment is located
def card
Card.from_response client.get("/actions/#{action_id}/card")
Card.from_response client.get("/actions/#{id}/card")
end

# Returns the list the comment is located
def list
List.from_response client.get("/actions/#{action_id}/list")
List.from_response client.get("/actions/#{id}/list")
end

# Deletes the comment from the card
def delete
ruta = "/actions/#{action_id}"
ruta = "/actions/#{id}"
client.delete(ruta)
end

Expand Down
109 changes: 109 additions & 0 deletions spec/cassettes/can_get_comments_board.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 111 additions & 0 deletions spec/cassettes/can_get_comments_card.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 109 additions & 0 deletions spec/cassettes/can_get_comments_list.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading