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.
-
#highlight(*args) ⇒ Hashie::Rash
Highlights a post.
-
#list(*args) ⇒ Hashie::Rash
Returns a list of posts ordered by the date created.
-
#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).
-
#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 |
#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
76 77 78 79 80 |
# File 'lib/disqussion/client/posts.rb', line 76 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
104 105 106 107 |
# File 'lib/disqussion/client/posts.rb', line 104 def list(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get('posts/list', ) 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
120 121 122 123 124 |
# File 'lib/disqussion/client/posts.rb', line 120 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
137 138 139 140 141 |
# File 'lib/disqussion/client/posts.rb', line 137 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
154 155 156 157 158 |
# File 'lib/disqussion/client/posts.rb', line 154 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
171 172 173 174 175 |
# File 'lib/disqussion/client/posts.rb', line 171 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
188 189 190 191 192 |
# File 'lib/disqussion/client/posts.rb', line 188 def unhighlight(*args) = args.last.is_a?(Hash) ? args.pop : {} [:post] = args.first response = post('posts/unhighlight', ) 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
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/disqussion/client/posts.rb', line 206 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 |