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.
-
#details(*args) ⇒ Hashie::Rash
Returns thread details.
-
#list(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by the date created.
-
#listMostLiked(*args) ⇒ Hashie::Rash
Returns a list of threads sorted by number of likes.
-
#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.
-
#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
15 16 17 18 19 20 |
# File 'lib/disqussion/client/threads.rb', line 15 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 |
#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
36 37 38 39 40 41 |
# File 'lib/disqussion/client/threads.rb', line 36 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
64 65 66 67 |
# File 'lib/disqussion/client/threads.rb', line 64 def list(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('threads/list', ) 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
86 87 88 89 |
# File 'lib/disqussion/client/threads.rb', line 86 def listMostLiked(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('threads/listMostLiked', ) 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
111 112 113 114 115 116 |
# File 'lib/disqussion/client/threads.rb', line 111 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
130 131 132 133 134 135 |
# File 'lib/disqussion/client/threads.rb', line 130 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
149 150 151 152 153 154 |
# File 'lib/disqussion/client/threads.rb', line 149 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
168 169 170 171 172 173 |
# File 'lib/disqussion/client/threads.rb', line 168 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 |
#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
188 189 190 191 192 193 194 195 196 197 |
# File 'lib/disqussion/client/threads.rb', line 188 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 |