Class: Disqussed::Threads
- Inherits:
-
Object
- Object
- Disqussed::Threads
- Defined in:
- lib/disqussed/threads.rb
Constant Summary collapse
- ENDPOINT =
'threads'
Class Method Summary collapse
- .create(forum = nil, title = nil, opts = {}) ⇒ Object
- .details(thread = nil) ⇒ Object
- .get_thread_id_by_ident(identifier, opts = {}) ⇒ Object
- .post_count(thread = nil) ⇒ Object
- .remove(thread = nil) ⇒ Object
- .remove_thread_by_ident(identifier, opts = {}) ⇒ Object
Class Method Details
.create(forum = nil, title = nil, opts = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/disqussed/threads.rb', line 6 def create(forum = nil, title = nil, opts = {}) opts[:forum] = forum ? forum : Disqussed::defaults[:forum] opts[:title] = title opts.slice!(:forum, :title, :identifier, :slug) Disqussed::Api.request('post', ENDPOINT, 'create', opts, true) end |
.details(thread = nil) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/disqussed/threads.rb', line 15 def details(thread = nil) opts = {} opts[:thread] = thread opts.slice!(:thread) Disqussed::Api.request('get', ENDPOINT, 'details', opts, true) end |
.get_thread_id_by_ident(identifier, opts = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/disqussed/threads.rb', line 24 def get_thread_id_by_ident(identifier, opts = {}) opts[:forum] = opts[:forum] ? opts[:forum] : Disqussed::defaults[:forum] opts.slice!(:forum) opts["thread:ident"] = identifier Disqussed::Api.request('get', ENDPOINT, 'details', opts, true) end |
.post_count(thread = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/disqussed/threads.rb', line 33 def post_count(thread = nil) opts = {} opts[:thread] = thread opts.slice!(:thread) details = Disqussed::Api.request('get', ENDPOINT, 'details', opts, true) details["response"]["posts"] end |
.remove(thread = nil) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/disqussed/threads.rb', line 44 def remove(thread = nil) opts = {} opts[:thread] = thread opts.slice!(:thread) Disqussed::Api.request('post', ENDPOINT, 'remove', opts, true) end |
.remove_thread_by_ident(identifier, opts = {}) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/disqussed/threads.rb', line 53 def remove_thread_by_ident(identifier, opts = {}) opts[:forum] = opts[:forum] ? opts[:forum] : Disqussed::defaults[:forum] opts.slice!(:forum) opts["thread:ident"] = identifier Disqussed::Api.request('post', ENDPOINT, 'remove', opts, true) end |