Class: Disqussion::Threads
- Defined in:
- lib/disqussion/client/threads.rb
Instance Method Summary collapse
-
#close(*args) ⇒ Hashie::Rash
Closes a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/close.json.
-
#create(*args) ⇒ Hashie::Rash
@accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/create.json.
-
#details(*args) ⇒ Hashie::Rash
Returns thread details.
-
#list(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by the date created.
-
#listHot(*args) ⇒ Hashie::Rash
BETA Returns a list of threads sorted by hotness (date and likes).
-
#listMostLiked(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by number of likes.
-
#listPopular(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by number of posts made since "interval".
-
#listPosts(*args) ⇒ Hashie::Rash
Returns a list of posts within a thread.
-
#open(*args) ⇒ Hashie::Rash
Opens a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/open.json.
-
#remove(*args) ⇒ Hashie::Rash
Removes a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/remove.json.
-
#restore(*args) ⇒ Hashie::Rash
Restores a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/restore.json.
-
#set(*args) ⇒ Object
Returns an unsorted set of threads given a list of ids.
- #subscribe(*args) ⇒ Object
- #unsubscribe(*args) ⇒ Object
-
#vote(*args) ⇒ Hashie::Rash
Register a vote on a thread.
Methods included from Request
Instance Method Details
#close(*args) ⇒ Hashie::Rash
Closes a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/close.json
45 46 47 48 49 50 |
# File 'lib/disqussion/client/threads.rb', line 45 def close(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = post('threads/close', ) end |
#create(*args) ⇒ Hashie::Rash
@accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/create.json
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/disqussion/client/threads.rb', line 22 def create(*args) = args.last.is_a?(Hash) ? args.pop : {} if args.length == 2 .merge!(:forum => args[0]) .merge!(:title => args[1]) response = post('threads/create', ) else puts "#{Kernel.caller.first}: threads.create expects 2 arguments: forum name (aka forum short name) and title for the thread" end end |
#details(*args) ⇒ Hashie::Rash
Returns thread details. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/details.json
66 67 68 69 70 71 |
# File 'lib/disqussion/client/threads.rb', line 66 def details(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = get('threads/details', ) end |
#list(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by the date created. @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/list.json
94 95 96 97 |
# File 'lib/disqussion/client/threads.rb', line 94 def list(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('threads/list', ) end |
#listHot(*args) ⇒ Hashie::Rash
BETA Returns a list of threads sorted by hotness (date and likes). @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/listHot.json
138 139 140 141 |
# File 'lib/disqussion/client/threads.rb', line 138 def listHot(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('threads/listHot', ) end |
#listMostLiked(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by number of likes. @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/listMostLiked.json
116 117 118 119 |
# File 'lib/disqussion/client/threads.rb', line 116 def listMostLiked(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('threads/listMostLiked', ) end |
#listPopular(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by number of posts made since "interval". If you are using both "category" and "forum" parameters, the forum of the category must match that as the parameter value for "forum". @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/listPopular.json
160 161 162 163 |
# File 'lib/disqussion/client/threads.rb', line 160 def listPopular(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('threads/listPopular', ) end |
#listPosts(*args) ⇒ Hashie::Rash
Returns a list of posts within a thread. @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/listPosts.json
185 186 187 188 189 190 |
# File 'lib/disqussion/client/threads.rb', line 185 def listPosts(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = get('threads/listPosts', ) end |
#open(*args) ⇒ Hashie::Rash
Opens a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/open.json
204 205 206 207 208 209 |
# File 'lib/disqussion/client/threads.rb', line 204 def open(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = post('threads/open', ) end |
#remove(*args) ⇒ Hashie::Rash
Removes a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/remove.json
223 224 225 226 227 228 |
# File 'lib/disqussion/client/threads.rb', line 223 def remove(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = post('threads/remove', ) end |
#restore(*args) ⇒ Hashie::Rash
Restores a thread @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/restore.json
242 243 244 245 246 247 |
# File 'lib/disqussion/client/threads.rb', line 242 def restore(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = post('threads/restore', ) end |
#set(*args) ⇒ Object
Returns an unsorted set of threads given a list of ids. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/threads/set.json
260 261 262 263 264 265 |
# File 'lib/disqussion/client/threads.rb', line 260 def set(*args) = args.last.is_a?(Hash) ? args.pop : {} thread = args.first .merge!(:thread => thread) if ([:ident, :link] & .keys).empty? response = get('threads/set', ) end |
#subscribe(*args) ⇒ Object
267 268 269 270 |
# File 'lib/disqussion/client/threads.rb', line 267 def subscribe(*args) = args.last.is_a?(Hash) ? args.pop : {} response = post('threads/subscribe', ) end |
#unsubscribe(*args) ⇒ Object
272 273 274 275 |
# File 'lib/disqussion/client/threads.rb', line 272 def unsubscribe(*args) = args.last.is_a?(Hash) ? args.pop : {} response = post('threads/unsubscribe', ) end |
#vote(*args) ⇒ Hashie::Rash
Register a vote on a thread. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/threads/vote.json
314 315 316 317 318 319 320 321 322 323 |
# File 'lib/disqussion/client/threads.rb', line 314 def vote(*args) = args.last.is_a?(Hash) ? args.pop : {} if args.length == 2 .merge!(:vote => args[0]) .merge!(:thread => args[1]) if ([:ident, :link] & .keys).empty? response = post('threads/vote', ) else puts "#{Kernel.caller.first}: threads.vote expects 2 arguments: vote([-1..1]), thread (you may pass use the 'ident' or 'link' query types instead of an thread ID by including :forum)" end end |