diff --git a/Makefile b/Makefile index 7908dcfe..757ec426 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/lib/trello/comment.rb b/lib/trello/comment.rb index 2633417f..ef6b566e 100644 --- a/lib/trello/comment.rb +++ b/lib/trello/comment.rb @@ -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 diff --git a/spec/cassettes/can_get_comments_board.yml b/spec/cassettes/can_get_comments_board.yml new file mode 100644 index 00000000..a802f226 --- /dev/null +++ b/spec/cassettes/can_get_comments_board.yml @@ -0,0 +1,109 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd/board?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 200 + message: OK + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - max-age=0, must-revalidate, no-cache, no-store + Pragma: + - no-cache + Expires: + - Thu, 01 Jan 1970 00:00:00 + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Set-Cookie: + - dsc=set_cookie_dsc; Path=/; Expires=Sat, 05 Feb 2022 16:00:16 GMT; Secure + - preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.oSQJRIF9RziQFo1wvRya3fIryaPvbkhBP%2F03d0%2F%2FuwE; + Path=/; HttpOnly + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '99' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '299' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '374' + X-Server-Time: + - '1643817616469' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 02 Feb 2022 16:00:16 GMT + X-Envoy-Upstream-Service-Time: + - '112' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - 8927791bbd7ca38c + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"id":"5e93ba98614ac22d22f085c4","name":"IT 2","desc":"","descData":null,"closed":false,"dateClosed":null,"idOrganization":"5e93ba154634282b6df23bcc","shortLink":"y1TF9GTa","powerUps":[],"dateLastActivity":"2022-02-02T15:46:05.569Z","idTags":[],"datePluginDisable":null,"creationMethod":null,"idBoardSource":null,"idMemberCreator":"5e679b808e6e8828784b30e1","idEnterprise":null,"pinned":false,"starred":true,"url":"https://trello.com/b/y1TF9GTa/it-2","shortUrl":"https://trello.com/b/y1TF9GTa","enterpriseOwned":false,"premiumFeatures":["additionalBoardBackgrounds","additionalStickers","customBoardBackgrounds","customEmoji","customStickers","plugins"],"ixUpdate":"121","limits":{"attachments":{"perBoard":{"status":"ok","disableAt":36000,"warnAt":28800},"perCard":{"status":"ok","disableAt":1000,"warnAt":800}},"boards":{"totalMembersPerBoard":{"status":"ok","disableAt":1600,"warnAt":1280},"totalAccessRequestsPerBoard":{"status":"ok","disableAt":4000,"warnAt":3200}},"cards":{"openPerBoard":{"status":"ok","disableAt":5000,"warnAt":4000},"openPerList":{"status":"ok","disableAt":5000,"warnAt":4000},"totalPerBoard":{"status":"ok","disableAt":2000000,"warnAt":1600000},"totalPerList":{"status":"ok","disableAt":1000000,"warnAt":800000}},"checklists":{"perBoard":{"status":"ok","disableAt":1800000,"warnAt":1440000},"perCard":{"status":"ok","disableAt":500,"warnAt":400}},"checkItems":{"perChecklist":{"status":"ok","disableAt":200,"warnAt":160}},"customFields":{"perBoard":{"status":"ok","disableAt":50,"warnAt":40}},"customFieldOptions":{"perField":{"status":"ok","disableAt":50,"warnAt":40}},"labels":{"perBoard":{"status":"ok","disableAt":1000,"warnAt":800}},"lists":{"openPerBoard":{"status":"ok","disableAt":500,"warnAt":400},"totalPerBoard":{"status":"ok","disableAt":3000,"warnAt":2400}},"stickers":{"perCard":{"status":"ok","disableAt":70,"warnAt":56}},"reactions":{"perAction":{"status":"ok","disableAt":900,"warnAt":720},"uniquePerAction":{"status":"ok","disableAt":17,"warnAt":14}}},"memberships":[{"id":"5e93ba98614ac22d22f085c5","idMember":"5e679b808e6e8828784b30e1","memberType":"admin","unconfirmed":false,"deactivated":false}],"subscribed":false,"dateLastView":"2022-02-02T15:51:08.226Z","templateGallery":null,"prefs":{"permissionLevel":"org","hideVotes":false,"voting":"disabled","comments":"members","invitations":"members","selfJoin":true,"cardCovers":true,"isTemplate":false,"cardAging":"regular","calendarFeedEnabled":false,"hiddenPluginBoardButtons":[],"background":"5e9093e2134e6987494c7ca8","backgroundImage":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/original/2300ad88b61e46629c4063e0095bf986/photo-1586462175816-c0e709898f01","backgroundImageScaled":[{"width":140,"height":93,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/140x93/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":256,"height":171,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/256x171/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":480,"height":320,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/480x320/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":960,"height":640,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/960x640/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":1024,"height":683,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/1024x683/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":1280,"height":854,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/1280x854/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":1920,"height":1280,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/1920x1280/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":2048,"height":1366,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2048x1366/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":2400,"height":1600,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2400x1600/08d5092270be6b5bb40247b7a7f5a924/photo-1586462175816-c0e709898f01.jpg"},{"width":2560,"height":1707,"url":"https://trello-backgrounds.s3.amazonaws.com/SharedBackground/original/2300ad88b61e46629c4063e0095bf986/photo-1586462175816-c0e709898f01"}],"backgroundTile":false,"backgroundBrightness":"light","backgroundBottomColor":"#92d3ca","backgroundTopColor":"#d9e3eb","canBePublic":true,"canBeEnterprise":true,"canBeOrg":true,"canBePrivate":true,"canInvite":true},"labelNames":{"green":"","yellow":"","orange":"","red":"","purple":"","blue":"","sky":"","lime":"","pink":"","black":""}}' + recorded_at: Wed, 02 Feb 2022 16:00:16 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/cassettes/can_get_comments_card.yml b/spec/cassettes/can_get_comments_card.yml new file mode 100644 index 00000000..129afe2c --- /dev/null +++ b/spec/cassettes/can_get_comments_card.yml @@ -0,0 +1,111 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd/card?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 200 + message: OK + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - max-age=0, must-revalidate, no-cache, no-store + Pragma: + - no-cache + Expires: + - Thu, 01 Jan 1970 00:00:00 + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Set-Cookie: + - dsc=set_cookie_dsc; Path=/; Expires=Sat, 05 Feb 2022 15:58:29 GMT; Secure + - preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.oSQJRIF9RziQFo1wvRya3fIryaPvbkhBP%2F03d0%2F%2FuwE; + Path=/; HttpOnly + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '99' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '299' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '374' + X-Server-Time: + - '1643817509671' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 02 Feb 2022 15:58:29 GMT + X-Envoy-Upstream-Service-Time: + - '107' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - 8af5e6fa0ddce319 + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"id":"5f4f98b06183211be96855cb","address":null,"checkItemStates":[],"closed":false,"coordinates":null,"creationMethod":null,"dateLastActivity":"2022-02-02T15:46:05.573Z","desc":"testing + card create","descData":null,"dueReminder":null,"idBoard":"5e93ba98614ac22d22f085c4","idLabels":["5e93ba987669b2254983d69d","5e93ba987669b2254983d69e"],"idList":"5e93bac014d40e501ee46b8d","idMembersVoted":[],"idShort":6,"idAttachmentCover":null,"locationName":null,"manualCoverAttachment":false,"name":"Test + Trello::Card.create","pos":2048,"shortLink":"JlpJt3gF","isTemplate":false,"cardRole":null,"dueComplete":false,"due":null,"email":null,"shortUrl":"https://trello.com/c/JlpJt3gF","staticMapUrl":null,"start":null,"url":"https://trello.com/c/JlpJt3gF/6-test-trellocardcreate","cover":{"idAttachment":null,"color":null,"idUploadedBackground":null,"size":"normal","brightness":"light","idPlugin":null},"idMembers":["5e679b808e6e8828784b30e1"],"limits":{"attachments":{"perCard":{"status":"ok","disableAt":1000,"warnAt":800}},"checklists":{"perCard":{"status":"ok","disableAt":500,"warnAt":400}},"stickers":{"perCard":{"status":"ok","disableAt":70,"warnAt":56}}},"labels":[{"id":"5e93ba987669b2254983d69d","idBoard":"5e93ba98614ac22d22f085c4","name":"","color":"green"},{"id":"5e93ba987669b2254983d69e","idBoard":"5e93ba98614ac22d22f085c4","name":"","color":"orange"}],"idChecklists":[],"badges":{"attachmentsByType":{"trello":{"board":0,"card":0}},"location":false,"votes":0,"viewingMemberVoted":false,"subscribed":true,"fogbugz":"","checkItems":0,"checkItemsChecked":0,"checkItemsEarliestDue":null,"comments":3,"attachments":0,"description":true,"due":null,"dueComplete":false,"start":null},"subscribed":true}' + recorded_at: Wed, 02 Feb 2022 15:58:29 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/cassettes/can_get_comments_list.yml b/spec/cassettes/can_get_comments_list.yml new file mode 100644 index 00000000..82d36e44 --- /dev/null +++ b/spec/cassettes/can_get_comments_list.yml @@ -0,0 +1,109 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd/list?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 200 + message: OK + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - max-age=0, must-revalidate, no-cache, no-store + Pragma: + - no-cache + Expires: + - Thu, 01 Jan 1970 00:00:00 + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Set-Cookie: + - dsc=set_cookie_dsc; Path=/; Expires=Sat, 05 Feb 2022 16:00:45 GMT; Secure + - preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.oSQJRIF9RziQFo1wvRya3fIryaPvbkhBP%2F03d0%2F%2FuwE; + Path=/; HttpOnly + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '99' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '299' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '374' + X-Server-Time: + - '1643817645931' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 02 Feb 2022 16:00:45 GMT + X-Envoy-Upstream-Service-Time: + - '131' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - 9a52105231902ee1 + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"id":"5e93bac014d40e501ee46b8d","name":"L1","closed":false,"pos":65535,"softLimit":null,"creationMethod":null,"idBoard":"5e93ba98614ac22d22f085c4","limits":{"cards":{"openPerList":{"status":"ok","disableAt":5000,"warnAt":4000},"totalPerList":{"status":"ok","disableAt":1000000,"warnAt":800000}}},"subscribed":false}' + recorded_at: Wed, 02 Feb 2022 16:00:46 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/cassettes/comment_delete.yml b/spec/cassettes/comment_delete.yml new file mode 100644 index 00000000..1192543d --- /dev/null +++ b/spec/cassettes/comment_delete.yml @@ -0,0 +1,331 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 200 + message: OK + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - max-age=0, must-revalidate, no-cache, no-store + Pragma: + - no-cache + Expires: + - Thu, 01 Jan 1970 00:00:00 + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Set-Cookie: + - dsc=set_cookie_dsc; Path=/; Expires=Sat, 05 Feb 2022 16:17:21 GMT; Secure + - preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.oSQJRIF9RziQFo1wvRya3fIryaPvbkhBP%2F03d0%2F%2FuwE; + Path=/; HttpOnly + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '99' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '299' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '374' + X-Server-Time: + - '1643818641053' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 02 Feb 2022 16:17:21 GMT + X-Envoy-Upstream-Service-Time: + - '99' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - b49e26c74840dba3 + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"id":"61faa73dd180eb86947af0fd","idMemberCreator":"5e679b808e6e8828784b30e1","data":{"text":"why + I can''t get action","textData":{"emoji":{}},"card":{"id":"5f4f98b06183211be96855cb","name":"Test + Trello::Card.create","idShort":6,"shortLink":"JlpJt3gF"},"board":{"id":"5e93ba98614ac22d22f085c4","name":"IT + 2","shortLink":"y1TF9GTa"},"list":{"id":"5e93bac014d40e501ee46b8d","name":"L1"}},"type":"commentCard","date":"2022-02-02T15:46:05.589Z","appCreator":null,"limits":{"reactions":{"perAction":{"status":"ok","disableAt":900,"warnAt":720},"uniquePerAction":{"status":"ok","disableAt":17,"warnAt":14}}},"display":{"translationKey":"action_comment_on_card","entities":{"contextOn":{"type":"translatable","translationKey":"action_on","hideIfContext":true,"idContext":"5f4f98b06183211be96855cb"},"card":{"type":"card","hideIfContext":true,"id":"5f4f98b06183211be96855cb","shortLink":"JlpJt3gF","text":"Test + Trello::Card.create"},"comment":{"type":"comment","text":"why I can''t get + action"},"memberCreator":{"type":"member","id":"5e679b808e6e8828784b30e1","username":"hoppertest","text":"Hopper + Test"}}},"memberCreator":{"id":"5e679b808e6e8828784b30e1","activityBlocked":false,"avatarHash":null,"avatarUrl":null,"fullName":"Hopper + Test","idMemberReferrer":null,"initials":"HT","nonPublic":{},"nonPublicAvailable":true,"username":"hoppertest"}}' + recorded_at: Wed, 02 Feb 2022 16:17:21 GMT +- request: + method: delete + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 200 + message: OK + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - max-age=0, must-revalidate, no-cache, no-store + Pragma: + - no-cache + Expires: + - Thu, 01 Jan 1970 00:00:00 + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '98' + X-Rate-Limit-Action-Interval-Ms: + - '3600000' + X-Rate-Limit-Action-Max: + - '15000' + X-Rate-Limit-Action-Remaining: + - '14999' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '298' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '373' + Set-Cookie: + - preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.oSQJRIF9RziQFo1wvRya3fIryaPvbkhBP%2F03d0%2F%2FuwE; + Path=/; HttpOnly + X-Server-Time: + - '1643818641840' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 02 Feb 2022 16:17:21 GMT + X-Envoy-Upstream-Service-Time: + - '140' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - 8ffdb0eeb6ff1cda + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"_value":null} + +' + recorded_at: Wed, 02 Feb 2022 16:17:21 GMT +- request: + method: get + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 404 + message: Not Found + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - no-store, no-cache, must-revalidate, proxy-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Set-Cookie: + - dsc=set_cookie_dsc; Path=/; Expires=Sat, 05 Feb 2022 16:17:22 GMT; Secure + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '97' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '297' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '372' + Content-Type: + - text/plain; charset=utf-8 + Content-Length: + - '37' + Date: + - Wed, 02 Feb 2022 16:17:22 GMT + X-Envoy-Upstream-Service-Time: + - '86' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - f0fa637a7466a1af + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + body: + encoding: UTF-8 + string: The requested resource was not found. + recorded_at: Wed, 02 Feb 2022 16:17:22 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/cassettes/comment_find_with_id.yml b/spec/cassettes/comment_find_with_id.yml new file mode 100644 index 00000000..dc4db223 --- /dev/null +++ b/spec/cassettes/comment_find_with_id.yml @@ -0,0 +1,116 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.trello.com/1/actions/61faa73dd180eb86947af0fd?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - "*/*" + User-Agent: + - rest-client/2.1.0 (linux x86_64) ruby/3.0.0p0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Host: + - api.trello.com + response: + status: + code: 200 + message: OK + headers: + X-Dns-Prefetch-Control: + - 'off' + X-Frame-Options: + - DENY + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Surrogate-Control: + - no-store + Cache-Control: + - max-age=0, must-revalidate, no-cache, no-store + Pragma: + - no-cache + Expires: + - Thu, 01 Jan 1970 00:00:00 + X-Trello-Version: + - 1.111614.0 + X-Trello-Environment: + - Production + Set-Cookie: + - dsc=set_cookie_dsc; Path=/; Expires=Sat, 05 Feb 2022 16:03:17 GMT; Secure + - preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.oSQJRIF9RziQFo1wvRya3fIryaPvbkhBP%2F03d0%2F%2FuwE; + Path=/; HttpOnly + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET, PUT, POST, DELETE + Access-Control-Allow-Headers: + - Authorization, Accept, Content-Type + Access-Control-Expose-Headers: + - x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining, + x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining + X-Rate-Limit-Api-Token-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Token-Max: + - '100' + X-Rate-Limit-Api-Token-Remaining: + - '99' + X-Rate-Limit-Api-Key-Interval-Ms: + - '10000' + X-Rate-Limit-Api-Key-Max: + - '300' + X-Rate-Limit-Api-Key-Remaining: + - '299' + X-Rate-Limit-Member-Interval-Ms: + - '10000' + X-Rate-Limit-Member-Max: + - '375' + X-Rate-Limit-Member-Remaining: + - '374' + X-Server-Time: + - '1643817797732' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 02 Feb 2022 16:03:17 GMT + X-Envoy-Upstream-Service-Time: + - '104' + Expect-Ct: + - report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/trello-edge", + max-age=86400 + Strict-Transport-Security: + - max-age=63072000; preload + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Atl-Traceid: + - '084617945389853c' + Report-To: + - '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], + "include_subdomains": true}' + Nel: + - '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": + 0.001}' + Server: + - globaledge-envoy + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"id":"61faa73dd180eb86947af0fd","idMemberCreator":"5e679b808e6e8828784b30e1","data":{"text":"why + I can''t get action","textData":{"emoji":{}},"card":{"id":"5f4f98b06183211be96855cb","name":"Test + Trello::Card.create","idShort":6,"shortLink":"JlpJt3gF"},"board":{"id":"5e93ba98614ac22d22f085c4","name":"IT + 2","shortLink":"y1TF9GTa"},"list":{"id":"5e93bac014d40e501ee46b8d","name":"L1"}},"type":"commentCard","date":"2022-02-02T15:46:05.589Z","appCreator":null,"limits":{"reactions":{"perAction":{"status":"ok","disableAt":900,"warnAt":720},"uniquePerAction":{"status":"ok","disableAt":17,"warnAt":14}}},"display":{"translationKey":"action_comment_on_card","entities":{"contextOn":{"type":"translatable","translationKey":"action_on","hideIfContext":true,"idContext":"5f4f98b06183211be96855cb"},"card":{"type":"card","hideIfContext":true,"id":"5f4f98b06183211be96855cb","shortLink":"JlpJt3gF","text":"Test + Trello::Card.create"},"comment":{"type":"comment","text":"why I can''t get + action"},"memberCreator":{"type":"member","id":"5e679b808e6e8828784b30e1","username":"hoppertest","text":"Hopper + Test"}}},"memberCreator":{"id":"5e679b808e6e8828784b30e1","activityBlocked":false,"avatarHash":null,"avatarUrl":null,"fullName":"Hopper + Test","idMemberReferrer":null,"initials":"HT","nonPublic":{},"nonPublicAvailable":true,"username":"hoppertest"}}' + recorded_at: Wed, 02 Feb 2022 16:03:17 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/integration/comment/association/board_spec.rb b/spec/integration/comment/association/board_spec.rb new file mode 100644 index 00000000..1a93dd25 --- /dev/null +++ b/spec/integration/comment/association/board_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +RSpec.describe 'Trello::Comment#board' do + include IntegrationHelpers + + before { setup_trello } + + it "can get the comment's board" do + VCR.use_cassette('can_get_comments_board') do + comment = Trello::Comment.new(id: "61faa73dd180eb86947af0fd") + + board = comment.board + expect(board.id).not_to be_nil + end + end + +end diff --git a/spec/integration/comment/association/card_spec.rb b/spec/integration/comment/association/card_spec.rb new file mode 100644 index 00000000..44bdd037 --- /dev/null +++ b/spec/integration/comment/association/card_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +RSpec.describe 'Trello::Comment#card' do + include IntegrationHelpers + + before { setup_trello } + + it "can get the comment's card" do + VCR.use_cassette('can_get_comments_card') do + comment = Trello::Comment.new(id: "61faa73dd180eb86947af0fd") + + card = comment.card + expect(card.id).not_to be_nil + end + end + +end diff --git a/spec/integration/comment/association/list_spec.rb b/spec/integration/comment/association/list_spec.rb new file mode 100644 index 00000000..edb50420 --- /dev/null +++ b/spec/integration/comment/association/list_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +RSpec.describe 'Trello::Comment#list' do + include IntegrationHelpers + + before { setup_trello } + + it "can get the comment's list" do + VCR.use_cassette('can_get_comments_list') do + comment = Trello::Comment.new(id: "61faa73dd180eb86947af0fd") + + list = comment.list + expect(list.id).not_to be_nil + end + end + +end diff --git a/spec/integration/comment/delete_spec.rb b/spec/integration/comment/delete_spec.rb new file mode 100644 index 00000000..50bb1b32 --- /dev/null +++ b/spec/integration/comment/delete_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +RSpec.describe 'Trello::Comment#delete' do + include IntegrationHelpers + + before { setup_trello } + + it 'can successfully delete a comment' do + VCR.use_cassette('comment_delete') do + comment = Trello::Comment.find('61faa73dd180eb86947af0fd') + expect(comment.id).to eq('61faa73dd180eb86947af0fd') + + comment.delete + expect { + Trello::Comment.find('61faa73dd180eb86947af0fd') + }.to raise_error("The requested resource was not found.") + end + end + +end diff --git a/spec/integration/comment/find_spec.rb b/spec/integration/comment/find_spec.rb new file mode 100644 index 00000000..3404009c --- /dev/null +++ b/spec/integration/comment/find_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +RSpec.describe 'Trello::Comment#find' do + include IntegrationHelpers + + before { setup_trello } + + it 'find with id' do + VCR.use_cassette('comment_find_with_id') do + comment = Trello::Comment.find('61faa73dd180eb86947af0fd') + + expect(comment).to be_a(Trello::Comment) + expect(comment.id).to eq('61faa73dd180eb86947af0fd') + end + end + +end