ruby-trello 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/trello/card.rb +18 -2
  2. data/lib/trello/checklist.rb +23 -0
  3. metadata +106 -52
data/lib/trello/card.rb CHANGED
@@ -102,9 +102,18 @@ module Trello
102
102
  end
103
103
 
104
104
  # Update an existing record.
105
+ # Warning, this updates all fields using values already in memory. If
106
+ # an external resource has updated these fields, you should refresh!
107
+ # this object before making your changes, and before updating the record.
105
108
  def update!
106
- # Trello doesn't support this yet. But Daniel is working on it as I
107
- # place this comment here!
109
+ Client.put("/cards/#{@id}", {
110
+ :name => @name,
111
+ :desc => @description,
112
+ :closed => @closed,
113
+ :idList => @list_id,
114
+ :idBoard => @board_id,
115
+ :idMembers => @member_ids
116
+ }).json_into(self)
108
117
  end
109
118
 
110
119
  # Is the record valid?
@@ -116,5 +125,12 @@ module Trello
116
125
  def add_comment(text)
117
126
  Client.post("/cards/#{id}/actions/comments", :text => text)
118
127
  end
128
+
129
+ # Add a checklist to this card
130
+ def add_checklist(checklist)
131
+ Client.post("/cards/#{id}/checklists", {
132
+ :value => checklist.id
133
+ })
134
+ end
119
135
  end
120
136
  end
@@ -8,6 +8,11 @@ module Trello
8
8
  def find(id)
9
9
  super(:checklists, id)
10
10
  end
11
+
12
+ def create(options)
13
+ new('name' => options[:name],
14
+ 'idBoard' => options[:board_id]).save!
15
+ end
11
16
  end
12
17
 
13
18
  # Update the fields of a checklist.
@@ -31,6 +36,19 @@ module Trello
31
36
  closed
32
37
  end
33
38
 
39
+ # Save a record.
40
+ def save!
41
+ return update! if id
42
+
43
+ Client.post("/checklists", {
44
+ :name => @name,
45
+ :idBoard => @board_id
46
+ })
47
+ end
48
+
49
+ def update!
50
+ end
51
+
34
52
  # Return a list of items on the checklist.
35
53
  def items
36
54
  return @items if @items
@@ -60,5 +78,10 @@ module Trello
60
78
  Member.find(member_id)
61
79
  end
62
80
  end
81
+
82
+ # Add an item to the checklist
83
+ def add_item(name)
84
+ Client.post("/checklists/#{id}/checkItems", { :name => name })
85
+ end
63
86
  end
64
87
  end
metadata CHANGED
@@ -1,67 +1,112 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-trello
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 4135067353417607739
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 1
10
+ version: 0.3.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Jeremy Tregunna
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-01-07 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-01-07 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: yajl-ruby
16
- requirement: &70257771954980 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3461773182973075480
29
+ segments:
30
+ - 1
31
+ - 1
32
+ - 0
21
33
  version: 1.1.0
22
34
  type: :runtime
23
- prerelease: false
24
- version_requirements: *70257771954980
25
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
26
37
  name: oauth
27
- requirement: &70257771954200 !ruby/object:Gem::Requirement
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
28
40
  none: false
29
- requirements:
41
+ requirements:
30
42
  - - ~>
31
- - !ruby/object:Gem::Version
43
+ - !ruby/object:Gem::Version
44
+ hash: 3072838298281563226
45
+ segments:
46
+ - 0
47
+ - 4
48
+ - 5
32
49
  version: 0.4.5
33
50
  type: :runtime
34
- prerelease: false
35
- version_requirements: *70257771954200
36
- - !ruby/object:Gem::Dependency
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
37
53
  name: addressable
38
- requirement: &70257771953700 !ruby/object:Gem::Requirement
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
39
56
  none: false
40
- requirements:
57
+ requirements:
41
58
  - - ~>
42
- - !ruby/object:Gem::Version
59
+ - !ruby/object:Gem::Version
60
+ hash: 1690824680571537449
61
+ segments:
62
+ - 2
63
+ - 2
64
+ - 6
43
65
  version: 2.2.6
44
66
  type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: rest-client
45
70
  prerelease: false
46
- version_requirements: *70257771953700
47
- - !ruby/object:Gem::Dependency
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 4554157976602492668
77
+ segments:
78
+ - 1
79
+ - 6
80
+ - 7
81
+ version: 1.6.7
82
+ type: :runtime
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
48
85
  name: bundler
