Permalink
Browse files

Documenting .... @wip

  • Loading branch information...
1 parent 2ee2145 commit 0989986a233de480e079f421af5d30a3a36c2ae3 Gabriel Medina committed Feb 18, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 lib/read_it_later.rb
View
@@ -83,6 +83,35 @@ def add(user, url)
@last_response = query(:add, user, :url => url)
end
+ # Send several changes to readitlaterlist.com
+ # The params hash is built as described in http://readitlaterlist.com/api/docs/#send, but in ruby a Ruby Hash.
+ # Example:
+ #
+ # params = {
+ # :new => [
+ # { :url => "http://www.url1.com/", :title => "URL New 1" },
+ # { :url => "http://www.url2.com/", :title => "URL New 2" },
+ # { :url => "http://www.url3.com/", :title => "URL New 3" }
+ # ],
+ # :read => [
+ # { :url => "http://www.url1.com/" },
+ # { :url => "http://www.url2.com/" },
+ # { :url => "http://www.url3.com/" }
+ # ],
+ # :update_title => [
+ # { :url => "http://www.url1.com/", :title => "Updated URL New 1" },
+ # { :url => "http://www.url2.com/", :title => "Updated URL New 2" },
+ # { :url => "http://www.url3.com/", :title => "Updated URL New 3" }
+ # ],
+ # :update_tags => [
+ # { :url => "http://www.url1.com/", :tags => "url1tag1, url1tag2, url1tag3" },
+ # { :url => "http://www.url2.com/", :tags => "url2tag1, url2tag2, url2tag3" },
+ # { :url => "http://www.url3.com/", :tags => "url3tag1, url3tag2, url3tag3" }
+ # ]
+ # }
+ #
+ # @param [ReadItLater::User] user The ReadItLater::User instance representing the user
+ # @param [Hash] params The changes to be sent as described in http://readitlaterlist.com/api/docs/#send, in Ruby hash format
def send(user, params)
%w(new read update_title update_tags).map(&:to_sym).each do |param|
params[param] = URI.escape((0..params[param].size-1).to_a.map{|n|{n.to_s=>params[param][n]}}.inject(){|a,b|a.merge(b)}.to_json) if params[param]

0 comments on commit 0989986

Please sign in to comment.