Permalink
Browse files

emergency 0.3.1 release

  • Loading branch information...
1 parent e4fd2c9 commit a3736458d6deca7d8150678f45d6f0922be7bcb2 @jeremytregunna committed Feb 5, 2012
Showing with 44 additions and 4 deletions.
  1. +1 −1 Gemfile
  2. +18 −2 lib/trello/card.rb
  3. +23 −0 lib/trello/checklist.rb
  4. +2 −1 ruby-trello.gemspec
View
@@ -4,10 +4,10 @@ gem 'oauth'
gem 'addressable'
gem 'json', :platforms => [ :ruby_18, :jruby ]
gem 'jruby-openssl', :platforms => :jruby
+gem 'rest-client'
group :spec do
gem 'rspec'
gem 'simplecov', :require => false, :platforms => [ :mri, :mri_18, :mri_19, :jruby, :mingw ]
gem 'webmock'
- gem 'rest-client'
end
View
@@ -102,9 +102,18 @@ def save!
end
# Update an existing record.
+ # Warning, this updates all fields using values already in memory. If
+ # an external resource has updated these fields, you should refresh!
+ # this object before making your changes, and before updating the record.
def update!
- # Trello doesn't support this yet. But Daniel is working on it as I
- # place this comment here!
+ Client.put("/cards/#{@id}", {
+ :name => @name,
+ :desc => @description,
+ :closed => @closed,
+ :idList => @list_id,
+ :idBoard => @board_id,
+ :idMembers => @member_ids
+ }).json_into(self)
end
# Is the record valid?
@@ -116,5 +125,12 @@ def valid?
def add_comment(text)
Client.post("/cards/#{id}/actions/comments", :text => text)
end
+
+ # Add a checklist to this card
+ def add_checklist(checklist)
+ Client.post("/cards/#{id}/checklists", {
+ :value => checklist.id
+ })
+ end
end
end
@@ -8,6 +8,11 @@ class << self
def find(id)
super(:checklists, id)
end
+
+ def create(options)
+ new('name' => options[:name],
+ 'idBoard' => options[:board_id]).save!
+ end
end
# Update the fields of a checklist.
@@ -31,6 +36,19 @@ def closed?
closed
end
+ # Save a record.
+ def save!
+ return update! if id
+
+ Client.post("/checklists", {
+ :name => @name,
+ :idBoard => @board_id
+ })
+ end
+
+ def update!
+ end
+
# Return a list of items on the checklist.
def items
return @items if @items
@@ -60,5 +78,10 @@ def members
Member.find(member_id)
end
end
+
+ # Add an item to the checklist
+ def add_item(name)
+ Client.post("/checklists/#{id}/checkItems", { :name => name })
+ end
end
end
View
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{ruby-trello}
- s.version = "0.3.0"
+ s.version = "0.3.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Jeremy Tregunna"]
@@ -21,5 +21,6 @@ Gem::Specification.new do |s|
s.add_dependency 'yajl-ruby', '>= 1.1.0'
s.add_dependency 'oauth', '~> 0.4.5'
s.add_dependency 'addressable', '~> 2.2.6'
+ s.add_dependency 'rest-client', '~> 1.6.7'
s.add_development_dependency 'bundler', '~> 1.0.0'
end

0 comments on commit a373645

Please sign in to comment.