49
- requirement: &70257771953240 !ruby/object:Gem::Requirement
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
50
88
  none: false
51
- requirements:
89
+ requirements:
52
90
  - - ~>
53
- - !ruby/object:Gem::Version
91
+ - !ruby/object:Gem::Version
92
+ hash: 2387456872237229630
93
+ segments:
94
+ - 1
95
+ - 0
96
+ - 0
54
97
  version: 1.0.0
55
98
  type: :development
56
- prerelease: false
57
- version_requirements: *70257771953240
99
+ version_requirements: *id005
58
100
  description: A wrapper around the trello.com API.
59
101
  email: jeremy@tregunna.ca
60
102
  executables: []
103
+
61
104
  extensions: []
62
- extra_rdoc_files:
105
+
106
+ extra_rdoc_files:
63
107
  - README.md
64
- files:
108
+ files:
109
+ - lib/trello.rb
65
110
  - lib/trello/action.rb
66
111
  - lib/trello/authorization.rb
67
112
  - lib/trello/basic_data.rb
@@ -77,7 +122,6 @@ files:
77
122
  - lib/trello/notification.rb
78
123
  - lib/trello/organization.rb
79
124
  - lib/trello/string.rb
80
- - lib/trello.rb
81
125
  - README.md
82
126
  - spec/action_spec.rb
83
127
  - spec/basic_auth_policy_spec.rb
@@ -85,9 +129,6 @@ files:
85
129
  - spec/card_spec.rb
86
130
  - spec/checklist_spec.rb
87
131
  - spec/client_spec.rb
88
- - spec/integration/how_to_authorize_spec.rb
89
- - spec/integration/how_to_use_boards_spec.rb
90
- - spec/integration/integration_test.rb
91
132
  - spec/item_spec.rb
92
133
  - spec/item_state_spec.rb
93
134
  - spec/list_spec.rb
@@ -96,41 +137,51 @@ files:
96
137
  - spec/organization_spec.rb
97
138
  - spec/spec_helper.rb
98
139
  - spec/string_spec.rb
140
+ - spec/integration/how_to_authorize_spec.rb
141
+ - spec/integration/how_to_use_boards_spec.rb
142
+ - spec/integration/integration_test.rb
99
143
  homepage: https://github.com/jeremytregunna/ruby-trello
100
144
  licenses: []
145
+
101
146
  post_install_message:
102
- rdoc_options:
147
+ rdoc_options:
103
148
  - --charset=UTF-8
104
- require_paths:
149
+ require_paths:
105
150
  - lib
106
- required_ruby_version: !ruby/object:Gem::Requirement
151
+ required_ruby_version: !ruby/object:Gem::Requirement
107
152
  none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
- required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ hash: 2002549777813010636
157
+ segments:
158
+ - 0
159
+ version: "0"
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
161
  none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ hash: 2387630629434237851
166
+ segments:
167
+ - 1
168
+ - 3
169
+ - 6
117
170
  version: 1.3.6
118
171
  requirements: []
172
+
119
173
  rubyforge_project: ruby-trello
120
- rubygems_version: 1.8.10
174
+ rubygems_version: 1.8.12
121
175
  signing_key:
122
176
  specification_version: 3
123
177
  summary: A wrapper around the trello.com API.
124
- test_files:
178
+ test_files:
125
179
  - spec/action_spec.rb
126
180
  - spec/basic_auth_policy_spec.rb
127
181
  - spec/board_spec.rb
128
182
  - spec/card_spec.rb
129
183
  - spec/checklist_spec.rb
130
184
  - spec/client_spec.rb
131
- - spec/integration/how_to_authorize_spec.rb
132
- - spec/integration/how_to_use_boards_spec.rb
133
- - spec/integration/integration_test.rb
134
185
  - spec/item_spec.rb
135
186
  - spec/item_state_spec.rb
136
187
  - spec/list_spec.rb
@@ -139,3 +190,6 @@ test_files:
139
190
  - spec/organization_spec.rb
140
191
  - spec/spec_helper.rb
141
192
  - spec/string_spec.rb
193
+ - spec/integration/how_to_authorize_spec.rb
194
+ - spec/integration/how_to_use_boards_spec.rb
195
+ - spec/integration/integration_test.rb