ruby-trello 0.4.4 → 0.4.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/trello.rb +3 -2
- data/lib/trello/attachment.rb +15 -0
- data/lib/trello/authorization.rb +4 -2
- data/lib/trello/board.rb +8 -0
- data/lib/trello/card.rb +57 -3
- data/lib/trello/item_state.rb +3 -3
- data/lib/trello/list.rb +11 -2
- data/lib/trello/net.rb +1 -0
- data/spec/board_spec.rb +27 -11
- data/spec/card_spec.rb +95 -4
- data/spec/integration/integration_test.rb +1 -1
- data/spec/list_spec.rb +37 -2
- data/spec/spec_helper.rb +18 -1
- metadata +100 -82
data/lib/trello.rb
CHANGED
@@ -15,7 +15,7 @@ require 'active_model'
|
|
15
15
|
# OAuthPolicy.consumer_credential = OAuthCredential.new 'PUBLIC_KEY', 'SECRET'
|
16
16
|
#
|
17
17
|
# You can get the key by going to this url in your browser:
|
18
|
-
# https://trello.com/1/
|
18
|
+
# https://trello.com/1/authorize?key=PUBLIC_KEY_FROM_ABOVE&name=MyApp&response_type=token&scope=read,write,account&expiration=never
|
19
19
|
# Only request the permissions you need; i.e., scope=read if you only need read, or scope=write if you only need write. Comma separate scopes you need.
|
20
20
|
# If you want your token to expire after 30 days, drop the &expiration=never. Then run the following code, where KEY denotes the key returned from the
|
21
21
|
# url above:
|
@@ -41,6 +41,7 @@ module Trello
|
|
41
41
|
autoload :Action, 'trello/action'
|
42
42
|
autoload :Association, 'trello/association'
|
43
43
|
autoload :AssociationProxy, 'trello/association_proxy'
|
44
|
+
autoload :Attachment, 'trello/attachment'
|
44
45
|
autoload :BasicData, 'trello/basic_data'
|
45
46
|
autoload :Board, 'trello/board'
|
46
47
|
autoload :Card, 'trello/card'
|
@@ -48,7 +49,7 @@ module Trello
|
|
48
49
|
autoload :Client, 'trello/client'
|
49
50
|
autoload :HasActions, 'trello/has_actions'
|
50
51
|
autoload :Item, 'trello/item'
|
51
|
-
autoload :
|
52
|
+
autoload :CheckItemState, 'trello/item_state'
|
52
53
|
autoload :Label, 'trello/label'
|
53
54
|
autoload :List, 'trello/list'
|
54
55
|
autoload :Member, 'trello/member'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Trello
|
2
|
+
# A file or url that is linked to a Trello card
|
3
|
+
class Attachment < BasicData
|
4
|
+
register_attributes :name, :id
|
5
|
+
# Update the fields of an attachment.
|
6
|
+
#
|
7
|
+
# Supply a hash of stringkeyed data retrieved from the Trello API representing
|
8
|
+
# an attachment.
|
9
|
+
def update_fields(fields)
|
10
|
+
attributes[:name] = fields['name']
|
11
|
+
attributes[:id] = fields['id']
|
12
|
+
self
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/trello/authorization.rb
CHANGED
@@ -16,7 +16,7 @@ module Trello
|
|
16
16
|
new_values = { :key => @developer_public_key, :token => @member_token }
|
17
17
|
the_uri.query_values = new_values.merge existing_values
|
18
18
|
|
19
|
-
Request.new request.verb, the_uri, request.headers
|
19
|
+
Request.new request.verb, the_uri, request.headers, request.body
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -103,7 +103,9 @@ module Trello
|
|
103
103
|
consumer.options[:nonce] = Nonce.next
|
104
104
|
consumer.options[:timestamp] = Clock.timestamp
|
105
105
|
consumer.options[:uri] = url
|
106
|
-
|
106
|
+
consumer.key = consumer_credential.key
|
107
|
+
consumer.secret = consumer_credential.secret
|
108
|
+
|
107
109
|
consumer.sign!(request, OAuth::Token.new(token.key, token.secret))
|
108
110
|
|
109
111
|
request['authorization']
|
data/lib/trello/board.rb
CHANGED
@@ -19,6 +19,10 @@ module Trello
|
|
19
19
|
'desc' => fields[:description],
|
20
20
|
'closed' => fields[:closed] || false).save
|
21
21
|
end
|
22
|
+
|
23
|
+
def all
|
24
|
+
Client.get("/members/#{Member.find(:me).username}/boards").json_into(self)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
def save
|
@@ -63,6 +67,10 @@ module Trello
|
|
63
67
|
lists.size > 0
|
64
68
|
end
|
65
69
|
|
70
|
+
def find_card(card_id)
|
71
|
+
Client.get("/boards/#{self.id}/cards/#{card_id}").json_into(Card)
|
72
|
+
end
|
73
|
+
|
66
74
|
# Return all the cards on this board.
|
67
75
|
#
|
68
76
|
# This method, when called, can take a hash table with a filter key containing any
|
data/lib/trello/card.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Trello
|
2
2
|
# A Card is a container that can house checklists and comments; it resides inside a List.
|
3
3
|
class Card < BasicData
|
4
|
-
register_attributes :id, :short_id, :name, :description, :due, :closed, :url, :board_id, :member_ids, :list_id,
|
4
|
+
register_attributes :id, :short_id, :name, :description, :due, :closed, :url, :board_id, :member_ids, :list_id, :pos,
|
5
5
|
:readonly => [ :id, :short_id, :url, :board_id, :member_ids ]
|
6
6
|
validates_presence_of :id, :name, :list_id
|
7
7
|
validates_length_of :name, :in => 1..16384
|
@@ -38,6 +38,7 @@ module Trello
|
|
38
38
|
attributes[:board_id] = fields['idBoard']
|
39
39
|
attributes[:member_ids] = fields['idMembers']
|
40
40
|
attributes[:list_id] = fields['idList']
|
41
|
+
attributes[:pos] = fields['pos']
|
41
42
|
self
|
42
43
|
end
|
43
44
|
|
@@ -51,6 +52,12 @@ module Trello
|
|
51
52
|
# :filter => [ :none, :all ] # default :all
|
52
53
|
many :checklists, :filter => :all
|
53
54
|
|
55
|
+
def check_item_states
|
56
|
+
states = Client.get("/cards/#{self.id}/checkItemStates").json_into(CheckItemState)
|
57
|
+
MultiAssociation.new(self, states).proxy
|
58
|
+
end
|
59
|
+
|
60
|
+
|
54
61
|
# Returns a reference to the list this card is currently in.
|
55
62
|
one :list, :using => :list_id
|
56
63
|
|
@@ -89,10 +96,25 @@ module Trello
|
|
89
96
|
:closed => closed,
|
90
97
|
:idList => list_id,
|
91
98
|
:idBoard => board_id,
|
92
|
-
:idMembers => member_ids
|
99
|
+
:idMembers => member_ids,
|
100
|
+
:pos => pos
|
93
101
|
})
|
94
102
|
end
|
95
103
|
|
104
|
+
# Check if the card is not active anymore.
|
105
|
+
def closed?
|
106
|
+
closed
|
107
|
+
end
|
108
|
+
|
109
|
+
def close
|
110
|
+
self.closed = true
|
111
|
+
end
|
112
|
+
|
113
|
+
def close!
|
114
|
+
close
|
115
|
+
save
|
116
|
+
end
|
117
|
+
|
96
118
|
# Is the record valid?
|
97
119
|
def valid?
|
98
120
|
name && list_id
|
@@ -117,6 +139,13 @@ module Trello
|
|
117
139
|
})
|
118
140
|
end
|
119
141
|
|
142
|
+
# Move this card to the given board (and optional list on this board)
|
143
|
+
def move_to_board(new_board, new_list = nil)
|
144
|
+
payload = { :value => new_board.id }
|
145
|
+
payload[:idList] = new_list.id if new_list
|
146
|
+
Client.put("/cards/#{id}/idBoard", payload)
|
147
|
+
end
|
148
|
+
|
120
149
|
# Add a member to this card
|
121
150
|
def add_member(member)
|
122
151
|
Client.post("/cards/#{id}/members", {
|
@@ -153,10 +182,35 @@ module Trello
|
|
153
182
|
Client.delete("/cards/#{id}/labels/#{colour}")
|
154
183
|
end
|
155
184
|
|
185
|
+
# Add an attachment to this card
|
186
|
+
def add_attachment(attachment, name='')
|
187
|
+
if attachment.is_a? File
|
188
|
+
Client.post("/cards/#{id}/attachments", {
|
189
|
+
:file => attachment,
|
190
|
+
:name => name
|
191
|
+
})
|
192
|
+
else
|
193
|
+
Client.post("/cards/#{id}/attachments", {
|
194
|
+
:url => attachment,
|
195
|
+
:name => name
|
196
|
+
})
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Retrieve a list of attachments
|
201
|
+
def attachments
|
202
|
+
attachments = Client.get("/cards/#{id}/attachments").json_into(Attachment)
|
203
|
+
MultiAssociation.new(self, attachments).proxy
|
204
|
+
end
|
205
|
+
|
206
|
+
# Remove an attachment from this card
|
207
|
+
def remove_attachment(attachment)
|
208
|
+
Client.delete("/cards/#{id}/attachments/#{attachment.id}")
|
209
|
+
end
|
210
|
+
|
156
211
|
# :nodoc:
|
157
212
|
def request_prefix
|
158
213
|
"/cards/#{id}"
|
159
214
|
end
|
160
|
-
|
161
215
|
end
|
162
216
|
end
|
data/lib/trello/item_state.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Trello
|
2
2
|
# Represents the state of an item.
|
3
|
-
class
|
3
|
+
class CheckItemState < BasicData
|
4
4
|
register_attributes :id, :state, :item_id, :readonly => [ :id, :state, :item_id ]
|
5
5
|
validates_presence_of :id, :item_id
|
6
6
|
|
@@ -11,7 +11,7 @@ module Trello
|
|
11
11
|
def update_fields(fields)
|
12
12
|
attributes[:id] = fields['id']
|
13
13
|
attributes[:state] = fields['state']
|
14
|
-
attributes[:item_id] = fields['
|
14
|
+
attributes[:item_id] = fields['idCheckItem']
|
15
15
|
self
|
16
16
|
end
|
17
17
|
|
@@ -20,4 +20,4 @@ module Trello
|
|
20
20
|
Item.find(item_id)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
data/lib/trello/list.rb
CHANGED
@@ -42,10 +42,10 @@ module Trello
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def update!
|
45
|
-
Client.put("/lists", {
|
45
|
+
Client.put("/lists/#{id}", {
|
46
46
|
:name => name,
|
47
47
|
:closed => closed
|
48
|
-
})
|
48
|
+
})
|
49
49
|
end
|
50
50
|
|
51
51
|
# Check if the list is not active anymore.
|
@@ -53,6 +53,15 @@ module Trello
|
|
53
53
|
closed
|
54
54
|
end
|
55
55
|
|
56
|
+
def close
|
57
|
+
self.closed = true
|
58
|
+
end
|
59
|
+
|
60
|
+
def close!
|
61
|
+
close
|
62
|
+
save
|
63
|
+
end
|
64
|
+
|
56
65
|
# Return the board the list is connected to.
|
57
66
|
one :board, :using => :board_id
|
58
67
|
|
data/lib/trello/net.rb
CHANGED
data/spec/board_spec.rb
CHANGED
@@ -11,6 +11,14 @@ module Trello
|
|
11
11
|
@board = Board.find('abcdef123456789123456789')
|
12
12
|
end
|
13
13
|
|
14
|
+
it "gets all boards" do
|
15
|
+
Member.stub_chain(:find, :username).and_return "testuser"
|
16
|
+
Client.stub(:get).with("/members/testuser/boards").and_return boards_payload
|
17
|
+
|
18
|
+
expected = Board.new(boards_details.first)
|
19
|
+
Board.all.first.should eq(expected)
|
20
|
+
end
|
21
|
+
|
14
22
|
context "fields" do
|
15
23
|
it "gets an id" do
|
16
24
|
@board.id.should_not be_nil
|
@@ -51,6 +59,14 @@ module Trello
|
|
51
59
|
end
|
52
60
|
end
|
53
61
|
|
62
|
+
context "find_card" do
|
63
|
+
it "gets a card" do
|
64
|
+
Client.stub(:get).with("/boards/abcdef123456789123456789/cards/1").
|
65
|
+
and_return card_payload
|
66
|
+
@board.find_card(1).should be_a(Card)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
54
70
|
context "lists" do
|
55
71
|
it "has a list of lists" do
|
56
72
|
Client.stub(:get).with("/boards/abcdef123456789123456789/lists", hash_including(:filter => :open)).
|
@@ -115,33 +131,33 @@ module Trello
|
|
115
131
|
include Helpers
|
116
132
|
|
117
133
|
let(:any_board_json) do
|
118
|
-
JSON.generate(boards_details.first)
|
134
|
+
JSON.generate(boards_details.first)
|
119
135
|
end
|
120
136
|
|
121
137
|
it "cannot currently save a new instance" do
|
122
138
|
Client.should_not_receive :put
|
123
|
-
|
139
|
+
|
124
140
|
the_new_board = Board.new
|
125
141
|
lambda{the_new_board.save}.should raise_error
|
126
142
|
end
|
127
143
|
|
128
144
|
it "puts all fields except id" do
|
129
145
|
expected_fields = %w{name description closed}.map{|s| s.to_sym}
|
130
|
-
|
146
|
+
|
131
147
|
Client.should_receive(:put) do |anything, body|
|
132
148
|
body.keys.should =~ expected_fields
|
133
149
|
any_board_json
|
134
150
|
end
|
135
|
-
|
151
|
+
|
136
152
|
the_new_board = Board.new 'id' => "xxx"
|
137
153
|
the_new_board.save
|
138
154
|
end
|
139
155
|
|
140
156
|
it "mutates the current instance" do
|
141
157
|
Client.stub(:put).and_return any_board_json
|
142
|
-
|
158
|
+
|
143
159
|
board = Board.new 'id' => "xxx"
|
144
|
-
|
160
|
+
|
145
161
|
the_result_of_save = board.save
|
146
162
|
|
147
163
|
the_result_of_save.should equal board
|
@@ -154,19 +170,19 @@ module Trello
|
|
154
170
|
path.should =~ /#{expected_resource_id}\/$/
|
155
171
|
any_board_json
|
156
172
|
end
|
157
|
-
|
173
|
+
|
158
174
|
the_new_board = Board.new 'id' => expected_resource_id
|
159
175
|
the_new_board.save
|
160
|
-
end
|
176
|
+
end
|
161
177
|
|
162
178
|
it "saves OR updates depending on whether or not it has an id set"
|
163
179
|
end
|
164
|
-
|
180
|
+
|
165
181
|
describe "Repository" do
|
166
182
|
include Helpers
|
167
183
|
|
168
184
|
let(:any_board_json) do
|
169
|
-
JSON.generate(boards_details.first)
|
185
|
+
JSON.generate(boards_details.first)
|
170
186
|
end
|
171
187
|
|
172
188
|
it "creates a new board with whatever attributes are supplied " do
|
@@ -190,7 +206,7 @@ module Trello
|
|
190
206
|
the_new_board = Board.create :xxx => ""
|
191
207
|
the_new_board.should be_a Board
|
192
208
|
end
|
193
|
-
|
209
|
+
|
194
210
|
it "at least name is required"
|
195
211
|
end
|
196
212
|
end
|
data/spec/card_spec.rb
CHANGED
@@ -32,7 +32,7 @@ module Trello
|
|
32
32
|
:name => 'Test Card',
|
33
33
|
:desc => '',
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
result = JSON.generate(cards_details.first.merge(payload.merge(:idList => lists_details.first['id'])))
|
37
37
|
|
38
38
|
expected_payload = {:name => "Test Card", :desc => nil, :idList => "abcdef123456789123456789"}
|
@@ -48,7 +48,7 @@ module Trello
|
|
48
48
|
context "updating" do
|
49
49
|
it "updating name does a put on the correct resource with the correct value" do
|
50
50
|
expected_new_name = "xxx"
|
51
|
-
|
51
|
+
|
52
52
|
payload = {
|
53
53
|
:name => expected_new_name,
|
54
54
|
:desc => "Awesome things are awesome.",
|
@@ -56,7 +56,8 @@ module Trello
|
|
56
56
|
:closed => false,
|
57
57
|
:idList => "abcdef123456789123456789",
|
58
58
|
:idBoard => "abcdef123456789123456789",
|
59
|
-
:idMembers => ["abcdef123456789123456789"]
|
59
|
+
:idMembers => ["abcdef123456789123456789"],
|
60
|
+
:pos => 12
|
60
61
|
}
|
61
62
|
|
62
63
|
Client.should_receive(:put).once.with("/cards/abcdef123456789123456789", payload)
|
@@ -130,6 +131,21 @@ module Trello
|
|
130
131
|
Client.should_receive(:put).with("/cards/abcdef123456789123456789/idList", payload)
|
131
132
|
@card.move_to_list(other_list)
|
132
133
|
end
|
134
|
+
|
135
|
+
it 'can be moved to another board' do
|
136
|
+
other_board = stub(:id => '987654321987654321fedcba')
|
137
|
+
payload = {:value => other_board.id}
|
138
|
+
Client.should_receive(:put).with("/cards/abcdef123456789123456789/idBoard", payload)
|
139
|
+
@card.move_to_board(other_board)
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'can be moved to a list on another board' do
|
143
|
+
other_board = stub(:id => '987654321987654321fedcba')
|
144
|
+
other_list = stub(:id => '987654321987654321aalist')
|
145
|
+
payload = {:value => other_board.id, :idList => other_list.id}
|
146
|
+
Client.should_receive(:put).with("/cards/abcdef123456789123456789/idBoard", payload)
|
147
|
+
@card.move_to_board(other_board, other_list)
|
148
|
+
end
|
133
149
|
end
|
134
150
|
|
135
151
|
context "members" do
|
@@ -162,7 +178,7 @@ module Trello
|
|
162
178
|
Client.should_receive(:post).
|
163
179
|
with("/cards/abcdef123456789123456789/actions/comments", { :text => 'testing' }).
|
164
180
|
and_return JSON.generate(boards_details.first)
|
165
|
-
|
181
|
+
|
166
182
|
@card.add_comment "testing"
|
167
183
|
end
|
168
184
|
end
|
@@ -209,5 +225,80 @@ module Trello
|
|
209
225
|
@card.errors.full_messages.to_sentence.should == "Label colour 'mauve' does not exist"
|
210
226
|
end
|
211
227
|
end
|
228
|
+
|
229
|
+
context "attachments" do
|
230
|
+
it "can add an attachment" do
|
231
|
+
f = File.new('spec/list_spec.rb', 'r')
|
232
|
+
Client.stub(:get).with("/cards/abcdef123456789123456789/attachments").and_return attachments_payload
|
233
|
+
Client.stub(:post).with("/cards/abcdef123456789123456789/attachments",
|
234
|
+
{ :file => f, :name => '' }).
|
235
|
+
and_return "not important"
|
236
|
+
|
237
|
+
@card.add_attachment(f)
|
238
|
+
|
239
|
+
@card.errors.should be_empty
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
it "can add another attachment" do
|
244
|
+
f = File.new('spec/list_spec.rb', 'r')
|
245
|
+
card = Card.new(cards_details.first)
|
246
|
+
before_count = card.attachments.count
|
247
|
+
card.add_attachment(f)
|
248
|
+
after_count = card.attachments.count
|
249
|
+
after_count.should be > before_count
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
it "can list the existing attachments" do
|
254
|
+
Client.stub(:get).with("/boards/abcdef123456789123456789").and_return JSON.generate(boards_details.first)
|
255
|
+
Client.stub(:get).with("/cards/abcdef123456789123456789/attachments").and_return attachments_payload
|
256
|
+
|
257
|
+
@card.board.should_not be_nil
|
258
|
+
@card.attachments.should_not be_nil
|
259
|
+
end
|
260
|
+
|
261
|
+
it "can remove an attachment" do
|
262
|
+
Client.stub(:delete).with("/cards/abcdef123456789123456789/attachments/abcdef123456789123456789").
|
263
|
+
and_return "not important"
|
264
|
+
Client.stub(:get).with("/cards/abcdef123456789123456789/attachments").and_return attachments_payload
|
265
|
+
|
266
|
+
@card.remove_attachment(@card.attachments.first)
|
267
|
+
@card.errors.should be_empty
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
describe "#closed?" do
|
272
|
+
it "returns the closed attribute" do
|
273
|
+
@card.closed?.should_not be_true
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
describe "#close" do
|
278
|
+
it "updates the close attribute to true" do
|
279
|
+
@card.close
|
280
|
+
@card.closed.should be_true
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
describe "#close!" do
|
285
|
+
it "updates the close attribute to true and saves the list" do
|
286
|
+
payload = {
|
287
|
+
:name => @card.name,
|
288
|
+
:desc => "Awesome things are awesome.",
|
289
|
+
:due => nil,
|
290
|
+
:closed => true,
|
291
|
+
:idList => "abcdef123456789123456789",
|
292
|
+
:idBoard => "abcdef123456789123456789",
|
293
|
+
:idMembers => ["abcdef123456789123456789"],
|
294
|
+
:pos => 12
|
295
|
+
}
|
296
|
+
|
297
|
+
Client.should_receive(:put).once.with("/cards/abcdef123456789123456789", payload)
|
298
|
+
|
299
|
+
@card.close!
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
212
303
|
end
|
213
304
|
end
|
@@ -16,7 +16,7 @@ module IntegrationTest
|
|
16
16
|
before :all do
|
17
17
|
# Getting developer/member key
|
18
18
|
# 1. https://trello.com/1/appKey/generate
|
19
|
-
# 2. https://trello.com/1/
|
19
|
+
# 2. https://trello.com/1/authorize?key=<public_key_here>&name=RubyTrelloIntegrationTests&response_type=token
|
20
20
|
# See: https://trello.com/board/trello-public-api/4ed7e27fe6abb2517a21383d
|
21
21
|
|
22
22
|
@developer_public_key = ENV["DEVELOPER_PUBLIC_KEY"]
|
data/spec/list_spec.rb
CHANGED
@@ -11,6 +11,21 @@ module Trello
|
|
11
11
|
@list = List.find("abcdef123456789123456789")
|
12
12
|
end
|
13
13
|
|
14
|
+
context "updating" do
|
15
|
+
it "updating name does a put on the correct resource with the correct value" do
|
16
|
+
expected_new_name = "xxx"
|
17
|
+
|
18
|
+
payload = {
|
19
|
+
:name => expected_new_name,
|
20
|
+
:closed => false
|
21
|
+
}
|
22
|
+
|
23
|
+
Client.should_receive(:put).once.with("/lists/abcdef123456789123456789", payload)
|
24
|
+
@list.name = expected_new_name
|
25
|
+
@list.save
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
14
29
|
context "fields" do
|
15
30
|
it "gets its id" do
|
16
31
|
@list.id.should == lists_details.first['id']
|
@@ -43,8 +58,28 @@ module Trello
|
|
43
58
|
end
|
44
59
|
end
|
45
60
|
|
46
|
-
|
47
|
-
|
61
|
+
describe "#closed?" do
|
62
|
+
it "returns the closed attribute" do
|
63
|
+
@list.closed?.should_not be_true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#close" do
|
68
|
+
it "updates the close attribute to true" do
|
69
|
+
@list.close
|
70
|
+
@list.closed.should be_true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#close!" do
|
75
|
+
it "updates the close attribute to true and saves the list" do
|
76
|
+
Client.should_receive(:put).once.with("/lists/abcdef123456789123456789", {
|
77
|
+
:name => @list.name,
|
78
|
+
:closed => true
|
79
|
+
})
|
80
|
+
|
81
|
+
@list.close!
|
82
|
+
end
|
48
83
|
end
|
49
84
|
end
|
50
85
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -100,14 +100,31 @@ module Helpers
|
|
100
100
|
"idList" => "abcdef123456789123456789",
|
101
101
|
"idBoard" => "abcdef123456789123456789",
|
102
102
|
"idMembers" => ["abcdef123456789123456789"],
|
103
|
-
"url" => "https://trello.com/card/board/specify-the-type-and-scope-of-the-jit-in-a-lightweight-spec/abcdef123456789123456789/abcdef123456789123456789"
|
103
|
+
"url" => "https://trello.com/card/board/specify-the-type-and-scope-of-the-jit-in-a-lightweight-spec/abcdef123456789123456789/abcdef123456789123456789",
|
104
|
+
"pos" => 12
|
104
105
|
}]
|
105
106
|
end
|
106
107
|
|
108
|
+
|
107
109
|
def cards_payload
|
108
110
|
JSON.generate(cards_details)
|
109
111
|
end
|
110
112
|
|
113
|
+
def attachments_details
|
114
|
+
[{
|
115
|
+
"id" => "abcdef123456789123456789",
|
116
|
+
"name" => "list_spec.rb"
|
117
|
+
}]
|
118
|
+
end
|
119
|
+
|
120
|
+
def attachments_payload
|
121
|
+
JSON.generate(attachments_details)
|
122
|
+
end
|
123
|
+
|
124
|
+
def card_payload
|
125
|
+
JSON.generate(cards_details.first)
|
126
|
+
end
|
127
|
+
|
111
128
|
def orgs_details
|
112
129
|
[{
|
113
130
|
"id" => "abcdef123456789123456789",
|
metadata
CHANGED
@@ -1,103 +1,111 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-trello
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 125
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
- 4
|
10
|
+
- 1
|
11
|
+
version: 0.4.4.1
|
6
12
|
platform: ruby
|
7
|
-
authors:
|
13
|
+
authors:
|
8
14
|
- Jeremy Tregunna
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.4.5
|
22
|
-
type: :runtime
|
18
|
+
|
19
|
+
date: 2012-02-14 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activemodel
|
23
23
|
prerelease: false
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: addressable
|
27
|
-
requirement: &70238713000320 !ruby/object:Gem::Requirement
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
25
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
33
|
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: addressable
|
34
37
|
prerelease: false
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rest-client
|
38
|
-
requirement: &70238712998560 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
|
-
requirements:
|
40
|
+
requirements:
|
41
41
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 5
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 3
|
47
|
+
version: "2.3"
|
44
48
|
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: json
|
45
52
|
prerelease: false
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: activemodel
|
49
|
-
requirement: &70238712998000 !ruby/object:Gem::Requirement
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
54
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
55
62
|
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: oauth
|
56
66
|
prerelease: false
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: bundler
|
60
|
-
requirement: &70238712996920 !ruby/object:Gem::Requirement
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
61
68
|
none: false
|
62
|
-
requirements:
|
69
|
+
requirements:
|
63
70
|
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 5
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
- 4
|
76
|
+
- 5
|
77
|
+
version: 0.4.5
|
78
|
+
type: :runtime
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rest-client
|
67
82
|
prerelease: false
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: &70238712996080 !ruby/object:Gem::Requirement
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
72
84
|
none: false
|
73
|
-
requirements:
|
85
|
+
requirements:
|
74
86
|
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
requirements:
|
85
|
-
- - ! '>='
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: *70238712995480
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 1
|
89
|
+
segments:
|
90
|
+
- 1
|
91
|
+
- 6
|
92
|
+
- 7
|
93
|
+
version: 1.6.7
|
94
|
+
type: :runtime
|
95
|
+
version_requirements: *id005
|
91
96
|
description: A wrapper around the trello.com API.
|
92
97
|
email: jeremy@tregunna.ca
|
93
98
|
executables: []
|
99
|
+
|
94
100
|
extensions: []
|
95
|
-
|
101
|
+
|
102
|
+
extra_rdoc_files:
|
96
103
|
- README.md
|
97
|
-
files:
|
104
|
+
files:
|
98
105
|
- lib/trello/action.rb
|
99
106
|
- lib/trello/association.rb
|
100
107
|
- lib/trello/association_proxy.rb
|
108
|
+
- lib/trello/attachment.rb
|
101
109
|
- lib/trello/authorization.rb
|
102
110
|
- lib/trello/basic_data.rb
|
103
111
|
- lib/trello/board.rb
|
@@ -139,30 +147,40 @@ files:
|
|
139
147
|
- spec/token_spec.rb
|
140
148
|
homepage: https://github.com/jeremytregunna/ruby-trello
|
141
149
|
licenses: []
|
150
|
+
|
142
151
|
post_install_message:
|
143
|
-
rdoc_options:
|
152
|
+
rdoc_options:
|
144
153
|
- --charset=UTF-8
|
145
|
-
require_paths:
|
154
|
+
require_paths:
|
146
155
|
- lib
|
147
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
157
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
153
|
-
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
hash: 3
|
162
|
+
segments:
|
163
|
+
- 0
|
164
|
+
version: "0"
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
166
|
none: false
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 23
|
171
|
+
segments:
|
172
|
+
- 1
|
173
|
+
- 3
|
174
|
+
- 6
|
158
175
|
version: 1.3.6
|
159
176
|
requirements: []
|
177
|
+
|
160
178
|
rubyforge_project: ruby-trello
|
161
|
-
rubygems_version: 1.8.
|
179
|
+
rubygems_version: 1.8.24
|
162
180
|
signing_key:
|
163
181
|
specification_version: 3
|
164
182
|
summary: A wrapper around the trello.com API.
|
165
|
-
test_files:
|
183
|
+
test_files:
|
166
184
|
- spec/action_spec.rb
|
167
185
|
- spec/basic_auth_policy_spec.rb
|
168
186
|
- spec/board_spec.rb
|