ruby-trello 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/trello/association.rb +2 -2
- data/lib/trello/authorization.rb +15 -4
- data/lib/trello/basic_data.rb +1 -1
- data/lib/trello/card.rb +4 -3
- data/spec/action_spec.rb +21 -21
- data/spec/association_spec.rb +6 -6
- data/spec/basic_auth_policy_spec.rb +17 -17
- data/spec/board_spec.rb +2 -2
- data/spec/card_spec.rb +15 -9
- data/spec/checklist_spec.rb +1 -2
- data/spec/client_spec.rb +8 -10
- data/spec/configuration_spec.rb +18 -18
- data/spec/integration/how_to_authorize_spec.rb +1 -1
- data/spec/item_spec.rb +10 -10
- data/spec/list_spec.rb +33 -33
- data/spec/member_spec.rb +35 -35
- data/spec/oauth_policy_spec.rb +49 -49
- data/spec/organization_spec.rb +8 -8
- data/spec/spec_helper.rb +129 -130
- data/spec/string_spec.rb +7 -7
- data/spec/token_spec.rb +17 -17
- data/spec/trello_spec.rb +7 -7
- data/spec/webhook_spec.rb +1 -4
- metadata +13 -25
data/spec/organization_spec.rb
CHANGED
@@ -5,30 +5,30 @@ module Trello
|
|
5
5
|
describe Organization do
|
6
6
|
include Helpers
|
7
7
|
|
8
|
-
let(:organization) { client.find(:organization,
|
8
|
+
let(:organization) { client.find(:organization, '4ee7e59ae582acdec8000291') }
|
9
9
|
let(:client) { Client.new }
|
10
10
|
|
11
11
|
before(:each) do
|
12
|
-
client.stub(:get).with(
|
12
|
+
client.stub(:get).with('/organizations/4ee7e59ae582acdec8000291', {}).
|
13
13
|
and_return organization_payload
|
14
14
|
end
|
15
15
|
|
16
|
-
context
|
16
|
+
context 'finding' do
|
17
17
|
let(:client) { Trello.client }
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'delegates to Trello.client#find' do
|
20
20
|
client.should_receive(:find).with(:organization, '4ee7e59ae582acdec8000291', {})
|
21
21
|
Organization.find('4ee7e59ae582acdec8000291')
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'is equivalent to client#find' do
|
25
25
|
Organization.find('4ee7e59ae582acdec8000291').should eq(organization)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
context
|
30
|
-
it
|
31
|
-
client.stub(:get).with(
|
29
|
+
context 'actions' do
|
30
|
+
it 'retrieves actions' do
|
31
|
+
client.stub(:get).with('/organizations/4ee7e59ae582acdec8000291/actions', { :filter => :all }).and_return actions_payload
|
32
32
|
organization.actions.count.should be > 0
|
33
33
|
end
|
34
34
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
Bundler.setup
|
12
12
|
rescue Bundler::GemNotFound => e
|
13
13
|
STDERR.puts e.message
|
14
|
-
STDERR.puts
|
14
|
+
STDERR.puts 'Try running `bundle install`.'
|
15
15
|
exit!
|
16
16
|
end
|
17
17
|
|
@@ -21,8 +21,7 @@ require 'trello'
|
|
21
21
|
require 'webmock/rspec'
|
22
22
|
require 'stringio'
|
23
23
|
|
24
|
-
|
25
|
-
Trello.logger = Logger.new($strio)
|
24
|
+
Trello.logger = Logger.new(StringIO.new)
|
26
25
|
|
27
26
|
RSpec.configure do |c|
|
28
27
|
c.filter_run_excluding :broken => true
|
@@ -35,14 +34,14 @@ end
|
|
35
34
|
module Helpers
|
36
35
|
def user_details
|
37
36
|
{
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
'id' => 'abcdef123456789012345678',
|
38
|
+
'fullName' => 'Test User',
|
39
|
+
'username' => 'me',
|
40
|
+
'intials' => 'TU',
|
41
|
+
'avatarHash' => 'abcdef1234567890abcdef1234567890',
|
42
|
+
'bio' => 'a rather dumb user',
|
43
|
+
'url' => 'https://trello.com/me',
|
44
|
+
'email' => 'johnsmith@example.com'
|
46
45
|
}
|
47
46
|
end
|
48
47
|
|
@@ -52,12 +51,12 @@ module Helpers
|
|
52
51
|
|
53
52
|
def boards_details
|
54
53
|
[{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
'id' => 'abcdef123456789123456789',
|
55
|
+
'name' => 'Test',
|
56
|
+
'desc' => 'This is a test board',
|
57
|
+
'closed' => false,
|
58
|
+
'idOrganization' => 'abcdef123456789123456789',
|
59
|
+
'url' => 'https://trello.com/board/test/abcdef123456789123456789'
|
61
60
|
}]
|
62
61
|
end
|
63
62
|
|
@@ -67,15 +66,15 @@ module Helpers
|
|
67
66
|
|
68
67
|
def checklists_details
|
69
68
|
[{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
69
|
+
'id' => 'abcdef123456789123456789',
|
70
|
+
'name' => 'Test Checklist',
|
71
|
+
'desc' => 'A marvelous little checklist',
|
72
|
+
'closed' => false,
|
73
|
+
'url' => 'https://trello.com/blah/blah',
|
74
|
+
'idBoard' => 'abcdef123456789123456789',
|
75
|
+
'idList' => 'abcdef123456789123456789',
|
76
|
+
'idMembers' => ['abcdef123456789123456789'],
|
77
|
+
'checkItems' => { 'id' => 'ghijk987654321' }
|
79
78
|
}]
|
80
79
|
end
|
81
80
|
|
@@ -85,11 +84,11 @@ module Helpers
|
|
85
84
|
|
86
85
|
def lists_details
|
87
86
|
[{
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
'id' => 'abcdef123456789123456789',
|
88
|
+
'name' => 'To Do',
|
89
|
+
'closed' => false,
|
90
|
+
'idBoard' => 'abcdef123456789123456789',
|
91
|
+
'cards' => cards_details
|
93
92
|
}]
|
94
93
|
end
|
95
94
|
|
@@ -99,17 +98,17 @@ module Helpers
|
|
99
98
|
|
100
99
|
def cards_details
|
101
100
|
[{
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
101
|
+
'id' => 'abcdef123456789123456789',
|
102
|
+
'idShort' => '1',
|
103
|
+
'name' => 'Do something awesome',
|
104
|
+
'desc' => 'Awesome things are awesome.',
|
105
|
+
'closed' => false,
|
106
|
+
'idList' => 'abcdef123456789123456789',
|
107
|
+
'idBoard' => 'abcdef123456789123456789',
|
108
|
+
'idMembers' => ['abcdef123456789123456789'],
|
109
|
+
'url' => 'https://trello.com/card/board/specify-the-type-and-scope-of-the-jit-in-a-lightweight-spec/abcdef123456789123456789/abcdef123456789123456789',
|
110
|
+
'pos' => 12,
|
111
|
+
'dateLastActivity' => '2012-12-07T18:40:24.314Z'
|
113
112
|
}]
|
114
113
|
end
|
115
114
|
|
@@ -120,22 +119,22 @@ module Helpers
|
|
120
119
|
|
121
120
|
def attachments_details
|
122
121
|
[{
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
122
|
+
'id' => 'abcdef123456789123456789',
|
123
|
+
'name' => 'attachment1.png',
|
124
|
+
'url' => 'http://trello-assets.domain.tld/attachment1.png',
|
125
|
+
'bytes' => 98765,
|
126
|
+
'idMember' => 'abcdef123456789123456781',
|
127
|
+
'isUpload' => false,
|
128
|
+
'date' => '2013-02-28T17:12:28.497Z',
|
130
129
|
},
|
131
130
|
{
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
131
|
+
'id' => 'abcdef123456789123456781',
|
132
|
+
'name' => 'attachment2.png',
|
133
|
+
'url' => 'http://trello-assets.domain.tld/attachment2.png',
|
134
|
+
'bytes' => 89123,
|
135
|
+
'idMember' => 'abcdef123456789123456782',
|
136
|
+
'isUpload' => true,
|
137
|
+
'date' => '2013-03-01T14:01:25.212Z',
|
139
138
|
}]
|
140
139
|
end
|
141
140
|
|
@@ -149,11 +148,11 @@ module Helpers
|
|
149
148
|
|
150
149
|
def orgs_details
|
151
150
|
[{
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
151
|
+
'id' => 'abcdef123456789123456789',
|
152
|
+
'name' => 'test',
|
153
|
+
'displayName' => 'Test Organization',
|
154
|
+
'desc' => 'This is a test organization',
|
155
|
+
'url' => 'https://trello.com/test'
|
157
156
|
}]
|
158
157
|
end
|
159
158
|
|
@@ -163,24 +162,24 @@ module Helpers
|
|
163
162
|
|
164
163
|
def actions_details
|
165
164
|
[{
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
165
|
+
'id' => '4ee2482134a81a757a08af47',
|
166
|
+
'idMemberCreator' => 'abcdef123456789123456789',
|
167
|
+
'data'=> {
|
168
|
+
'card' => {
|
169
|
+
'id' => '4ee2482134a81a757a08af45',
|
170
|
+
'name' => 'Bytecode outputter'
|
172
171
|
},
|
173
|
-
|
174
|
-
|
175
|
-
|
172
|
+
'board' => {
|
173
|
+
'id' => '4ec54f2f73820a0dea0d1f0e',
|
174
|
+
'name' => 'Caribou VM'
|
176
175
|
},
|
177
|
-
|
178
|
-
|
179
|
-
|
176
|
+
'list' => {
|
177
|
+
'id' => '4ee238b034a81a757a05cda0',
|
178
|
+
'name' => 'Assembler'
|
180
179
|
}
|
181
180
|
},
|
182
|
-
|
183
|
-
|
181
|
+
'date' => '2012-02-10T11:32:17Z',
|
182
|
+
'type' => 'createCard'
|
184
183
|
}]
|
185
184
|
end
|
186
185
|
|
@@ -190,22 +189,22 @@ module Helpers
|
|
190
189
|
|
191
190
|
def notification_details
|
192
191
|
{
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
192
|
+
'id' => '4f30d084d5b0f7ab453bee51',
|
193
|
+
'unread' => false,
|
194
|
+
'type' => 'commentCard',
|
195
|
+
'date' => '2012-02-07T07:19:32.393Z',
|
196
|
+
'data' => {
|
197
|
+
'board' => {
|
198
|
+
'id' => 'abcdef123456789123456789',
|
199
|
+
'name' => 'Test'
|
201
200
|
},
|
202
|
-
|
203
|
-
|
204
|
-
|
201
|
+
'card'=>{
|
202
|
+
'id' => 'abcdef123456789123456789',
|
203
|
+
'name' => 'Do something awesome'
|
205
204
|
},
|
206
|
-
|
205
|
+
'text' => 'test'
|
207
206
|
},
|
208
|
-
|
207
|
+
'idMemberCreator' => 'abcdef123456789012345678'
|
209
208
|
}
|
210
209
|
end
|
211
210
|
|
@@ -215,21 +214,21 @@ module Helpers
|
|
215
214
|
|
216
215
|
def organization_details
|
217
216
|
{
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
217
|
+
'id' => '4ee7e59ae582acdec8000291',
|
218
|
+
'name' => 'publicorg',
|
219
|
+
'desc' => 'This is a test organization',
|
220
|
+
'members' => [{
|
221
|
+
'id' => '4ee7df3ce582acdec80000b2',
|
222
|
+
'username' => 'alicetester',
|
223
|
+
'fullName' => 'Alice Tester'
|
225
224
|
}, {
|
226
|
-
|
227
|
-
|
228
|
-
|
225
|
+
'id' => '4ee7df74e582acdec80000b6',
|
226
|
+
'username' => 'davidtester',
|
227
|
+
'fullName' => 'David Tester'
|
229
228
|
}, {
|
230
|
-
|
231
|
-
|
232
|
-
|
229
|
+
'id' => '4ee7e2e1e582acdec8000112',
|
230
|
+
'username' => 'edtester',
|
231
|
+
'fullName' => 'Ed Tester'
|
233
232
|
}]
|
234
233
|
}
|
235
234
|
end
|
@@ -240,27 +239,27 @@ module Helpers
|
|
240
239
|
|
241
240
|
def token_details
|
242
241
|
{
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
242
|
+
'id' => '4f2c10c7b3eb95a45b294cd5',
|
243
|
+
'idMember' => 'abcdef123456789123456789',
|
244
|
+
'dateCreated' => '2012-02-03T16:52:23.661Z',
|
245
|
+
'permissions' => [
|
247
246
|
{
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
247
|
+
'idModel' => 'me',
|
248
|
+
'modelType' => 'Member',
|
249
|
+
'read' => true,
|
250
|
+
'write' => true
|
252
251
|
},
|
253
252
|
{
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
253
|
+
'idModel' => '*',
|
254
|
+
'modelType' => 'Board',
|
255
|
+
'read' => true,
|
256
|
+
'write' => true
|
258
257
|
},
|
259
258
|
{
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
259
|
+
'idModel' => '*',
|
260
|
+
'modelType' => 'Organization',
|
261
|
+
'read' => true,
|
262
|
+
'write' => true
|
264
263
|
}
|
265
264
|
]
|
266
265
|
}
|
@@ -272,8 +271,8 @@ module Helpers
|
|
272
271
|
|
273
272
|
def label_details
|
274
273
|
[
|
275
|
-
{
|
276
|
-
{
|
274
|
+
{'color' => 'yellow', 'name' => 'iOS'},
|
275
|
+
{'color' => 'purple', 'name' => 'Issue or bug'}
|
277
276
|
]
|
278
277
|
end
|
279
278
|
|
@@ -283,12 +282,12 @@ module Helpers
|
|
283
282
|
|
284
283
|
def label_name_details
|
285
284
|
[
|
286
|
-
{
|
287
|
-
{
|
288
|
-
{
|
289
|
-
{
|
290
|
-
{
|
291
|
-
{
|
285
|
+
{'yellow' => 'bug'},
|
286
|
+
{'red' => 'urgent'},
|
287
|
+
{'green' => 'deploy'},
|
288
|
+
{'blue' => 'on hold'},
|
289
|
+
{'orange' => 'new feature'},
|
290
|
+
{'purple' => 'experimental'}
|
292
291
|
]
|
293
292
|
end
|
294
293
|
|
@@ -299,11 +298,11 @@ module Helpers
|
|
299
298
|
def webhooks_details
|
300
299
|
[
|
301
300
|
{
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
301
|
+
'id' => 'webhookid',
|
302
|
+
'description' => 'Test webhook',
|
303
|
+
'idModel' => '1234',
|
304
|
+
'callbackURL' => 'http://example.org/webhook',
|
305
|
+
'active' => true
|
307
306
|
}
|
308
307
|
]
|
309
308
|
end
|
data/spec/string_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'trello/string'
|
3
3
|
|
4
|
-
describe String,
|
4
|
+
describe String, '#json_into' do
|
5
5
|
include Helpers
|
6
6
|
|
7
7
|
def example_class
|
@@ -15,11 +15,11 @@ describe String, "#json_into" do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
19
|
-
|
18
|
+
it 'converts json into an instance of a class' do
|
19
|
+
'{}'.json_into(example_class).should be_an_instance_of example_class
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'supplies the parsed json to the class ctor as a hash' do
|
23
23
|
example_class.should_receive(:new).once.with({
|
24
24
|
"name" => "Jazz Kang",
|
25
25
|
"description" => "Plonker"
|
@@ -30,7 +30,7 @@ describe String, "#json_into" do
|
|
30
30
|
json_text.json_into example_class
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it 'can also handle arrays of instances of a class' do
|
34
34
|
json_text = <<-JSON
|
35
35
|
[
|
36
36
|
{"name" : "Jazz Kang", "description": "Plonker"},
|