Class: Disqussion::Posts
- Defined in:
- lib/disqussion/client/posts.rb
Instance Method Summary collapse
-
#approve(*args) ⇒ Hashie::Rash
Approves a post.
-
#create(*args) ⇒ Hashie::Rash
Creates a new post.
-
#details(*args) ⇒ Hashie::Rash
Returns post details.
-
#getContext(*args) ⇒ Hashie::Rash
Returns the hierarchal tree of a post (all parents).
-
#highlight(*args) ⇒ Hashie::Rash
Highlights a post.
-
#list(*args) ⇒ Hashie::Rash
Returns a list of posts ordered by the date created.
-
#listPopular(*args) ⇒ Object
Returns a list of the most popular posts @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/posts/listPopular.json.
-
#remove(*args) ⇒ Hashie::Rash
Deletes the requested post(s).
-
#report(*args) ⇒ Hashie::Rash
Reports a post (flagging).
-
#restore(*args) ⇒ Hashie::Rash
Undeletes the requested post(s).
-
#spam(*args) ⇒ Hashie::Rash
Marks the requested post(s) as spam.
-
#unhighlight(*args) ⇒ Hashie::Rash
Unhighlights the requested post(s).
-
#update(*args) ⇒ Hashie::Rash
Updates information on a post.
-
#vote(*args) ⇒ Hashie::Rash
Register a vote for a post.
Methods included from Request
Instance Method Details
#approve(*args) ⇒ Hashie::Rash
Approves a post. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/approve.json
14 15 16 17 18 |
# File 'lib/disqussion/client/posts.rb', line 14 def approve(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/approve', ) end |
#create(*args) ⇒ Hashie::Rash
Creates a new post. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/posts/create.json
40 41 42 43 44 |
# File 'lib/disqussion/client/posts.rb', line 40 def create(*args) = args.last.is_a?(Hash) ? args.pop : {} [:message] = args.first response = post('posts/create', ) end |
#details(*args) ⇒ Hashie::Rash
Returns post details. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/posts/details.json
59 60 61 62 63 |
# File 'lib/disqussion/client/posts.rb', line 59 def details(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = get('posts/details', ) end |
#getContext(*args) ⇒ Hashie::Rash
Returns the hierarchal tree of a post (all parents). @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/posts/getContext.json
79 80 81 82 83 |
# File 'lib/disqussion/client/posts.rb', line 79 def getContext(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = get('posts/getContext', ) end |
#highlight(*args) ⇒ Hashie::Rash
Highlights a post. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/highlight.json
96 97 98 99 100 |
# File 'lib/disqussion/client/posts.rb', line 96 def highlight(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/highlight', ) end |
#list(*args) ⇒ Hashie::Rash
Returns a list of posts ordered 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/posts/list.json
124 125 126 127 |
# File 'lib/disqussion/client/posts.rb', line 124 def list(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('posts/list', ) end |
#listPopular(*args) ⇒ Object
Returns a list of the most popular posts @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/posts/listPopular.json
150 151 152 153 |
# File 'lib/disqussion/client/posts.rb', line 150 def listPopular(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('posts/listPopular', ) end |
#remove(*args) ⇒ Hashie::Rash
Deletes the requested post(s). @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/remove.json
166 167 168 169 170 |
# File 'lib/disqussion/client/posts.rb', line 166 def remove(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/remove', ) end |
#report(*args) ⇒ Hashie::Rash
Reports a post (flagging). @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/posts/report.json
183 184 185 186 187 |
# File 'lib/disqussion/client/posts.rb', line 183 def report(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/report', ) end |
#restore(*args) ⇒ Hashie::Rash
Undeletes the requested post(s). @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/restore.json
200 201 202 203 204 |
# File 'lib/disqussion/client/posts.rb', line 200 def restore(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/restore', ) end |
#spam(*args) ⇒ Hashie::Rash
Marks the requested post(s) as spam. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/spam.json
217 218 219 220 221 |
# File 'lib/disqussion/client/posts.rb', line 217 def spam(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/spam', ) end |
#unhighlight(*args) ⇒ Hashie::Rash
Unhighlights the requested post(s). @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/unhighlight.json
234 235 236 237 238 |
# File 'lib/disqussion/client/posts.rb', line 234 def unhighlight(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/unhighlight', ) end |
#update(*args) ⇒ Hashie::Rash
Updates information on a post. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/update.json
252 253 254 255 256 257 258 259 260 261 |
# File 'lib/disqussion/client/posts.rb', line 252 def update(*args) = args.last.is_a?(Hash) ? args.pop : {} if args.length == 2 .merge!(:post => args[0]) .merge!(:message => args[1]) response = post('posts/update', ) else puts "#{Kernel.caller.first}: posts.update expects 2 arguments: post ID and message" end end |
#vote(*args) ⇒ Hashie::Rash
Register a vote for a post. @accessibility: public key, secret key @methods: POST @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/posts/vote.json
275 276 277 278 279 280 281 282 283 284 |
# File 'lib/disqussion/client/posts.rb', line 275 def vote(*args) = args.last.is_a?(Hash) ? args.pop : {} if args.length == 2 .merge!(:vote => args[0]) .merge!(:post => args[1]) response = post('posts/vote', ) else puts "#{Kernel.caller.first}: posts.vote expects 2 arguments: vote([-1..1]), posts ID" end end |