ruby-trello 4.0.0 → 4.2.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/README.md +5 -4
- data/lib/trello/action.rb +8 -8
- data/lib/trello/board.rb +2 -2
- data/lib/trello/card.rb +12 -11
- data/lib/trello/comment.rb +6 -6
- data/lib/trello/net/faraday.rb +31 -0
- data/lib/trello/net/rest_client.rb +4 -0
- data/lib/trello/net.rb +4 -0
- data/lib/trello/notification.rb +10 -10
- data/lib/trello/organization.rb +2 -2
- data/spec/action_spec.rb +4 -4
- data/spec/association_spec.rb +1 -1
- data/spec/board_spec.rb +1 -1
- data/spec/card_spec.rb +6 -6
- data/spec/cassettes/can_add_a_file_on_a_card_with_farady.yml +244 -0
- data/spec/cassettes/can_get_boards_of_organization.yml +105 -84
- data/spec/cassettes/can_get_boards_with_filter_of_organization.yml +222 -0
- data/spec/integration/card/add_and_remove_attachment_spec.rb +2 -1
- data/spec/integration/organization/associations/boards_spec.rb +22 -0
- data/spec/notification_spec.rb +5 -5
- metadata +40 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33fd510f3a84ba004edaa9f4ccec95bb616af0d8658be375ba079916bfa8795d
|
4
|
+
data.tar.gz: 7cfeadb04a8a97351b83d5c8b8dc316a2b8f868e54b827993a49b4668031d8ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ed9410f4f6d834e87f3cb26f0e50eadcf8746224775605877e8c981c0848643cf25eefe4bace7fa76a54bf046282f5f68b3252ece365db6113b93375433191
|
7
|
+
data.tar.gz: 0bbf70b993c9a15b046b4cfcc028d90b04f98a78994017f4257404ec43fc5b6c1fe0e37ade3d189801672c9a5b9a7915f62d5e2430e8948a6a399c427111c50d
|
data/README.md
CHANGED
@@ -15,11 +15,12 @@ to, please just [create an issue](https://github.com/jeremytregunna/ruby-trello/
|
|
15
15
|
|
16
16
|
## Requirements
|
17
17
|
|
18
|
-
| Ruby \ ActiveModel | 6.0 | 6.1 | 7.0 |
|
18
|
+
| Ruby \ ActiveModel | 6.0 | 6.1 | 7.0 | 7.1 |
|
19
19
|
| ---- | ---- | ---- | ---- |
|
20
|
-
| 2.7 | ✅ | ✅ | ✅ |
|
21
|
-
| 3.0 | ✅ | ✅ | ✅ |
|
22
|
-
| 3.1 | ✅ | ✅ | ✅ |
|
20
|
+
| 2.7 | ✅ | ✅ | ✅ | ✅ |
|
21
|
+
| 3.0 | ✅ | ✅ | ✅ | ✅ |
|
22
|
+
| 3.1 | ✅ | ✅ | ✅ | ✅ |
|
23
|
+
| 3.2 | ✅ | ✅ | ✅ | ✅ |
|
23
24
|
|
24
25
|
- Use the newest version for Ruby 2.7.0 or newer support.
|
25
26
|
- Use version 3.2.0 or earlier for Ruby 2.5 ~ 2.6 support.
|
data/lib/trello/action.rb
CHANGED
@@ -54,23 +54,23 @@ module Trello
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# Returns the board this action occurred on.
|
57
|
-
def board
|
58
|
-
Board.from_response client.get("/actions/#{id}/board")
|
57
|
+
def board(params = {})
|
58
|
+
Board.from_response client.get("/actions/#{id}/board", params)
|
59
59
|
end
|
60
60
|
|
61
61
|
# Returns the card the action occurred on.
|
62
|
-
def card
|
63
|
-
Card.from_response client.get("/actions/#{id}/card")
|
62
|
+
def card(params = {})
|
63
|
+
Card.from_response client.get("/actions/#{id}/card", params)
|
64
64
|
end
|
65
65
|
|
66
66
|
# Returns the list the action occurred on.
|
67
|
-
def list
|
68
|
-
List.from_response client.get("/actions/#{id}/list")
|
67
|
+
def list(params = {})
|
68
|
+
List.from_response client.get("/actions/#{id}/list", params)
|
69
69
|
end
|
70
70
|
|
71
71
|
# Returns the list the action occurred on.
|
72
|
-
def member_creator
|
73
|
-
Member.from_response client.get("/actions/#{id}/memberCreator")
|
72
|
+
def member_creator(params = {})
|
73
|
+
Member.from_response client.get("/actions/#{id}/memberCreator", params)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
data/lib/trello/board.rb
CHANGED
@@ -106,8 +106,8 @@ module Trello
|
|
106
106
|
|
107
107
|
class << self
|
108
108
|
# @return [Array<Trello::Board>] all boards for the current user
|
109
|
-
def all
|
110
|
-
from_response client.get("/members/#{Member.find(:me).username}/boards")
|
109
|
+
def all(params = {})
|
110
|
+
from_response client.get("/members/#{Member.find(:me).username}/boards", params)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
data/lib/trello/card.rb
CHANGED
@@ -105,8 +105,8 @@ module Trello
|
|
105
105
|
# List of custom field values on the card, only the ones that have been set
|
106
106
|
many :custom_field_items, path: 'customFieldItems'
|
107
107
|
|
108
|
-
def check_item_states
|
109
|
-
states = CheckItemState.from_response client.get("/cards/#{self.id}/checkItemStates")
|
108
|
+
def check_item_states(params = {})
|
109
|
+
states = CheckItemState.from_response client.get("/cards/#{self.id}/checkItemStates", params)
|
110
110
|
MultiAssociation.new(self, states).proxy
|
111
111
|
end
|
112
112
|
|
@@ -116,8 +116,8 @@ module Trello
|
|
116
116
|
# Returns a list of members who are assigned to this card.
|
117
117
|
#
|
118
118
|
# @return [Array<Trello::Member>]
|
119
|
-
def members
|
120
|
-
members = Member.from_response client.get("/cards/#{self.id}/members")
|
119
|
+
def members(params = {})
|
120
|
+
members = Member.from_response client.get("/cards/#{self.id}/members", params)
|
121
121
|
MultiAssociation.new(self, members).proxy
|
122
122
|
end
|
123
123
|
|
@@ -127,8 +127,8 @@ module Trello
|
|
127
127
|
# accuracy over network performance
|
128
128
|
#
|
129
129
|
# @return [Array<Trello::Member>]
|
130
|
-
def voters
|
131
|
-
Member.from_response client.get("/cards/#{id}/membersVoted")
|
130
|
+
def voters(params = {})
|
131
|
+
Member.from_response client.get("/cards/#{id}/membersVoted", params)
|
132
132
|
end
|
133
133
|
|
134
134
|
# Delete this card
|
@@ -273,7 +273,7 @@ module Trello
|
|
273
273
|
# Is it a file object or a string (url)?
|
274
274
|
if attachment.respond_to?(:path) && attachment.respond_to?(:read)
|
275
275
|
client.post("/cards/#{id}/attachments", {
|
276
|
-
file: attachment,
|
276
|
+
file: Trello::TInternet.multipart_file(attachment),
|
277
277
|
name: name
|
278
278
|
})
|
279
279
|
else
|
@@ -285,8 +285,8 @@ module Trello
|
|
285
285
|
end
|
286
286
|
|
287
287
|
# Retrieve a list of attachments
|
288
|
-
def attachments
|
289
|
-
attachments = Attachment.from_response client.get("/cards/#{id}/attachments")
|
288
|
+
def attachments(params = {})
|
289
|
+
attachments = Attachment.from_response client.get("/cards/#{id}/attachments", params)
|
290
290
|
MultiAssociation.new(self, attachments).proxy
|
291
291
|
end
|
292
292
|
|
@@ -301,8 +301,9 @@ module Trello
|
|
301
301
|
end
|
302
302
|
|
303
303
|
# Retrieve a list of comments
|
304
|
-
def comments
|
305
|
-
|
304
|
+
def comments(params = {})
|
305
|
+
params[:filter] ||= "commentCard"
|
306
|
+
comments = Comment.from_response client.get("/cards/#{id}/actions", params)
|
306
307
|
end
|
307
308
|
|
308
309
|
# Find the creation date
|
data/lib/trello/comment.rb
CHANGED
@@ -49,18 +49,18 @@ module Trello
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# Returns the board this comment is located
|
52
|
-
def board
|
53
|
-
Board.from_response client.get("/actions/#{id}/board")
|
52
|
+
def board(params = {})
|
53
|
+
Board.from_response client.get("/actions/#{id}/board", params)
|
54
54
|
end
|
55
55
|
|
56
56
|
# Returns the card the comment is located
|
57
|
-
def card
|
58
|
-
Card.from_response client.get("/actions/#{id}/card")
|
57
|
+
def card(params = {})
|
58
|
+
Card.from_response client.get("/actions/#{id}/card", params)
|
59
59
|
end
|
60
60
|
|
61
61
|
# Returns the list the comment is located
|
62
|
-
def list
|
63
|
-
List.from_response client.get("/actions/#{id}/list")
|
62
|
+
def list(params = {})
|
63
|
+
List.from_response client.get("/actions/#{id}/list", params)
|
64
64
|
end
|
65
65
|
|
66
66
|
# Deletes the comment from the card
|
data/lib/trello/net/faraday.rb
CHANGED
@@ -4,6 +4,8 @@ module Trello
|
|
4
4
|
class << self
|
5
5
|
begin
|
6
6
|
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'mime/types'
|
7
9
|
rescue LoadError
|
8
10
|
end
|
9
11
|
|
@@ -11,6 +13,14 @@ module Trello
|
|
11
13
|
try_execute request
|
12
14
|
end
|
13
15
|
|
16
|
+
def multipart_file(file)
|
17
|
+
Faraday::Multipart::FilePart.new(
|
18
|
+
file,
|
19
|
+
content_type(file),
|
20
|
+
filename(file)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
14
24
|
private
|
15
25
|
|
16
26
|
def try_execute(request)
|
@@ -33,6 +43,7 @@ module Trello
|
|
33
43
|
request: { timeout: 10 }
|
34
44
|
) do |faraday|
|
35
45
|
faraday.response :raise_error
|
46
|
+
faraday.request :multipart
|
36
47
|
faraday.request :json
|
37
48
|
end
|
38
49
|
|
@@ -40,6 +51,26 @@ module Trello
|
|
40
51
|
req.body = request.body
|
41
52
|
end
|
42
53
|
end
|
54
|
+
|
55
|
+
def content_type(file)
|
56
|
+
return file.content_type if file.respond_to?(:content_type)
|
57
|
+
|
58
|
+
mime = MIME::Types.type_for file.path
|
59
|
+
if mime.empty?
|
60
|
+
'text/plain'
|
61
|
+
else
|
62
|
+
mime[0].content_type
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def filename(file)
|
67
|
+
if file.respond_to?(:original_filename)
|
68
|
+
file.original_filename
|
69
|
+
else
|
70
|
+
File.basename(file.path)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
43
74
|
end
|
44
75
|
end
|
45
76
|
end
|
data/lib/trello/net.rb
CHANGED
data/lib/trello/notification.rb
CHANGED
@@ -45,24 +45,24 @@ module Trello
|
|
45
45
|
|
46
46
|
one :creator, path: :members, via: Member, using: :creator_id
|
47
47
|
|
48
|
-
def board
|
49
|
-
Board.from_response client.get("/notifications/#{id}/board")
|
48
|
+
def board(params = {})
|
49
|
+
Board.from_response client.get("/notifications/#{id}/board", params)
|
50
50
|
end
|
51
51
|
|
52
|
-
def list
|
53
|
-
List.from_response client.get("/notifications/#{id}/list")
|
52
|
+
def list(params = {})
|
53
|
+
List.from_response client.get("/notifications/#{id}/list", params)
|
54
54
|
end
|
55
55
|
|
56
|
-
def card
|
57
|
-
Card.from_response client.get("/notifications/#{id}/card")
|
56
|
+
def card(params = {})
|
57
|
+
Card.from_response client.get("/notifications/#{id}/card", params)
|
58
58
|
end
|
59
59
|
|
60
|
-
def member
|
61
|
-
Member.from_response client.get("/notifications/#{id}/member")
|
60
|
+
def member(params = {})
|
61
|
+
Member.from_response client.get("/notifications/#{id}/member", params)
|
62
62
|
end
|
63
63
|
|
64
|
-
def organization
|
65
|
-
Organization.from_response client.get("/notifications/#{id}/organization")
|
64
|
+
def organization(params = {})
|
65
|
+
Organization.from_response client.get("/notifications/#{id}/organization", params)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
data/lib/trello/organization.rb
CHANGED
@@ -77,8 +77,8 @@ module Trello
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# Returns a list of boards under this organization.
|
80
|
-
def boards
|
81
|
-
boards = Board.from_response client.get("/organizations/#{id}/boards
|
80
|
+
def boards(params = {})
|
81
|
+
boards = Board.from_response client.get("/organizations/#{id}/boards", params)
|
82
82
|
MultiAssociation.new(self, boards).proxy
|
83
83
|
end
|
84
84
|
|
data/spec/action_spec.rb
CHANGED
@@ -71,7 +71,7 @@ module Trello
|
|
71
71
|
before do
|
72
72
|
allow(client)
|
73
73
|
.to receive(:get)
|
74
|
-
.with('/actions/4ee2482134a81a757a08af47/board')
|
74
|
+
.with('/actions/4ee2482134a81a757a08af47/board', {})
|
75
75
|
.and_return payload
|
76
76
|
end
|
77
77
|
|
@@ -87,7 +87,7 @@ module Trello
|
|
87
87
|
before do
|
88
88
|
allow(client)
|
89
89
|
.to receive(:get)
|
90
|
-
.with('/actions/4ee2482134a81a757a08af47/card')
|
90
|
+
.with('/actions/4ee2482134a81a757a08af47/card', {})
|
91
91
|
.and_return payload
|
92
92
|
end
|
93
93
|
|
@@ -102,7 +102,7 @@ module Trello
|
|
102
102
|
before do
|
103
103
|
allow(client)
|
104
104
|
.to receive(:get)
|
105
|
-
.with('/actions/4ee2482134a81a757a08af47/list')
|
105
|
+
.with('/actions/4ee2482134a81a757a08af47/list', {})
|
106
106
|
.and_return payload
|
107
107
|
end
|
108
108
|
|
@@ -116,7 +116,7 @@ module Trello
|
|
116
116
|
before do
|
117
117
|
allow(client)
|
118
118
|
.to receive(:get)
|
119
|
-
.with('/actions/4ee2482134a81a757a08af47/memberCreator')
|
119
|
+
.with('/actions/4ee2482134a81a757a08af47/memberCreator', {})
|
120
120
|
.and_return user_payload
|
121
121
|
end
|
122
122
|
|
data/spec/association_spec.rb
CHANGED
data/spec/board_spec.rb
CHANGED
data/spec/card_spec.rb
CHANGED
@@ -511,7 +511,7 @@ module Trello
|
|
511
511
|
|
512
512
|
allow(client)
|
513
513
|
.to receive(:get)
|
514
|
-
.with("/cards/abcdef123456789123456789/members")
|
514
|
+
.with("/cards/abcdef123456789123456789/members", {})
|
515
515
|
.and_return user_payload
|
516
516
|
end
|
517
517
|
|
@@ -597,7 +597,7 @@ module Trello
|
|
597
597
|
no_voters = JSON.generate([])
|
598
598
|
expect(client)
|
599
599
|
.to receive(:get)
|
600
|
-
.with("/cards/#{card.id}/membersVoted")
|
600
|
+
.with("/cards/#{card.id}/membersVoted", {})
|
601
601
|
.and_return(no_voters)
|
602
602
|
|
603
603
|
card.voters
|
@@ -606,7 +606,7 @@ module Trello
|
|
606
606
|
voters = JSON.generate([user_details])
|
607
607
|
expect(client)
|
608
608
|
.to receive(:get)
|
609
|
-
.with("/cards/#{card.id}/membersVoted")
|
609
|
+
.with("/cards/#{card.id}/membersVoted", {})
|
610
610
|
.and_return(voters)
|
611
611
|
|
612
612
|
expect(card.voters.first).to be_kind_of Trello::Member
|
@@ -734,7 +734,7 @@ module Trello
|
|
734
734
|
|
735
735
|
allow(client)
|
736
736
|
.to receive(:post)
|
737
|
-
.with("/cards/abcdef123456789123456789/attachments", { file:
|
737
|
+
.with("/cards/abcdef123456789123456789/attachments", { file: instance_of(Multipart::Post::UploadIO), name: '' })
|
738
738
|
.and_return "not important"
|
739
739
|
|
740
740
|
card.add_attachment(f)
|
@@ -750,7 +750,7 @@ module Trello
|
|
750
750
|
|
751
751
|
allow(client)
|
752
752
|
.to receive(:get)
|
753
|
-
.with("/cards/abcdef123456789123456789/attachments")
|
753
|
+
.with("/cards/abcdef123456789123456789/attachments", {})
|
754
754
|
.and_return attachments_payload
|
755
755
|
|
756
756
|
expect(card.board).to_not be_nil
|
@@ -779,7 +779,7 @@ module Trello
|
|
779
779
|
|
780
780
|
allow(client)
|
781
781
|
.to receive(:get)
|
782
|
-
.with("/cards/abcdef123456789123456789/attachments")
|
782
|
+
.with("/cards/abcdef123456789123456789/attachments", {})
|
783
783
|
.and_return attachments_payload
|
784
784
|
|
785
785
|
card.remove_attachment(card.attachments.first)
|
@@ -0,0 +1,244 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.trello.com/1/cards/5e95d1b4f43f9a06497f17f7?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v2.3.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 11 Nov 2023 18:18:11 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Content-Length:
|
26
|
+
- '1053'
|
27
|
+
X-Dns-Prefetch-Control:
|
28
|
+
- 'off'
|
29
|
+
Expect-Ct:
|
30
|
+
- max-age=0
|
31
|
+
X-Frame-Options:
|
32
|
+
- DENY
|
33
|
+
X-Download-Options:
|
34
|
+
- noopen
|
35
|
+
X-Permitted-Cross-Domain-Policies:
|
36
|
+
- none
|
37
|
+
Referrer-Policy:
|
38
|
+
- strict-origin-when-cross-origin
|
39
|
+
Surrogate-Control:
|
40
|
+
- no-store
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, must-revalidate, no-cache, no-store
|
43
|
+
Pragma:
|
44
|
+
- no-cache
|
45
|
+
Expires:
|
46
|
+
- Thu, 01 Jan 1970 00:00:00
|
47
|
+
X-Trello-Version:
|
48
|
+
- 1.242759.0
|
49
|
+
X-Trello-Environment:
|
50
|
+
- Production
|
51
|
+
Set-Cookie:
|
52
|
+
- dsc=set_cookie_dsc; Path=/; Expires=Sat, 25 Nov 2023 18:18:11 GMT; Secure;
|
53
|
+
SameSite=None
|
54
|
+
- preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.Pfv1AFghhSOM0MLjFpWB8CaOPcNRIjt%2FmCZysEK4KNY;
|
55
|
+
Path=/; HttpOnly
|
56
|
+
Access-Control-Allow-Origin:
|
57
|
+
- "*"
|
58
|
+
Access-Control-Allow-Methods:
|
59
|
+
- GET, PUT, POST, DELETE
|
60
|
+
Access-Control-Allow-Headers:
|
61
|
+
- Authorization, Accept, Content-Type
|
62
|
+
Access-Control-Expose-Headers:
|
63
|
+
- x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining,
|
64
|
+
x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining
|
65
|
+
X-Rate-Limit-Api-Token-Interval-Ms:
|
66
|
+
- '10000'
|
67
|
+
X-Rate-Limit-Api-Token-Max:
|
68
|
+
- '100'
|
69
|
+
X-Rate-Limit-Api-Token-Remaining:
|
70
|
+
- '99'
|
71
|
+
X-Rate-Limit-Db-Query-Time-Interval-Ms:
|
72
|
+
- '600000'
|
73
|
+
X-Rate-Limit-Db-Query-Time-Max:
|
74
|
+
- '7200000'
|
75
|
+
X-Rate-Limit-Db-Query-Time-Remaining:
|
76
|
+
- '7199990'
|
77
|
+
X-Rate-Limit-Api-Key-Interval-Ms:
|
78
|
+
- '10000'
|
79
|
+
X-Rate-Limit-Api-Key-Max:
|
80
|
+
- '300'
|
81
|
+
X-Rate-Limit-Api-Key-Remaining:
|
82
|
+
- '299'
|
83
|
+
X-Rate-Limit-Member-Interval-Ms:
|
84
|
+
- '10000'
|
85
|
+
X-Rate-Limit-Member-Max:
|
86
|
+
- '375'
|
87
|
+
X-Rate-Limit-Member-Remaining:
|
88
|
+
- '374'
|
89
|
+
X-Server-Time:
|
90
|
+
- '1699726691750'
|
91
|
+
Server:
|
92
|
+
- AtlassianEdge
|
93
|
+
X-Content-Type-Options:
|
94
|
+
- nosniff
|
95
|
+
X-Xss-Protection:
|
96
|
+
- 1; mode=block
|
97
|
+
Atl-Traceid:
|
98
|
+
- 5442e51c04ce42f5aa01bfb53445cc31
|
99
|
+
Report-To:
|
100
|
+
- '{"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group":
|
101
|
+
"endpoint-1", "include_subdomains": true, "max_age": 600}'
|
102
|
+
Nel:
|
103
|
+
- '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to":
|
104
|
+
"endpoint-1"}'
|
105
|
+
Strict-Transport-Security:
|
106
|
+
- max-age=63072000; preload
|
107
|
+
body:
|
108
|
+
encoding: UTF-8
|
109
|
+
string: '{"id":"5e95d1b4f43f9a06497f17f7","badges":{"attachmentsByType":{"trello":{"board":0,"card":0}},"location":false,"votes":0,"viewingMemberVoted":false,"subscribed":false,"start":null,"fogbugz":"","checkItems":0,"checkItemsChecked":0,"checkItemsEarliestDue":null,"comments":0,"attachments":3,"description":false,"due":null,"dueComplete":false},"checkItemStates":[],"closed":false,"dueComplete":false,"dateLastActivity":"2023-11-11T18:14:08.574Z","desc":"","descData":null,"due":null,"dueReminder":null,"email":null,"idBoard":"5e94f5ded016b22c2437c13c","idChecklists":[],"idList":"5e95d1b07f2ff83927319128","idMembers":[],"idMembersVoted":[],"idShort":2,"idAttachmentCover":"","labels":[],"idLabels":[],"manualCoverAttachment":false,"name":"C2","pos":16384,"shortLink":"DeJYDbq0","shortUrl":"https://trello.com/c/DeJYDbq0","start":null,"subscribed":false,"url":"https://trello.com/c/DeJYDbq0/2-c2","cover":{"idAttachment":null,"color":null,"idUploadedBackground":null,"size":"normal","brightness":"light","idPlugin":null},"isTemplate":false,"cardRole":null}'
|
110
|
+
recorded_at: Sat, 11 Nov 2023 18:18:11 GMT
|
111
|
+
- request:
|
112
|
+
method: post
|
113
|
+
uri: https://api.trello.com/1/cards/5e95d1b4f43f9a06497f17f7/attachments?key=DEVELOPER_PUBLIC_KEY&token=MEMBER_TOKEN
|
114
|
+
body:
|
115
|
+
encoding: UTF-8
|
116
|
+
string: "-------------RubyMultipartPost-045b3ab4e226f744d8d7119fa63ad0fb\r\nContent-Disposition:
|
117
|
+
form-data; name=\"file\"; filename=\"add_and_remove_attachment_spec.rb\"\r\nContent-Length:
|
118
|
+
1672\r\nContent-Type: application/x-ruby\r\nContent-Transfer-Encoding: binary\r\n\r\nrequire
|
119
|
+
'spec_helper'\n\nRSpec.describe 'Trell::Card add and remove attachment' do\n
|
120
|
+
\ include IntegrationHelpers\n\n before { setup_trello }\n\n describe '#add_attachment'
|
121
|
+
do\n it 'can success add an attachment(file) on a card', focus: true do\n
|
122
|
+
\ cassette_name = Trello.http_client == \"rest-client\" ? \"can_add_a_file_on_a_card\"
|
123
|
+
: \"can_add_a_file_on_a_card_with_farady\"\n VCR.use_cassette(cassette_name)
|
124
|
+
do\n card = Trello::Card.find('5e95d1b4f43f9a06497f17f7')\n file
|
125
|
+
= File.new('spec/integration/card/add_and_remove_attachment_spec.rb', 'r')\n\n
|
126
|
+
\ response = card.add_attachment(file)\n expect(response.code).to
|
127
|
+
eq(200)\n body = JSON.parse(response.body)\n expect(body['name']).to
|
128
|
+
eq('add_and_remove_attachment_spec.rb')\n end\n end\n\n it 'can
|
129
|
+
success add and attachment(url) on a card' do\n VCR.use_cassette('can_add_a_file_from_url_on_a_card')
|
130
|
+
do\n card = Trello::Card.find('5e95d1b4f43f9a06497f17f7')\n file_url
|
131
|
+
= 'https://upload.wikimedia.org/wikipedia/en/6/6b/Hello_Web_Series_%28Wordmark%29_Logo.png'\n\n
|
132
|
+
\ response = card.add_attachment(file_url, 'hello.png')\n expect(response.code).to
|
133
|
+
eq(200)\n body = JSON.parse(response.body)\n expect(body['name']).to
|
134
|
+
eq('hello.png')\n end\n end\n end\n\n describe '#remove_attachment'
|
135
|
+
do\n it 'can success remove and attachment on a card' do\n VCR.use_cassette('can_remove_an_attachment_on_a_card')
|
136
|
+
do\n card = Trello::Card.find('5e95d1b4f43f9a06497f17f7')\n attachments
|
137
|
+
= card.attachments\n\n response = card.remove_attachment(attachments.last)\n
|
138
|
+
\ expect(response.code).to eq(200)\n end\n end\n end\nend\n\r\n-------------RubyMultipartPost-045b3ab4e226f744d8d7119fa63ad0fb\r\nContent-Disposition:
|
139
|
+
form-data; name=\"name\"\r\n\r\n\r\n-------------RubyMultipartPost-045b3ab4e226f744d8d7119fa63ad0fb--\r\n"
|
140
|
+
headers:
|
141
|
+
User-Agent:
|
142
|
+
- Faraday v2.3.0
|
143
|
+
Content-Type:
|
144
|
+
- multipart/form-data; boundary=-----------RubyMultipartPost-045b3ab4e226f744d8d7119fa63ad0fb
|
145
|
+
Content-Length:
|
146
|
+
- '2104'
|
147
|
+
Accept-Encoding:
|
148
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
149
|
+
Accept:
|
150
|
+
- "*/*"
|
151
|
+
response:
|
152
|
+
status:
|
153
|
+
code: 200
|
154
|
+
message: OK
|
155
|
+
headers:
|
156
|
+
Date:
|
157
|
+
- Sat, 11 Nov 2023 18:18:14 GMT
|
158
|
+
Content-Type:
|
159
|
+
- application/json; charset=utf-8
|
160
|
+
Content-Length:
|
161
|
+
- '451'
|
162
|
+
X-Dns-Prefetch-Control:
|
163
|
+
- 'off'
|
164
|
+
Expect-Ct:
|
165
|
+
- max-age=0
|
166
|
+
X-Frame-Options:
|
167
|
+
- DENY
|
168
|
+
X-Download-Options:
|
169
|
+
- noopen
|
170
|
+
X-Permitted-Cross-Domain-Policies:
|
171
|
+
- none
|
172
|
+
Referrer-Policy:
|
173
|
+
- strict-origin-when-cross-origin
|
174
|
+
Surrogate-Control:
|
175
|
+
- no-store
|
176
|
+
Cache-Control:
|
177
|
+
- max-age=0, must-revalidate, no-cache, no-store
|
178
|
+
Pragma:
|
179
|
+
- no-cache
|
180
|
+
Expires:
|
181
|
+
- Thu, 01 Jan 1970 00:00:00
|
182
|
+
X-Trello-Version:
|
183
|
+
- 1.242759.0
|
184
|
+
X-Trello-Environment:
|
185
|
+
- Production
|
186
|
+
Access-Control-Allow-Origin:
|
187
|
+
- "*"
|
188
|
+
Access-Control-Allow-Methods:
|
189
|
+
- GET, PUT, POST, DELETE
|
190
|
+
Access-Control-Allow-Headers:
|
191
|
+
- Authorization, Accept, Content-Type
|
192
|
+
Access-Control-Expose-Headers:
|
193
|
+
- x-rate-limit-api-key-interval-ms, x-rate-limit-api-key-max, x-rate-limit-api-key-remaining,
|
194
|
+
x-rate-limit-api-token-interval-ms, x-rate-limit-api-token-max, x-rate-limit-api-token-remaining
|
195
|
+
X-Rate-Limit-Api-Token-Interval-Ms:
|
196
|
+
- '10000'
|
197
|
+
X-Rate-Limit-Api-Token-Max:
|
198
|
+
- '100'
|
199
|
+
X-Rate-Limit-Api-Token-Remaining:
|
200
|
+
- '98'
|
201
|
+
X-Rate-Limit-Db-Query-Time-Interval-Ms:
|
202
|
+
- '600000'
|
203
|
+
X-Rate-Limit-Db-Query-Time-Max:
|
204
|
+
- '7200000'
|
205
|
+
X-Rate-Limit-Db-Query-Time-Remaining:
|
206
|
+
- '7199990'
|
207
|
+
X-Rate-Limit-Api-Key-Interval-Ms:
|
208
|
+
- '10000'
|
209
|
+
X-Rate-Limit-Api-Key-Max:
|
210
|
+
- '300'
|
211
|
+
X-Rate-Limit-Api-Key-Remaining:
|
212
|
+
- '298'
|
213
|
+
X-Rate-Limit-Member-Interval-Ms:
|
214
|
+
- '10000'
|
215
|
+
X-Rate-Limit-Member-Max:
|
216
|
+
- '375'
|
217
|
+
X-Rate-Limit-Member-Remaining:
|
218
|
+
- '373'
|
219
|
+
Set-Cookie:
|
220
|
+
- preAuthProps=s%3A5e679b808e6e8828784b30e1%3AisEnterpriseAdmin%3Dfalse.Pfv1AFghhSOM0MLjFpWB8CaOPcNRIjt%2FmCZysEK4KNY;
|
221
|
+
Path=/; HttpOnly
|
222
|
+
X-Server-Time:
|
223
|
+
- '1699726694377'
|
224
|
+
Server:
|
225
|
+
- AtlassianEdge
|
226
|
+
X-Content-Type-Options:
|
227
|
+
- nosniff
|
228
|
+
X-Xss-Protection:
|
229
|
+
- 1; mode=block
|
230
|
+
Atl-Traceid:
|
231
|
+
- c52c43e2b82d4915bb527fc58f3153bc
|
232
|
+
Report-To:
|
233
|
+
- '{"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group":
|
234
|
+
"endpoint-1", "include_subdomains": true, "max_age": 600}'
|
235
|
+
Nel:
|
236
|
+
- '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to":
|
237
|
+
"endpoint-1"}'
|
238
|
+
Strict-Transport-Security:
|
239
|
+
- max-age=63072000; preload
|
240
|
+
body:
|
241
|
+
encoding: UTF-8
|
242
|
+
string: '{"id":"654fc566366a6de141e759d8","bytes":1672,"date":"2023-11-11T18:18:14.070Z","edgeColor":null,"idMember":"5e679b808e6e8828784b30e1","isUpload":true,"mimeType":"application/x-ruby","name":"add_and_remove_attachment_spec.rb","previews":[],"url":"https://trello.com/1/cards/5e95d1b4f43f9a06497f17f7/attachments/654fc566366a6de141e759d8/download/add_and_remove_attachment_spec.rb","pos":81920,"fileName":"add_and_remove_attachment_spec.rb","limits":{}}'
|
243
|
+
recorded_at: Sat, 11 Nov 2023 18:18:14 GMT
|
244
|
+
recorded_with: VCR 6.1.0
|