ruby-trello 1.1.3 → 1.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 +3 -1
- data/lib/trello/action.rb +17 -5
- data/lib/trello/attachment.rb +15 -0
- data/lib/trello/authorization.rb +9 -9
- data/lib/trello/basic_data.rb +2 -2
- data/lib/trello/board.rb +90 -18
- data/lib/trello/card.rb +127 -18
- data/lib/trello/checklist.rb +29 -8
- data/lib/trello/configuration.rb +8 -8
- data/lib/trello/has_actions.rb +1 -1
- data/lib/trello/item.rb +13 -2
- data/lib/trello/item_state.rb +8 -1
- data/lib/trello/label.rb +5 -0
- data/lib/trello/label_name.rb +8 -3
- data/lib/trello/list.rb +23 -9
- data/lib/trello/member.rb +26 -9
- data/lib/trello/net.rb +5 -5
- data/lib/trello/notification.rb +15 -2
- data/lib/trello/organization.rb +12 -1
- data/lib/trello/token.rb +13 -2
- data/lib/trello/webhook.rb +40 -12
- data/spec/association_spec.rb +5 -5
- data/spec/basic_auth_policy_spec.rb +2 -2
- data/spec/board_spec.rb +45 -14
- data/spec/card_spec.rb +29 -29
- data/spec/checklist_spec.rb +16 -16
- data/spec/client_spec.rb +14 -14
- data/spec/configuration_spec.rb +25 -25
- data/spec/integration/how_to_authorize_spec.rb +5 -5
- data/spec/integration/how_to_use_boards_spec.rb +5 -5
- data/spec/list_spec.rb +10 -10
- data/spec/member_spec.rb +7 -7
- data/spec/oauth_policy_spec.rb +4 -4
- data/spec/organization_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/token_spec.rb +1 -1
- data/spec/webhook_spec.rb +4 -4
- metadata +2 -2
data/spec/configuration_spec.rb
CHANGED
@@ -47,10 +47,10 @@ describe Trello::Configuration do
|
|
47
47
|
describe 'initialize' do
|
48
48
|
it 'sets key attributes provided as a hash' do
|
49
49
|
configuration = Trello::Configuration.new(
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
50
|
+
consumer_key: 'consumer_key',
|
51
|
+
consumer_secret: 'consumer_secret',
|
52
|
+
oauth_token: 'oauth_token',
|
53
|
+
oauth_token_secret: 'oauth_token_secret'
|
54
54
|
)
|
55
55
|
configuration.consumer_key.should eq('consumer_key')
|
56
56
|
configuration.consumer_secret.should eq('consumer_secret')
|
@@ -67,47 +67,47 @@ describe Trello::Configuration do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'returns an empty if attributes incomplete' do
|
70
|
-
Trello::Configuration.new(:
|
70
|
+
Trello::Configuration.new(consumer_key: 'consumer_key').credentials.should eq({})
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'returns a hash of oauth attributes' do
|
74
74
|
configuration = Trello::Configuration.new(
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
75
|
+
consumer_key: 'consumer_key',
|
76
|
+
consumer_secret: 'consumer_secret',
|
77
|
+
oauth_token: 'oauth_token',
|
78
|
+
oauth_token_secret: 'oauth_token_secret'
|
79
79
|
)
|
80
80
|
configuration.credentials.should eq(
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
81
|
+
consumer_key: 'consumer_key',
|
82
|
+
consumer_secret: 'consumer_secret',
|
83
|
+
oauth_token: 'oauth_token',
|
84
|
+
oauth_token_secret: 'oauth_token_secret'
|
85
85
|
)
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'includes callback and return url if given' do
|
89
89
|
configuration = Trello::Configuration.new(
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
90
|
+
consumer_key: 'consumer_key',
|
91
|
+
consumer_secret: 'consumer_secret',
|
92
|
+
return_url: 'http://example.com',
|
93
|
+
callback: 'callback'
|
94
94
|
)
|
95
95
|
configuration.credentials.should eq(
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
96
|
+
consumer_key: 'consumer_key',
|
97
|
+
consumer_secret: 'consumer_secret',
|
98
|
+
return_url: 'http://example.com',
|
99
|
+
callback: 'callback'
|
100
100
|
)
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'returns a hash of basic auth policy attributes' do
|
104
104
|
configuration = Trello::Configuration.new(
|
105
|
-
:
|
106
|
-
:
|
105
|
+
developer_public_key: 'developer_public_key',
|
106
|
+
member_token: 'member_token'
|
107
107
|
)
|
108
108
|
configuration.credentials.should eq(
|
109
|
-
:
|
110
|
-
:
|
109
|
+
developer_public_key: 'developer_public_key',
|
110
|
+
member_token: 'member_token'
|
111
111
|
)
|
112
112
|
end
|
113
113
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/integration_test'
|
3
3
|
|
4
|
-
describe "Authorizing read-only requests", :
|
4
|
+
describe "Authorizing read-only requests", broken: true do
|
5
5
|
include IntegrationTest
|
6
6
|
|
7
7
|
it "Reading public resources requires just a developer public key" do
|
8
8
|
uri = Addressable::URI.parse("https://api.trello.com/1/boards/4ed7e27fe6abb2517a21383d")
|
9
9
|
uri.query_values = {
|
10
|
-
:
|
10
|
+
key: @developer_public_key
|
11
11
|
}
|
12
12
|
|
13
13
|
get(uri).code.should === 200
|
@@ -16,8 +16,8 @@ describe "Authorizing read-only requests", :broken => true do
|
|
16
16
|
it "Reading private resources requires developer public key AND a member token" do
|
17
17
|
uri = Addressable::URI.parse("https://api.trello.com/1/boards/#{@welcome_board}")
|
18
18
|
uri.query_values = {
|
19
|
-
:
|
20
|
-
:
|
19
|
+
key: @developer_public_key,
|
20
|
+
token: @member_token
|
21
21
|
}
|
22
22
|
|
23
23
|
get(uri).code.should === 200
|
@@ -35,7 +35,7 @@ describe "Authorizing read-only requests", :broken => true do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe "OAuth", :
|
38
|
+
describe "OAuth", broken: true do
|
39
39
|
include IntegrationTest
|
40
40
|
|
41
41
|
before do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/integration_test'
|
3
3
|
|
4
|
-
describe "how to use boards", :
|
4
|
+
describe "how to use boards", broken: true do
|
5
5
|
include IntegrationTest
|
6
6
|
|
7
7
|
context "given a valid access token" do
|
@@ -12,14 +12,14 @@ describe "how to use boards", :broken => true do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
after do
|
15
|
-
if @new_board and false == @new_board.closed?
|
15
|
+
if @new_board and false == @new_board.closed?
|
16
16
|
@new_board.update_fields 'closed' => true
|
17
17
|
@new_board.save
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
it "can add a board" do
|
22
|
-
@new_board = Board.create(:
|
22
|
+
@new_board = Board.create(name: "An example")
|
23
23
|
@new_board.should_not be_nil
|
24
24
|
@new_board.id.should_not be_nil
|
25
25
|
@new_board.name.should == "An example"
|
@@ -33,11 +33,11 @@ describe "how to use boards", :broken => true do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "can close a board" do
|
36
|
-
@new_board = Board.create(:
|
36
|
+
@new_board = Board.create(name: "[#{Time.now}, CLOSED] An example")
|
37
37
|
|
38
38
|
@new_board.update_fields 'closed' => true
|
39
39
|
@new_board.save
|
40
|
-
|
40
|
+
|
41
41
|
Board.find(@new_board.id).should be_closed
|
42
42
|
end
|
43
43
|
|
data/spec/list_spec.rb
CHANGED
@@ -43,15 +43,15 @@ module Trello
|
|
43
43
|
list.should_not be_valid
|
44
44
|
end
|
45
45
|
|
46
|
-
it 'creates a new record and saves it on Trello', :
|
46
|
+
it 'creates a new record and saves it on Trello', refactor: true do
|
47
47
|
payload = {
|
48
|
-
:
|
49
|
-
:
|
48
|
+
name: 'Test List',
|
49
|
+
board_id: 'abcdef123456789123456789'
|
50
50
|
}
|
51
51
|
|
52
52
|
result = JSON.generate(payload)
|
53
53
|
|
54
|
-
expected_payload = {:
|
54
|
+
expected_payload = {name: 'Test List', closed: false, idBoard: 'abcdef123456789123456789'}
|
55
55
|
|
56
56
|
client.should_receive(:post).with('/lists', expected_payload).and_return result
|
57
57
|
|
@@ -66,8 +66,8 @@ module Trello
|
|
66
66
|
expected_new_name = 'xxx'
|
67
67
|
|
68
68
|
payload = {
|
69
|
-
:
|
70
|
-
:
|
69
|
+
name: expected_new_name,
|
70
|
+
closed: false
|
71
71
|
}
|
72
72
|
|
73
73
|
client.should_receive(:put).once.with('/lists/abcdef123456789123456789', payload)
|
@@ -100,14 +100,14 @@ module Trello
|
|
100
100
|
|
101
101
|
context 'actions' do
|
102
102
|
it 'has a list of actions' do
|
103
|
-
client.stub(:get).with('/lists/abcdef123456789123456789/actions', { :
|
103
|
+
client.stub(:get).with('/lists/abcdef123456789123456789/actions', { filter: :all }).and_return actions_payload
|
104
104
|
list.actions.count.should be > 0
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
context 'cards' do
|
109
109
|
it 'has a list of cards' do
|
110
|
-
client.stub(:get).with('/lists/abcdef123456789123456789/cards', { :
|
110
|
+
client.stub(:get).with('/lists/abcdef123456789123456789/cards', { filter: :open }).and_return cards_payload
|
111
111
|
list.cards.count.should be > 0
|
112
112
|
end
|
113
113
|
end
|
@@ -128,8 +128,8 @@ module Trello
|
|
128
128
|
describe '#close!' do
|
129
129
|
it 'updates the close attribute to true and saves the list' do
|
130
130
|
client.should_receive(:put).once.with('/lists/abcdef123456789123456789', {
|
131
|
-
:
|
132
|
-
:
|
131
|
+
name: list.name,
|
132
|
+
closed: true
|
133
133
|
})
|
134
134
|
|
135
135
|
list.close!
|
data/spec/member_spec.rb
CHANGED
@@ -27,15 +27,15 @@ module Trello
|
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'actions' do
|
30
|
-
it 'retrieves a list of actions', :
|
31
|
-
client.stub(:get).with('/members/abcdef123456789012345678/actions', { :
|
30
|
+
it 'retrieves a list of actions', refactor: true do
|
31
|
+
client.stub(:get).with('/members/abcdef123456789012345678/actions', { filter: :all }).and_return actions_payload
|
32
32
|
member.actions.count.should be > 0
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'boards' do
|
37
37
|
it 'has a list of boards' do
|
38
|
-
client.stub(:get).with('/members/abcdef123456789012345678/boards', { :
|
38
|
+
client.stub(:get).with('/members/abcdef123456789012345678/boards', { filter: :all }).and_return boards_payload
|
39
39
|
boards = member.boards
|
40
40
|
boards.count.should be > 0
|
41
41
|
end
|
@@ -43,7 +43,7 @@ module Trello
|
|
43
43
|
|
44
44
|
context 'cards' do
|
45
45
|
it 'has a list of cards' do
|
46
|
-
client.stub(:get).with('/members/abcdef123456789012345678/cards', { :
|
46
|
+
client.stub(:get).with('/members/abcdef123456789012345678/cards', { filter: :open }).and_return cards_payload
|
47
47
|
cards = member.cards
|
48
48
|
cards.count.should be > 0
|
49
49
|
end
|
@@ -51,7 +51,7 @@ module Trello
|
|
51
51
|
|
52
52
|
context 'organizations' do
|
53
53
|
it 'has a list of organizations' do
|
54
|
-
client.stub(:get).with('/members/abcdef123456789012345678/organizations', { :
|
54
|
+
client.stub(:get).with('/members/abcdef123456789012345678/organizations', { filter: :all }).and_return orgs_payload
|
55
55
|
orgs = member.organizations
|
56
56
|
orgs.count.should be > 0
|
57
57
|
end
|
@@ -78,8 +78,8 @@ module Trello
|
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'returns a valid url for the avatar' do
|
81
|
-
member.avatar_url(:
|
82
|
-
member.avatar_url(:
|
81
|
+
member.avatar_url(size: :large).should == 'https://trello-avatars.s3.amazonaws.com/abcdef1234567890abcdef1234567890/170.png'
|
82
|
+
member.avatar_url(size: :small).should == 'https://trello-avatars.s3.amazonaws.com/abcdef1234567890abcdef1234567890/30.png'
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'gets the url' do
|
data/spec/oauth_policy_spec.rb
CHANGED
@@ -18,8 +18,8 @@ describe OAuthPolicy do
|
|
18
18
|
|
19
19
|
it 'is built from given consumer_key and consumer_secret' do
|
20
20
|
policy = OAuthPolicy.new(
|
21
|
-
:
|
22
|
-
:
|
21
|
+
consumer_key: 'consumer_key',
|
22
|
+
consumer_secret: 'consumer_secret'
|
23
23
|
)
|
24
24
|
policy.consumer_credential.key.should eq('consumer_key')
|
25
25
|
policy.consumer_credential.secret.should eq('consumer_secret')
|
@@ -42,8 +42,8 @@ describe OAuthPolicy do
|
|
42
42
|
|
43
43
|
it 'is built from given oauth_token and oauth_token_secret' do
|
44
44
|
policy = OAuthPolicy.new(
|
45
|
-
:
|
46
|
-
:
|
45
|
+
oauth_token: 'oauth_token',
|
46
|
+
oauth_token_secret: 'oauth_token_secret'
|
47
47
|
)
|
48
48
|
policy.token.key.should eq('oauth_token')
|
49
49
|
policy.token.secret.should eq('oauth_token_secret')
|
data/spec/organization_spec.rb
CHANGED
@@ -28,7 +28,7 @@ module Trello
|
|
28
28
|
|
29
29
|
context 'actions' do
|
30
30
|
it 'retrieves actions' do
|
31
|
-
client.stub(:get).with('/organizations/4ee7e59ae582acdec8000291/actions', { :
|
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
@@ -24,7 +24,7 @@ require 'stringio'
|
|
24
24
|
Trello.logger = Logger.new(StringIO.new)
|
25
25
|
|
26
26
|
RSpec.configure do |c|
|
27
|
-
c.filter_run_excluding :
|
27
|
+
c.filter_run_excluding broken: true
|
28
28
|
|
29
29
|
c.before :each do
|
30
30
|
Trello.reset!
|
@@ -55,6 +55,7 @@ module Helpers
|
|
55
55
|
'name' => 'Test',
|
56
56
|
'desc' => 'This is a test board',
|
57
57
|
'closed' => false,
|
58
|
+
'starred' => false,
|
58
59
|
'idOrganization' => 'abcdef123456789123456789',
|
59
60
|
'url' => 'https://trello.com/board/test/abcdef123456789123456789'
|
60
61
|
}]
|
data/spec/token_spec.rb
CHANGED
@@ -15,7 +15,7 @@ module Trello
|
|
15
15
|
let(:client) { Trello.client }
|
16
16
|
|
17
17
|
it 'delegates to Trello.client#find' do
|
18
|
-
client.should_receive(:find).with(:token, '1234', {:
|
18
|
+
client.should_receive(:find).with(:token, '1234', {webhooks: true})
|
19
19
|
Token.find('1234')
|
20
20
|
end
|
21
21
|
|
data/spec/webhook_spec.rb
CHANGED
@@ -32,13 +32,13 @@ module Trello
|
|
32
32
|
webhook.should be_valid
|
33
33
|
end
|
34
34
|
|
35
|
-
it 'creates a new webhook and saves it on Trello', :
|
36
|
-
payload = { :
|
35
|
+
it 'creates a new webhook and saves it on Trello', refactor: true do
|
36
|
+
payload = { name: 'Test Card', desc: nil }
|
37
37
|
|
38
38
|
webhook = webhooks_details.first
|
39
39
|
result = JSON.generate(webhook)
|
40
40
|
|
41
|
-
expected_payload = {:
|
41
|
+
expected_payload = {description: webhook[:description], idModel: webhook[:idModel], callbackURL: webhook[:callbackURL]}
|
42
42
|
|
43
43
|
client.should_receive(:post).with("/webhooks", expected_payload).and_return result
|
44
44
|
|
@@ -52,7 +52,7 @@ module Trello
|
|
52
52
|
it "updating description does a put on the correct resource with the correct value" do
|
53
53
|
expected_new_description = "xxx"
|
54
54
|
|
55
|
-
expected_payload = {:
|
55
|
+
expected_payload = {description: expected_new_description, idModel: webhook.id_model, callbackURL: webhook.callback_url, active: webhook.active}
|
56
56
|
|
57
57
|
client.should_receive(:put).once.with("/webhooks/#{webhook.id}", expected_payload)
|
58
58
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-trello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Tregunna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|