ruby-trello 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/trello/card.rb +12 -4
- data/lib/trello/checklist.rb +1 -1
- data/lib/trello/core_ext/string.rb +2 -2
- data/spec/board_spec.rb +1 -1
- data/spec/card_spec.rb +11 -3
- data/spec/list_spec.rb +2 -2
- data/spec/member_spec.rb +2 -2
- data/spec/webhook_spec.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83302feba110fb6f1a0d44ef350f853bfbee2dda
|
4
|
+
data.tar.gz: d1130c82f391fc9ee317a27efcfa7e24cca4333c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6583fbca2e0d7e6c5ec70dab5128cc140c15292eefc4f793b0022fce03ea691d86bf38ad6651a44af924134d044b6a25c40cbcefbb3100cc0a116e04fa634eb4
|
7
|
+
data.tar.gz: 388cff3c894fb1ca3f6e42892a2df385792484967503da6cd7992a05520f1177457ceee486d040165a2c5ed4c3a9052b7fb2283f036abf6701fff9c9d2201a38
|
data/README.md
CHANGED
@@ -25,6 +25,8 @@ illustrate that future versions may include ruby 1.9.3+ specific features.
|
|
25
25
|
Basic authorization
|
26
26
|
|
27
27
|
```ruby
|
28
|
+
require 'trello'
|
29
|
+
|
28
30
|
Trello.configure do |config|
|
29
31
|
config.developer_public_key = TRELLO_DEVELOPER_PUBLIC_KEY
|
30
32
|
config.member_token = TRELLO_MEMBER_TOKEN
|
data/lib/trello/card.rb
CHANGED
@@ -2,7 +2,7 @@ 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
4
|
register_attributes :id, :short_id, :name, :desc, :due, :closed, :url, :short_url,
|
5
|
-
:board_id, :member_ids, :list_id, :pos, :last_activity_date, :card_labels,
|
5
|
+
:board_id, :member_ids, :list_id, :pos, :last_activity_date, :card_labels,
|
6
6
|
:cover_image_id, :badges, :card_members,
|
7
7
|
:readonly => [ :id, :short_id, :url, :short_url, :last_activity_date, :badges, :card_members ]
|
8
8
|
validates_presence_of :id, :name, :list_id
|
@@ -44,7 +44,9 @@ module Trello
|
|
44
44
|
'idList' => options[:list_id],
|
45
45
|
'desc' => options[:desc],
|
46
46
|
'idMembers' => options[:member_ids],
|
47
|
-
'labels' => options[:card_labels]
|
47
|
+
'labels' => options[:card_labels],
|
48
|
+
'due' => options[:due],
|
49
|
+
'pos' => options[:pos]
|
48
50
|
)
|
49
51
|
end
|
50
52
|
end
|
@@ -65,7 +67,7 @@ module Trello
|
|
65
67
|
attributes[:board_id] = fields[SYMBOL_TO_STRING[:board_id]]
|
66
68
|
attributes[:member_ids] = fields[SYMBOL_TO_STRING[:member_ids]]
|
67
69
|
attributes[:list_id] = fields[SYMBOL_TO_STRING[:list_id]]
|
68
|
-
attributes[:pos] = fields[SYMBOL_TO_STRING[:
|
70
|
+
attributes[:pos] = fields[SYMBOL_TO_STRING[:pos]]
|
69
71
|
attributes[:card_labels] = fields[SYMBOL_TO_STRING[:card_labels]]
|
70
72
|
attributes[:last_activity_date] = Time.iso8601(fields[SYMBOL_TO_STRING[:last_activity_date]]) rescue nil
|
71
73
|
attributes[:cover_image_id] = fields[SYMBOL_TO_STRING[:cover_image_id]]
|
@@ -113,7 +115,8 @@ module Trello
|
|
113
115
|
desc: desc,
|
114
116
|
idList: list_id,
|
115
117
|
idMembers: member_ids,
|
116
|
-
labels: card_labels
|
118
|
+
labels: card_labels,
|
119
|
+
pos: pos
|
117
120
|
}).json_into(self)
|
118
121
|
end
|
119
122
|
|
@@ -166,6 +169,11 @@ module Trello
|
|
166
169
|
})
|
167
170
|
end
|
168
171
|
|
172
|
+
# create a new checklist and add it to this card
|
173
|
+
def create_new_checklist(name)
|
174
|
+
client.post("/cards/#{id}/checklists", { name: name })
|
175
|
+
end
|
176
|
+
|
169
177
|
# Move this card to the given list
|
170
178
|
def move_to_list(list)
|
171
179
|
list_number = list.is_a?(String) ? list : list.id
|
data/lib/trello/checklist.rb
CHANGED
@@ -30,7 +30,7 @@ module Trello
|
|
30
30
|
attributes[:closed] = fields['closed']
|
31
31
|
attributes[:url] = fields['url']
|
32
32
|
attributes[:check_items] = fields['checkItems']
|
33
|
-
attributes[:position] = fields['
|
33
|
+
attributes[:position] = fields['pos']
|
34
34
|
attributes[:board_id] = fields['idBoard']
|
35
35
|
attributes[:list_id] = fields['idList']
|
36
36
|
attributes[:member_ids] = fields['idMembers']
|
@@ -15,8 +15,8 @@ class String
|
|
15
15
|
# thing = '{"a":42,"b":"foo"}'.json_into(Stuff)
|
16
16
|
# thing.a == 42
|
17
17
|
# thing.b == "foo"
|
18
|
-
def json_into(obj)
|
19
|
-
data = JSON.parse(self)
|
18
|
+
def json_into(obj, encoding = 'UTF-8')
|
19
|
+
data = JSON.parse(self.force_encoding(encoding))
|
20
20
|
data.jsoned_into(obj)
|
21
21
|
rescue JSON::ParserError => json_error
|
22
22
|
if json_error.message =~ /model not found/
|
data/spec/board_spec.rb
CHANGED
data/spec/card_spec.rb
CHANGED
@@ -148,10 +148,18 @@ module Trello
|
|
148
148
|
end
|
149
149
|
|
150
150
|
context "checklists" do
|
151
|
-
|
151
|
+
before(:each) do
|
152
152
|
client.stub(:get).with("/cards/abcdef123456789123456789/checklists", { :filter => :all }).and_return checklists_payload
|
153
|
+
end
|
154
|
+
|
155
|
+
it "has a list of checklists" do
|
153
156
|
card.checklists.count.should be > 0
|
154
157
|
end
|
158
|
+
|
159
|
+
it "creates a new checklist for the card" do
|
160
|
+
client.should_receive(:post).with("/cards/abcdef123456789123456789/checklists", name: "new checklist")
|
161
|
+
card.create_new_checklist("new checklist")
|
162
|
+
end
|
155
163
|
end
|
156
164
|
|
157
165
|
context "list" do
|
@@ -322,14 +330,14 @@ module Trello
|
|
322
330
|
|
323
331
|
describe "#closed?" do
|
324
332
|
it "returns the closed attribute" do
|
325
|
-
card.closed
|
333
|
+
expect(card.closed?).to be(false)
|
326
334
|
end
|
327
335
|
end
|
328
336
|
|
329
337
|
describe "#close" do
|
330
338
|
it "updates the close attribute to true" do
|
331
339
|
card.close
|
332
|
-
card.closed.
|
340
|
+
expect(card.closed).to be(true)
|
333
341
|
end
|
334
342
|
end
|
335
343
|
|
data/spec/list_spec.rb
CHANGED
@@ -114,14 +114,14 @@ module Trello
|
|
114
114
|
|
115
115
|
describe '#closed?' do
|
116
116
|
it 'returns the closed attribute' do
|
117
|
-
list.closed
|
117
|
+
expect(list.closed?).not_to be(true)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
121
|
describe '#close' do
|
122
122
|
it 'updates the close attribute to true' do
|
123
123
|
list.close
|
124
|
-
list.closed.
|
124
|
+
expect(list.closed).to be(true)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
data/spec/member_spec.rb
CHANGED
@@ -101,9 +101,9 @@ module Trello
|
|
101
101
|
|
102
102
|
context 'modification' do
|
103
103
|
it 'lets us know a field has changed without committing it' do
|
104
|
-
member.changed
|
104
|
+
expect(member.changed?).to be(false)
|
105
105
|
member.bio = 'New and amazing'
|
106
|
-
member.changed
|
106
|
+
expect(member.changed?).to be(true)
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'does not understand the #id= method' do
|
data/spec/webhook_spec.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Tregunna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.7.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.7.2
|
83
83
|
description: A wrapper around the trello.com API.
|
84
84
|
email: jeremy@tregunna.ca
|
85
85
|
executables: []
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: 1.3.6
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project: ruby-trello
|
166
|
-
rubygems_version: 2.0.
|
166
|
+
rubygems_version: 2.0.14
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: A wrapper around the trello.com API.
|