Skip to content

Commit

Permalink
fixed saved method, so that it requires either logged_in and user or …
Browse files Browse the repository at this point in the history
…cookie and user name to return saved items
  • Loading branch information
Anurag Mohanty committed Aug 8, 2012
1 parent c7e975a commit 88d4a25
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ruby_reddit_api/api.rb
Expand Up @@ -36,12 +36,17 @@ def browse(subreddit, options={})
end

def saved(options={})
if logged_in?
if logged_in? && !user.nil?
options.merge! :handler => "Submission"
if options[:limit]
options.merge!({:query => {:limit => options[:limit]}})
end
read("/user/#{user.to_s}/saved/.json", options )
elsif options[:cookie] && options[:user]
if options[:limit]
options.merge!({:query => {:limit => options[:limit]}})
end
read("/user/#{options[:user]}/saved/.json", options )
end
end

Expand Down

0 comments on commit 88d4a25

Please sign in to comment.