ruby-trello-czuger 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +182 -0
- data/lib/trello.rb +163 -0
- data/lib/trello/action.rb +68 -0
- data/lib/trello/association.rb +14 -0
- data/lib/trello/association_proxy.rb +42 -0
- data/lib/trello/attachment.rb +40 -0
- data/lib/trello/authorization.rb +187 -0
- data/lib/trello/basic_data.rb +132 -0
- data/lib/trello/board.rb +211 -0
- data/lib/trello/card.rb +467 -0
- data/lib/trello/checklist.rb +143 -0
- data/lib/trello/client.rb +120 -0
- data/lib/trello/comment.rb +62 -0
- data/lib/trello/configuration.rb +68 -0
- data/lib/trello/core_ext/array.rb +6 -0
- data/lib/trello/core_ext/hash.rb +6 -0
- data/lib/trello/core_ext/string.rb +6 -0
- data/lib/trello/cover_image.rb +8 -0
- data/lib/trello/has_actions.rb +9 -0
- data/lib/trello/item.rb +37 -0
- data/lib/trello/item_state.rb +30 -0
- data/lib/trello/json_utils.rb +64 -0
- data/lib/trello/label.rb +108 -0
- data/lib/trello/label_name.rb +31 -0
- data/lib/trello/list.rb +114 -0
- data/lib/trello/member.rb +112 -0
- data/lib/trello/multi_association.rb +12 -0
- data/lib/trello/net.rb +39 -0
- data/lib/trello/notification.rb +61 -0
- data/lib/trello/organization.rb +68 -0
- data/lib/trello/plugin_datum.rb +34 -0
- data/lib/trello/token.rb +37 -0
- data/lib/trello/webhook.rb +103 -0
- data/spec/action_spec.rb +149 -0
- data/spec/array_spec.rb +13 -0
- data/spec/association_spec.rb +26 -0
- data/spec/basic_auth_policy_spec.rb +51 -0
- data/spec/board_spec.rb +442 -0
- data/spec/card_spec.rb +822 -0
- data/spec/checklist_spec.rb +296 -0
- data/spec/client_spec.rb +257 -0
- data/spec/configuration_spec.rb +95 -0
- data/spec/hash_spec.rb +15 -0
- data/spec/integration/how_to_authorize_spec.rb +53 -0
- data/spec/integration/how_to_use_boards_spec.rb +48 -0
- data/spec/integration/integration_test.rb +40 -0
- data/spec/item_spec.rb +75 -0
- data/spec/json_utils_spec.rb +73 -0
- data/spec/label_spec.rb +205 -0
- data/spec/list_spec.rb +253 -0
- data/spec/member_spec.rb +159 -0
- data/spec/notification_spec.rb +143 -0
- data/spec/oauth_policy_spec.rb +160 -0
- data/spec/organization_spec.rb +71 -0
- data/spec/spec_helper.rb +435 -0
- data/spec/string_spec.rb +55 -0
- data/spec/token_spec.rb +89 -0
- data/spec/trello_spec.rb +134 -0
- data/spec/webhook_spec.rb +130 -0
- metadata +200 -0
@@ -0,0 +1,160 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Trello
|
4
|
+
include Trello::Authorization
|
5
|
+
|
6
|
+
describe OAuthPolicy do
|
7
|
+
before do
|
8
|
+
OAuthPolicy.consumer_credential = OAuthCredential.new 'xxx', 'xxx'
|
9
|
+
OAuthPolicy.token = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#consumer_credential' do
|
13
|
+
it 'uses class setting if available' do
|
14
|
+
policy = OAuthPolicy.new
|
15
|
+
expect(policy.consumer_credential.key).to eq('xxx')
|
16
|
+
expect(policy.consumer_credential.secret).to eq('xxx')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is built from given consumer_key and consumer_secret' do
|
20
|
+
policy = OAuthPolicy.new(
|
21
|
+
consumer_key: 'consumer_key',
|
22
|
+
consumer_secret: 'consumer_secret'
|
23
|
+
)
|
24
|
+
expect(policy.consumer_credential.key).to eq('consumer_key')
|
25
|
+
expect(policy.consumer_credential.secret).to eq('consumer_secret')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'is nil if none supplied to class' do
|
29
|
+
OAuthPolicy.consumer_credential = nil
|
30
|
+
policy = OAuthPolicy.new
|
31
|
+
expect(policy.consumer_credential).to be_nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#token' do
|
36
|
+
it 'uses class setting if available' do
|
37
|
+
OAuthPolicy.token = OAuthCredential.new 'xxx', 'xxx'
|
38
|
+
policy = OAuthPolicy.new
|
39
|
+
expect(policy.token.key).to eq('xxx')
|
40
|
+
expect(policy.token.secret).to eq('xxx')
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'is built from given oauth_token and oauth_token_secret' do
|
44
|
+
policy = OAuthPolicy.new(
|
45
|
+
oauth_token: 'oauth_token',
|
46
|
+
oauth_token_secret: 'oauth_token_secret'
|
47
|
+
)
|
48
|
+
expect(policy.token.key).to eq('oauth_token')
|
49
|
+
expect(policy.token.secret).to eq('oauth_token_secret')
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'is an empty token if no oauth credentials supplied' do
|
53
|
+
policy = OAuthPolicy.new
|
54
|
+
expect(policy.token).to be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context '2-legged' do
|
59
|
+
it 'adds an authorization header' do
|
60
|
+
uri = Addressable::URI.parse('https://xxx/')
|
61
|
+
|
62
|
+
request = Request.new :get, uri
|
63
|
+
|
64
|
+
OAuthPolicy.token = OAuthCredential.new 'token', nil
|
65
|
+
|
66
|
+
authorized_request = OAuthPolicy.authorize request
|
67
|
+
|
68
|
+
expect(authorized_request.headers.keys).to include 'Authorization'
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'preserves query parameters' do
|
72
|
+
uri = Addressable::URI.parse('https://xxx/?name=Riccardo')
|
73
|
+
request = Request.new :get, uri
|
74
|
+
|
75
|
+
allow(Clock)
|
76
|
+
.to receive(:timestamp)
|
77
|
+
.and_return '1327048592'
|
78
|
+
|
79
|
+
allow(Nonce)
|
80
|
+
.to receive(:next)
|
81
|
+
.and_return 'b94ff2bf7f0a5e87a326064ae1dbb18f'
|
82
|
+
|
83
|
+
OAuthPolicy.consumer_credential = OAuthCredential.new 'consumer_key', 'consumer_secret'
|
84
|
+
OAuthPolicy.token = OAuthCredential.new 'token', nil
|
85
|
+
|
86
|
+
authorized_request = OAuthPolicy.authorize request
|
87
|
+
|
88
|
+
the_query_parameters = Addressable::URI.parse(authorized_request.uri).query_values
|
89
|
+
expect(the_query_parameters).to eq({'name' => 'Riccardo'})
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'adds the correct signature as part of authorization header' do
|
93
|
+
allow(Clock)
|
94
|
+
.to receive(:timestamp)
|
95
|
+
.and_return '1327048592'
|
96
|
+
|
97
|
+
allow(Nonce)
|
98
|
+
.to receive(:next)
|
99
|
+
.and_return 'b94ff2bf7f0a5e87a326064ae1dbb18f'
|
100
|
+
|
101
|
+
OAuthPolicy.consumer_credential = OAuthCredential.new 'consumer_key', 'consumer_secret'
|
102
|
+
OAuthPolicy.token = OAuthCredential.new 'token', nil
|
103
|
+
|
104
|
+
request = Request.new :get, Addressable::URI.parse('http://xxx/')
|
105
|
+
|
106
|
+
authorized_request = OAuthPolicy.authorize request
|
107
|
+
|
108
|
+
expect(authorized_request.headers['Authorization']).to match(/oauth_signature="TVNk%2FCs03FHqutDUqn05%2FDkvVek%3D"/)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'adds correct signature for uri with parameters' do
|
112
|
+
allow(Clock)
|
113
|
+
.to receive(:timestamp)
|
114
|
+
.and_return '1327351010'
|
115
|
+
|
116
|
+
allow(Nonce)
|
117
|
+
.to receive(:next)
|
118
|
+
.and_return 'f5474aaf44ca84df0b09870044f91c69'
|
119
|
+
|
120
|
+
OAuthPolicy.consumer_credential = OAuthCredential.new 'consumer_key', 'consumer_secret'
|
121
|
+
OAuthPolicy.token = OAuthCredential.new 'token', nil
|
122
|
+
|
123
|
+
request = Request.new :get, Addressable::URI.parse('http://xxx/?a=b')
|
124
|
+
|
125
|
+
authorized_request = OAuthPolicy.authorize request
|
126
|
+
|
127
|
+
expect(authorized_request.headers['Authorization']).to match(/oauth_signature="DprU1bdbNdJQ40UhD4n7wRR9jts%3D"/)
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'fails if consumer_credential is unset' do
|
131
|
+
OAuthPolicy.consumer_credential = nil
|
132
|
+
|
133
|
+
request = Request.new :get, Addressable::URI.parse('http://xxx/')
|
134
|
+
|
135
|
+
expect { OAuthPolicy.authorize request }.to raise_error 'The consumer_credential has not been supplied.'
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'can sign with token' do
|
139
|
+
allow(Clock)
|
140
|
+
.to receive(:timestamp)
|
141
|
+
.and_return '1327360530'
|
142
|
+
|
143
|
+
allow(Nonce)
|
144
|
+
.to receive(:next)
|
145
|
+
.and_return '4f610cb28e7aa8711558de5234af1f0e'
|
146
|
+
|
147
|
+
OAuthPolicy.consumer_credential = OAuthCredential.new 'consumer_key', 'consumer_secret'
|
148
|
+
OAuthPolicy.token = OAuthCredential.new 'token_key', 'token_secret'
|
149
|
+
|
150
|
+
request = Request.new :get, Addressable::URI.parse('http://xxx/')
|
151
|
+
|
152
|
+
authorized_request = OAuthPolicy.authorize request
|
153
|
+
|
154
|
+
expect(authorized_request.headers['Authorization']).to match(/oauth_signature="1Boj4fo6KiXA4xGD%2BKF5QOD36PI%3D"/)
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'adds correct signature for https uri'
|
158
|
+
it 'adds correct signature for verbs other than get'
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Trello
|
4
|
+
describe Organization do
|
5
|
+
include Helpers
|
6
|
+
|
7
|
+
let(:organization) { client.find(:organization, '4ee7e59ae582acdec8000291') }
|
8
|
+
let(:client) { Client.new }
|
9
|
+
|
10
|
+
before do
|
11
|
+
allow(client)
|
12
|
+
.to receive(:get)
|
13
|
+
.with('/organizations/4ee7e59ae582acdec8000291', {})
|
14
|
+
.and_return organization_payload
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'finding' do
|
18
|
+
let(:client) { Trello.client }
|
19
|
+
|
20
|
+
it 'delegates to Trello.client#find' do
|
21
|
+
expect(client)
|
22
|
+
.to receive(:find)
|
23
|
+
.with(:organization, '4ee7e59ae582acdec8000291', {})
|
24
|
+
|
25
|
+
Organization.find('4ee7e59ae582acdec8000291')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'is equivalent to client#find' do
|
29
|
+
expect(Organization.find('4ee7e59ae582acdec8000291')).to eq(organization)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'actions' do
|
34
|
+
it 'retrieves actions' do
|
35
|
+
allow(client)
|
36
|
+
.to receive(:get)
|
37
|
+
.with('/organizations/4ee7e59ae582acdec8000291/actions', { filter: :all })
|
38
|
+
.and_return actions_payload
|
39
|
+
|
40
|
+
expect(organization.actions.count).to be > 0
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#update_fields" do
|
45
|
+
it "does not set any fields when the fields argument is empty" do
|
46
|
+
expected = {
|
47
|
+
'id' => 'id',
|
48
|
+
'name' => 'name',
|
49
|
+
'displayName' => 'display_name',
|
50
|
+
'desc' => 'description',
|
51
|
+
'url' => 'url',
|
52
|
+
'invited' => 'invited',
|
53
|
+
'website' => 'website',
|
54
|
+
'logoHash' => 'logo_hash',
|
55
|
+
'billableMemberCount' => 'billable_member_count',
|
56
|
+
'activeBillableMemberCount' => 'active_billable_member_count',
|
57
|
+
'memberships' => 'memberships'
|
58
|
+
}
|
59
|
+
|
60
|
+
organization = Organization.new(expected)
|
61
|
+
|
62
|
+
organization.update_fields({})
|
63
|
+
|
64
|
+
expected.each do |key, value|
|
65
|
+
expect(organization.send(value)).to eq expected[key]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,435 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
unless defined? Rubinius
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
6
|
+
end
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'pry-byebug'
|
10
|
+
rescue LoadError
|
11
|
+
end
|
12
|
+
|
13
|
+
# Set up gems listed in the Gemfile.
|
14
|
+
begin
|
15
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
|
16
|
+
require 'bundler'
|
17
|
+
Bundler.setup
|
18
|
+
rescue Bundler::GemNotFound => e
|
19
|
+
STDERR.puts e.message
|
20
|
+
STDERR.puts 'Try running `bundle install`.'
|
21
|
+
exit!
|
22
|
+
end
|
23
|
+
|
24
|
+
Bundler.require(:spec)
|
25
|
+
|
26
|
+
require 'trello'
|
27
|
+
require 'webmock/rspec'
|
28
|
+
require 'stringio'
|
29
|
+
|
30
|
+
Trello.logger = Logger.new(StringIO.new)
|
31
|
+
|
32
|
+
RSpec.configure do |rspec|
|
33
|
+
rspec.filter_run_excluding broken: true
|
34
|
+
|
35
|
+
rspec.before :each do
|
36
|
+
Trello.reset!
|
37
|
+
end
|
38
|
+
|
39
|
+
rspec.around(:each, :silence_warnings) do |example|
|
40
|
+
verbose = $VERBOSE
|
41
|
+
$VERBOSE = nil
|
42
|
+
example.run
|
43
|
+
$VERBOSE = verbose
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module Helpers
|
48
|
+
def user_details
|
49
|
+
{
|
50
|
+
'id' => 'abcdef123456789012345678',
|
51
|
+
'fullName' => 'Test User',
|
52
|
+
'username' => 'me',
|
53
|
+
'intials' => 'TU',
|
54
|
+
'avatarHash' => 'abcdef1234567890abcdef1234567890',
|
55
|
+
'bio' => 'a rather dumb user',
|
56
|
+
'url' => 'https://trello.com/me',
|
57
|
+
'email' => 'johnsmith@example.com'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def user_payload
|
62
|
+
JSON.generate(user_details)
|
63
|
+
end
|
64
|
+
|
65
|
+
def boards_details
|
66
|
+
[{
|
67
|
+
'id' => 'abcdef123456789123456789',
|
68
|
+
'name' => 'Test',
|
69
|
+
'desc' => 'This is a test board',
|
70
|
+
'closed' => false,
|
71
|
+
'starred' => false,
|
72
|
+
'idOrganization' => 'abcdef123456789123456789',
|
73
|
+
'url' => 'https://trello.com/board/test/abcdef123456789123456789',
|
74
|
+
'dateLastActivity' => '2012-12-08T18:40:24.314Z'
|
75
|
+
},
|
76
|
+
{
|
77
|
+
name: 'Test',
|
78
|
+
desc: 'This is a test board',
|
79
|
+
closed: false,
|
80
|
+
starred: false,
|
81
|
+
organization_id: 'abcdef123456789123456789'
|
82
|
+
}]
|
83
|
+
end
|
84
|
+
|
85
|
+
def boards_payload
|
86
|
+
JSON.generate(boards_details)
|
87
|
+
end
|
88
|
+
|
89
|
+
def checklists_details
|
90
|
+
[{
|
91
|
+
'id' => 'abcdef123456789123456789',
|
92
|
+
'name' => 'Test Checklist',
|
93
|
+
'desc' => 'A marvelous little checklist',
|
94
|
+
'closed' => false,
|
95
|
+
'pos' => 16384,
|
96
|
+
'url' => 'https://trello.com/blah/blah',
|
97
|
+
'idBoard' => 'abcdef123456789123456789',
|
98
|
+
'idCard' => 'abccardid',
|
99
|
+
'idList' => 'abcdef123456789123456789',
|
100
|
+
'idMembers' => ['abcdef123456789123456789'],
|
101
|
+
'checkItems' => { 'id' => 'ghijk987654321' }
|
102
|
+
},
|
103
|
+
{
|
104
|
+
name: 'A marvelous little checklist',
|
105
|
+
card_id: 'abccardid'
|
106
|
+
}]
|
107
|
+
end
|
108
|
+
|
109
|
+
def checklists_payload
|
110
|
+
JSON.generate(checklists_details)
|
111
|
+
end
|
112
|
+
|
113
|
+
def copied_checklists_details
|
114
|
+
[{
|
115
|
+
'id' => 'uvwxyz987654321987654321',
|
116
|
+
'name' => 'Test Checklist',
|
117
|
+
'desc' => '',
|
118
|
+
'closed' => nil,
|
119
|
+
'position' => 99999,
|
120
|
+
'url' => nil,
|
121
|
+
'idBoard' => 'abcdef123456789123456789',
|
122
|
+
'idList' => nil,
|
123
|
+
'idMembers' => nil,
|
124
|
+
'checkItems' => []
|
125
|
+
}]
|
126
|
+
end
|
127
|
+
|
128
|
+
def copied_checklists_payload
|
129
|
+
JSON.generate(copied_checklists_details)
|
130
|
+
end
|
131
|
+
|
132
|
+
def lists_details
|
133
|
+
[{
|
134
|
+
'id' => 'abcdef123456789123456789',
|
135
|
+
'name' => 'To Do',
|
136
|
+
'closed' => false,
|
137
|
+
'idBoard' => 'abcdef123456789123456789',
|
138
|
+
'idListSource' => 'abcdef123456789123456780',
|
139
|
+
'cards' => cards_details,
|
140
|
+
'pos' => 12
|
141
|
+
},
|
142
|
+
{
|
143
|
+
name: 'To Do',
|
144
|
+
board_id: 'abcdef123456789123456789',
|
145
|
+
pos: 12,
|
146
|
+
source_list_id: 'abcdef123456789123456780'
|
147
|
+
}
|
148
|
+
]
|
149
|
+
end
|
150
|
+
|
151
|
+
def lists_payload
|
152
|
+
JSON.generate(lists_details)
|
153
|
+
end
|
154
|
+
|
155
|
+
def cards_details
|
156
|
+
[{
|
157
|
+
'id' => 'abcdef123456789123456789',
|
158
|
+
'idShort' => '1',
|
159
|
+
'name' => 'Do something awesome',
|
160
|
+
'desc' => 'Awesome things are awesome.',
|
161
|
+
'closed' => false,
|
162
|
+
'idList' => 'abcdef123456789123456789',
|
163
|
+
'idBoard' => 'abcdef123456789123456789',
|
164
|
+
'idAttachmentCover' => 'abcdef123456789123456789',
|
165
|
+
'idMembers' => ['abcdef123456789123456789'],
|
166
|
+
'labels' => label_details,
|
167
|
+
'idLabels' => [ 'abcdef123456789123456789',
|
168
|
+
'bbcdef123456789123456789',
|
169
|
+
'cbcdef123456789123456789',
|
170
|
+
'dbcdef123456789123456789' ],
|
171
|
+
'url' => 'https://trello.com/card/board/specify-the-type-and-scope-of-the-jit-in-a-lightweight-spec/abcdef123456789123456789/abcdef123456789123456789',
|
172
|
+
'shortUrl' => 'https://trello.com/c/abcdef12',
|
173
|
+
'pos' => 12,
|
174
|
+
'dateLastActivity' => '2012-12-07T18:40:24.314Z'
|
175
|
+
},
|
176
|
+
{
|
177
|
+
name: 'Do something awesome',
|
178
|
+
list_id: 'abcdef123456789123456789',
|
179
|
+
desc: 'Awesome things are awesome.',
|
180
|
+
member_ids: ['abcdef123456789123456789'],
|
181
|
+
card_labels: [ 'abcdef123456789123456789',
|
182
|
+
'bbcdef123456789123456789',
|
183
|
+
'cbcdef123456789123456789',
|
184
|
+
'dbcdef123456789123456789' ],
|
185
|
+
due: Date.today,
|
186
|
+
pos: 12,
|
187
|
+
source_card_id: 'abcdef1234567891234567890',
|
188
|
+
source_card_properties: 'checklist,members'
|
189
|
+
}]
|
190
|
+
end
|
191
|
+
|
192
|
+
|
193
|
+
def cards_payload
|
194
|
+
JSON.generate(cards_details)
|
195
|
+
end
|
196
|
+
|
197
|
+
def attachments_details
|
198
|
+
[{
|
199
|
+
'id' => 'abcdef123456789123456789',
|
200
|
+
'name' => 'attachment1.png',
|
201
|
+
'url' => 'http://trello-assets.domain.tld/attachment1.png',
|
202
|
+
'bytes' => 98765,
|
203
|
+
'idMember' => 'abcdef123456789123456781',
|
204
|
+
'isUpload' => false,
|
205
|
+
'date' => '2013-02-28T17:12:28.497Z',
|
206
|
+
'previews' => 'previews'
|
207
|
+
},
|
208
|
+
{
|
209
|
+
'id' => 'abcdef123456789123456781',
|
210
|
+
'name' => 'attachment2.png',
|
211
|
+
'url' => 'http://trello-assets.domain.tld/attachment2.png',
|
212
|
+
'bytes' => 89123,
|
213
|
+
'idMember' => 'abcdef123456789123456782',
|
214
|
+
'isUpload' => true,
|
215
|
+
'date' => '2013-03-01T14:01:25.212Z',
|
216
|
+
}]
|
217
|
+
end
|
218
|
+
|
219
|
+
def attachments_payload
|
220
|
+
JSON.generate(attachments_details)
|
221
|
+
end
|
222
|
+
|
223
|
+
def plugin_data_details
|
224
|
+
[
|
225
|
+
{
|
226
|
+
"id"=>"abcdef123456789123456779",
|
227
|
+
"idPlugin"=>"abcdef123456789123456879",
|
228
|
+
"scope"=>"card",
|
229
|
+
"idModel"=>"abcdef123456789123446879",
|
230
|
+
"value"=>"{\"fields\":{\"plugin_key\":\"plugin_value\"}}",
|
231
|
+
"access"=>"shared"
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"id"=>"abcdef123456789123456879",
|
235
|
+
"idPlugin"=>"abcdef123456789123456779",
|
236
|
+
"scope"=>"card",
|
237
|
+
"idModel"=>"abcdef123456789123446579",
|
238
|
+
"value"=>"{\"fields\":{\"plugin_key\":\"plugin_value\"}}",
|
239
|
+
"access"=>"shared"
|
240
|
+
}
|
241
|
+
]
|
242
|
+
end
|
243
|
+
|
244
|
+
def plugin_data_payload
|
245
|
+
JSON.generate(plugin_data_details)
|
246
|
+
end
|
247
|
+
|
248
|
+
def card_payload
|
249
|
+
JSON.generate(cards_details.first)
|
250
|
+
end
|
251
|
+
|
252
|
+
def orgs_details
|
253
|
+
[{
|
254
|
+
'id' => 'abcdef123456789123456789',
|
255
|
+
'name' => 'test',
|
256
|
+
'displayName' => 'Test Organization',
|
257
|
+
'desc' => 'This is a test organization',
|
258
|
+
'url' => 'https://trello.com/test'
|
259
|
+
}]
|
260
|
+
end
|
261
|
+
|
262
|
+
def orgs_payload
|
263
|
+
JSON.generate(orgs_details)
|
264
|
+
end
|
265
|
+
|
266
|
+
def actions_details
|
267
|
+
[{
|
268
|
+
'id' => '4ee2482134a81a757a08af47',
|
269
|
+
'idMemberCreator' => 'abcdef123456789123456789',
|
270
|
+
'data' => {
|
271
|
+
'card' => {
|
272
|
+
'id' => '4ee2482134a81a757a08af45',
|
273
|
+
'name' => 'Bytecode outputter'
|
274
|
+
},
|
275
|
+
'board' => {
|
276
|
+
'id' => '4ec54f2f73820a0dea0d1f0e',
|
277
|
+
'name' => 'Caribou VM'
|
278
|
+
},
|
279
|
+
'list' => {
|
280
|
+
'id' => '4ee238b034a81a757a05cda0',
|
281
|
+
'name' => 'Assembler'
|
282
|
+
}
|
283
|
+
},
|
284
|
+
'date' => '2012-02-10T11:32:17Z',
|
285
|
+
'type' => 'createCard'
|
286
|
+
}]
|
287
|
+
end
|
288
|
+
|
289
|
+
def actions_payload
|
290
|
+
JSON.generate(actions_details)
|
291
|
+
end
|
292
|
+
|
293
|
+
def notification_details
|
294
|
+
{
|
295
|
+
'id' => '4f30d084d5b0f7ab453bee51',
|
296
|
+
'unread' => false,
|
297
|
+
'type' => 'commentCard',
|
298
|
+
'date' => '2012-02-07T07:19:32.393Z',
|
299
|
+
'data' => {
|
300
|
+
'board' => {
|
301
|
+
'id' => 'abcdef123456789123456789',
|
302
|
+
'name' => 'Test'
|
303
|
+
},
|
304
|
+
'card' =>{
|
305
|
+
'id' => 'abcdef123456789123456789',
|
306
|
+
'name' => 'Do something awesome'
|
307
|
+
},
|
308
|
+
'text' => 'test'
|
309
|
+
},
|
310
|
+
'idMemberCreator' => 'abcdef123456789012345678'
|
311
|
+
}
|
312
|
+
end
|
313
|
+
|
314
|
+
def notification_payload
|
315
|
+
JSON.generate(notification_details)
|
316
|
+
end
|
317
|
+
|
318
|
+
def organization_details
|
319
|
+
{
|
320
|
+
'id' => '4ee7e59ae582acdec8000291',
|
321
|
+
'name' => 'publicorg',
|
322
|
+
'desc' => 'This is a test organization',
|
323
|
+
'members' => [{
|
324
|
+
'id' => '4ee7df3ce582acdec80000b2',
|
325
|
+
'username' => 'alicetester',
|
326
|
+
'fullName' => 'Alice Tester'
|
327
|
+
}, {
|
328
|
+
'id' => '4ee7df74e582acdec80000b6',
|
329
|
+
'username' => 'davidtester',
|
330
|
+
'fullName' => 'David Tester'
|
331
|
+
}, {
|
332
|
+
'id' => '4ee7e2e1e582acdec8000112',
|
333
|
+
'username' => 'edtester',
|
334
|
+
'fullName' => 'Ed Tester'
|
335
|
+
}]
|
336
|
+
}
|
337
|
+
end
|
338
|
+
|
339
|
+
def organization_payload
|
340
|
+
JSON.generate(organization_details)
|
341
|
+
end
|
342
|
+
|
343
|
+
def token_details
|
344
|
+
{
|
345
|
+
'id' => '4f2c10c7b3eb95a45b294cd5',
|
346
|
+
'idMember' => 'abcdef123456789123456789',
|
347
|
+
'dateCreated' => '2012-02-03T16:52:23.661Z',
|
348
|
+
'permissions' => [
|
349
|
+
{
|
350
|
+
'idModel' => 'me',
|
351
|
+
'modelType' => 'Member',
|
352
|
+
'read' => true,
|
353
|
+
'write' => true
|
354
|
+
},
|
355
|
+
{
|
356
|
+
'idModel' => '*',
|
357
|
+
'modelType' => 'Board',
|
358
|
+
'read' => true,
|
359
|
+
'write' => true
|
360
|
+
},
|
361
|
+
{
|
362
|
+
'idModel' => '*',
|
363
|
+
'modelType' => 'Organization',
|
364
|
+
'read' => true,
|
365
|
+
'write' => true
|
366
|
+
}
|
367
|
+
]
|
368
|
+
}
|
369
|
+
end
|
370
|
+
|
371
|
+
def token_payload
|
372
|
+
JSON.generate(token_details)
|
373
|
+
end
|
374
|
+
|
375
|
+
def label_details
|
376
|
+
[
|
377
|
+
{'color' => 'yellow', 'name' => 'iOS', 'id' => 'abcdef123456789123456789', 'uses' => 3, 'idBoard' => 'abcdef123456789123456789'},
|
378
|
+
{'color' => 'purple', 'name' => 'Issue or bug', 'id' => 'bbcdef123456789123456789', 'uses' => 1, 'idBoard' => 'abcdef123456789123456789'},
|
379
|
+
{'color' => 'red', 'name' => 'deploy', 'id' => 'cbcdef123456789123456789', 'uses' => 2, 'idBoard' => 'abcdef123456789123456789'},
|
380
|
+
{'color' => 'blue', 'name' => 'on hold', 'id' => 'dbcdef123456789123456789', 'uses' => 6, 'idBoard' => 'abcdef123456789123456789'}
|
381
|
+
]
|
382
|
+
end
|
383
|
+
|
384
|
+
def label_options
|
385
|
+
{
|
386
|
+
name: 'iOS',
|
387
|
+
board_id: 'abcdef123456789123456789',
|
388
|
+
color: 'yellow'
|
389
|
+
}
|
390
|
+
end
|
391
|
+
|
392
|
+
def label_payload
|
393
|
+
JSON.generate(label_details)
|
394
|
+
end
|
395
|
+
|
396
|
+
def webhooks_details
|
397
|
+
[
|
398
|
+
{
|
399
|
+
'id' => 'webhookid',
|
400
|
+
'description' => 'Test webhook',
|
401
|
+
'idModel' => '1234',
|
402
|
+
'callbackURL' => 'http://example.org/webhook',
|
403
|
+
'active' => true
|
404
|
+
},
|
405
|
+
{
|
406
|
+
description: 'Test webhook',
|
407
|
+
id_model: '1234',
|
408
|
+
cakkback_url: 'http://example.org/webhook'
|
409
|
+
}
|
410
|
+
]
|
411
|
+
end
|
412
|
+
|
413
|
+
def label_name_details
|
414
|
+
[
|
415
|
+
{'yellow' => 'bug'},
|
416
|
+
{'red' => 'urgent'},
|
417
|
+
{'green' => 'deploy'},
|
418
|
+
{'blue' => 'on hold'},
|
419
|
+
{'orange' => 'new feature'},
|
420
|
+
{'purple' => 'experimental'}
|
421
|
+
]
|
422
|
+
end
|
423
|
+
|
424
|
+
def label_name_payload
|
425
|
+
JSON.generate(label_name_details)
|
426
|
+
end
|
427
|
+
|
428
|
+
def webhooks_payload
|
429
|
+
JSON.generate(webhooks_details)
|
430
|
+
end
|
431
|
+
|
432
|
+
def webhook_payload
|
433
|
+
JSON.generate(webhooks_details.first)
|
434
|
+
end
|
435
|
+
end
|