Permalink
Browse files

Added `get_modqueue`, renamed modlog to get_modlog

Added changelog
  • Loading branch information...
1 parent ce83e80 commit e7d6fb54ce7f4ff1f46fe29bc41f42b59613c6cd @paradox460 committed Aug 9, 2012
Showing with 39 additions and 5 deletions.
  1. +18 −0 CHANGELOG.md
  2. +20 −4 lib/snoo/moderation.rb
  3. +1 −1 lib/snoo/version.rb
View
@@ -0,0 +1,18 @@
+# Changelog
+
+## 0.0.5
+
++ Added `get_modqueue`
++ Renamed `modlog` to `get_modlog`, to keep with convention
+
+## 0.0.4
+
++ Added `modlog` to fetch the modlog
+
+## 0.0.3
+
++ Added in cookie-based auth, use `auth` method
+
+## 0.0.2
+
++ Refactored several commands to use option hashes instead of explicit arguments
View
@@ -63,16 +63,16 @@ def remove id, spam
#
# @param subreddit [String] The subreddit to fetch from
# @param opts [Hash] Options to pass to reddit
- # @option opts [Fixnum] :count (100) The number to get. Can't be higher than 100
+ # @option opts [Fixnum] :limit (100) The number to get. Can't be higher than 100
# @option opts [String] :before The "fullname" to fetch before.
- # @option opts [String] :after The "fullname" to fetch after.
+ # @option opts [String] :after The "fullname" to fetch after (older than).
# @option opts [String] :type See [reddit API docs](http://www.reddit.com/dev/api#GET_moderationlog)
# @option opts [String] :mod The moderator to get. Name, not ID
# @return [Hash] A hash consisting of the data, first fullname, last fullname, first date, and last date
- def modlog subreddit, opts = {}
+ def get_modlog subreddit, opts = {}
logged_in?
options = {
- count: 100
+ limit: 100
}.merge opts
data = Nokogiri::HTML.parse(get("/r/#{subreddit}/about/log", query: options).body).css('.modactionlisting tr')
processed = {
@@ -95,5 +95,21 @@ def modlog subreddit, opts = {}
return processed
end
+ # Get the modqueue, or a subset of it (dear god)
+ #
+ # @param subreddit [String] The subreddit to fetch from
+ # @param opts [Hash] The options hash to pass to reddit
+ # @option opts [Fixnum] :limit (100) The total items to return. Can't go higher than 100
+ # @option opts [String] :before The thing_id to fetch before (newer than). Can be either a link (t3_) or comment (t1_)
+ # @option opts [String] :after The thing_id to fetch after (older than). Can be either a link (t3_) or comment (t1_)
+ def get_modqueue subreddit, opts={}
+ logged_in?
+ options = {
+ limit: 100
+ }.merge opts
+
+ get("/r/#{subreddit}/about/modqueue.json", query: options)
+ end
+
end
end
View
@@ -1,4 +1,4 @@
module Snoo
# The version string (duh)
- VERSION = "0.0.4"
+ VERSION = "0.0.5"
end

0 comments on commit e7d6fb5

Please sign in to comment.