disqussion 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +17 -17
- data/README.mkd +29 -5
- data/disqussion.gemspec +1 -1
- data/lib/disqussion/client/forums.rb +39 -1
- data/lib/disqussion/client/posts.rb +69 -0
- data/lib/disqussion/client/reactions.rb +46 -0
- data/lib/disqussion/client/threads.rb +116 -0
- data/lib/disqussion/client/users.rb +63 -5
- data/lib/disqussion/version.rb +2 -2
- data/spec/disqussion/client/forums_spec.rb +40 -1
- data/spec/disqussion/client/posts_spec.rb +34 -3
- data/spec/disqussion/client/reactions_spec.rb +26 -0
- data/spec/disqussion/client/threads_spec.rb +68 -4
- data/spec/disqussion/client/users_spec.rb +36 -4
- data/spec/fixtures/forums/listModerators.json +39 -0
- data/spec/fixtures/forums/listMostActiveUsers.json +70 -0
- data/spec/fixtures/posts/getContext.json +81 -0
- data/spec/fixtures/posts/listPopular.json +114 -0
- data/spec/fixtures/posts/update.json +41 -0
- data/spec/fixtures/reactions/list.json +13 -0
- data/spec/fixtures/threads/create.json +19 -18
- data/spec/fixtures/threads/listHot.json +28 -0
- data/spec/fixtures/threads/listPopular.json +27 -0
- data/spec/fixtures/threads/set.json +26 -0
- data/spec/fixtures/threads/update.json +25 -0
- data/spec/fixtures/users/checkUsername.json +4 -0
- data/spec/fixtures/users/listFollowers.json +42 -0
- data/spec/fixtures/users/listFollowing.json +42 -0
- data/spec/fixtures/users/listMostActiveForums.json +24 -0
- metadata +39 -26
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9c6b3f1e4ce9f81d2e9a1bf2e343f5f622147ae7
|
4
|
+
data.tar.gz: 952c2da042a96d690b0c722471acf572ec18827d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d36b58e15f48613c7533e36d969c92b884af2e288032cc6a2ca6fbecdd8733f5d797f94af1939f8ab90ae77cc5e4db707da16c5a4f99d27e03b8d4b5e8c08e7e
|
7
|
+
data.tar.gz: 56673b96b2860477a2dc04beeda91612f4f1adb59b12b296cfac3303a3408ee4bbc2f5bbe9371efa3cc4efeb8e622d5e0bf012a2dfb585472ad4a054441fbb8f
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'jruby-openssl', :platforms => :jruby
|
4
4
|
gem 'rake'
|
@@ -10,10 +10,10 @@ group :development do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
group :test do
|
13
|
-
gem 'json', :platforms => :ruby_18
|
13
|
+
gem 'json', :platforms => [:ruby_18, :jruby]
|
14
14
|
gem 'rspec', '>= 2.11'
|
15
15
|
gem 'simplecov'
|
16
16
|
gem 'webmock'
|
17
17
|
end
|
18
18
|
|
19
|
-
gemspec
|
19
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
disqussion (0.0.
|
4
|
+
disqussion (0.0.7)
|
5
5
|
faraday (~> 0.8)
|
6
6
|
faraday_middleware (>= 0.9)
|
7
|
-
hashie (~>
|
7
|
+
hashie (~> 2.0)
|
8
8
|
multi_json (~> 1.5)
|
9
9
|
rash (~> 0.3)
|
10
10
|
|
11
11
|
GEM
|
12
|
-
remote:
|
12
|
+
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
addressable (2.3.
|
15
|
-
coderay (1.0.
|
14
|
+
addressable (2.3.5)
|
15
|
+
coderay (1.0.9)
|
16
16
|
columnize (0.3.6)
|
17
17
|
crack (0.3.2)
|
18
18
|
debugger (1.2.4)
|
@@ -21,27 +21,27 @@ GEM
|
|
21
21
|
debugger-ruby_core_source (~> 1.1.7)
|
22
22
|
debugger-linecache (1.1.2)
|
23
23
|
debugger-ruby_core_source (>= 1.1.1)
|
24
|
-
debugger-ruby_core_source (1.1.
|
24
|
+
debugger-ruby_core_source (1.1.9)
|
25
25
|
diff-lcs (1.1.3)
|
26
|
-
faraday (0.8.
|
27
|
-
multipart-post (~> 1.
|
26
|
+
faraday (0.8.8)
|
27
|
+
multipart-post (~> 1.2.0)
|
28
28
|
faraday_middleware (0.9.0)
|
29
29
|
faraday (>= 0.7.4, < 0.9)
|
30
|
-
hashie (
|
30
|
+
hashie (2.0.5)
|
31
31
|
json (1.7.6)
|
32
|
-
method_source (0.8.
|
32
|
+
method_source (0.8.2)
|
33
33
|
multi_json (1.5.0)
|
34
|
-
multipart-post (1.
|
35
|
-
pry (0.9.
|
34
|
+
multipart-post (1.2.0)
|
35
|
+
pry (0.9.12.2)
|
36
36
|
coderay (~> 1.0.5)
|
37
37
|
method_source (~> 0.8)
|
38
38
|
slop (~> 3.4)
|
39
39
|
pry-debugger (0.2.1)
|
40
40
|
debugger (~> 1.2.0)
|
41
41
|
pry (~> 0.9.10)
|
42
|
-
rake (10.0
|
43
|
-
rash (0.
|
44
|
-
hashie (~>
|
42
|
+
rake (10.1.0)
|
43
|
+
rash (0.4.0)
|
44
|
+
hashie (~> 2.0.0)
|
45
45
|
rspec (2.12.0)
|
46
46
|
rspec-core (~> 2.12.0)
|
47
47
|
rspec-expectations (~> 2.12.0)
|
@@ -54,11 +54,11 @@ GEM
|
|
54
54
|
multi_json (~> 1.0)
|
55
55
|
simplecov-html (~> 0.7.1)
|
56
56
|
simplecov-html (0.7.1)
|
57
|
-
slop (3.4.
|
57
|
+
slop (3.4.6)
|
58
58
|
webmock (1.9.0)
|
59
59
|
addressable (>= 2.2.7)
|
60
60
|
crack (>= 0.1.7)
|
61
|
-
yard (0.8.
|
61
|
+
yard (0.8.7)
|
62
62
|
|
63
63
|
PLATFORMS
|
64
64
|
ruby
|
data/README.mkd
CHANGED
@@ -18,7 +18,32 @@ Add it to the [apps](http://github.com/jeremyvdw/disqussion/wiki/apps) wiki!
|
|
18
18
|
|
19
19
|
Continuous Integration
|
20
20
|
----------------------
|
21
|
-
[![Build Status](
|
21
|
+
[![Build Status](https://travis-ci.org/jeremyvdw/disqussion.png)](http://travis-ci.org/jeremyvdw/disqussion)
|
22
|
+
[![Dependency Status](https://gemnasium.com/jeremyvdw/disqussion.png)](https://gemnasium.com/jeremyvdw/disqussion)
|
23
|
+
|
24
|
+
|
25
|
+
What's in 0.0.7?
|
26
|
+
----------------------
|
27
|
+
* Added list of forum moderators (@shabankarumba)
|
28
|
+
* Added list of popular hreads, create threads (@shabankarumba)
|
29
|
+
* Added list and details of reactions (@shabankarumba)
|
30
|
+
* Added hierarchal tree of a post, list of the most popular posts and informations on a post (@shabankarumba)
|
31
|
+
* Added list of users a user is being followed by and users a user is following, list of forums a user has been active on recenty (@shabankarumba)
|
32
|
+
* Added set of threads given a list of ids (@shabankarumba)
|
33
|
+
* Added list of threads sorted by hotness (@shabankarumba)
|
34
|
+
* Added check username availability (@shabankarumba)
|
35
|
+
* Added list of most active users (@m0dd3r)
|
36
|
+
|
37
|
+
What's in 0.0.6?
|
38
|
+
----------------------
|
39
|
+
* Added subscribe and unsubscribe API calls (@wbrady)
|
40
|
+
* List users activity and list users active threads (@shabankarumba)
|
41
|
+
* Updated dependencies
|
42
|
+
|
43
|
+
What's in 0.0.5?
|
44
|
+
----------------------
|
45
|
+
|
46
|
+
* Fixes conflicts with the `twitter` gem (@mathieuravaux).
|
22
47
|
|
23
48
|
What's in 0.0.4?
|
24
49
|
----------------
|
@@ -76,7 +101,7 @@ explicitly require a JSON library. We recommend [yajl-ruby](http://github.com/br
|
|
76
101
|
|
77
102
|
Usage Examples
|
78
103
|
--------------
|
79
|
-
```
|
104
|
+
```ruby
|
80
105
|
require "rubygems"
|
81
106
|
require "disqussion"
|
82
107
|
|
@@ -89,7 +114,7 @@ end
|
|
89
114
|
|
90
115
|
# Get an application's usage details
|
91
116
|
puts Disqussion::Client.applications.listUsage("the88")
|
92
|
-
|
117
|
+
```
|
93
118
|
|
94
119
|
Contributing
|
95
120
|
------------
|
@@ -137,5 +162,4 @@ This gem is based on the work by John Nunemaker, Wynn Netherland, Erik Michaels-
|
|
137
162
|
|
138
163
|
Copyright
|
139
164
|
---------
|
140
|
-
|
141
|
-
See [LICENSE](https://github.com/jeremyvdw/disqussion/blob/master/LICENSE.mkd) for details.
|
165
|
+
See [LICENSE](https://github.com/jeremyvdw/disqussion/blob/master/LICENSE.mkd) for details.
|
data/disqussion.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.expand_path('../lib/disqussion/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
|
-
spec.add_dependency('hashie', '~>
|
5
|
+
spec.add_dependency('hashie', '~> 2.0')
|
6
6
|
spec.add_dependency('faraday', '~> 0.8')
|
7
7
|
spec.add_dependency('faraday_middleware', '>= 0.9')
|
8
8
|
spec.add_dependency('multi_json', '~> 1.5')
|
@@ -61,6 +61,44 @@ module Disqussion
|
|
61
61
|
options[:forum] = args.first
|
62
62
|
response = get('forums/listCategories', options)
|
63
63
|
end
|
64
|
+
|
65
|
+
# Returns a list of Moderators for the forum
|
66
|
+
# @accessibility: public key, secret key
|
67
|
+
# @methods: GET
|
68
|
+
# @format: json, jsonp
|
69
|
+
# @authenticated: true
|
70
|
+
# @limited: false
|
71
|
+
# @param forum [String] Forum ID (aka short name).
|
72
|
+
# @return [Hashie::Rash] Details on the requested list of moderators.
|
73
|
+
# @example Return list of moderators within forum 'the88'
|
74
|
+
# Disqussion::Client.forums.listModerators("the88")
|
75
|
+
# @see: http://disqus.com/api/3.0/forums/listModerators.json
|
76
|
+
def listModerators(*args)
|
77
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
78
|
+
options[:forum] = args.first
|
79
|
+
response = get('forums/listModerators', options)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Returns a list of the most active users for the forum
|
83
|
+
# @accessibility: public key, secret key
|
84
|
+
# @methods: GET
|
85
|
+
# @format: json, jsonp
|
86
|
+
# @authenticated: false
|
87
|
+
# @limited: false
|
88
|
+
# @param forum [String] Forum ID (aka short name).
|
89
|
+
# @return [Hashie::Rash] Details on the requested list of most active users.
|
90
|
+
# @param options [Hash] A customizable set of options.
|
91
|
+
# @option options [Integer] :cursor. Defaults to null
|
92
|
+
# @option options [Integer] :limit. Defaults to 25. Maximum value of 100
|
93
|
+
# @option options [String] :order. Defaults to "asc". Choices: asc, desc
|
94
|
+
# @example Return list of most active users within forum 'the88'
|
95
|
+
# Disqussion::Client.forums.listMostActiveUsers("the88")
|
96
|
+
# @see: http://disqus.com/api/3.0/forums/listMostActiveUsers.json
|
97
|
+
def listMostActiveUsers(*args)
|
98
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
99
|
+
options[:forum] = args.first
|
100
|
+
response = get('forums/listMostActiveUsers', options)
|
101
|
+
end
|
64
102
|
|
65
103
|
# Returns a list of users active within a forum ordered by most likes received.
|
66
104
|
# @accessibility: public key, secret key
|
@@ -156,4 +194,4 @@ module Disqussion
|
|
156
194
|
response = get('forums/listUsers', options)
|
157
195
|
end
|
158
196
|
end
|
159
|
-
end
|
197
|
+
end
|
@@ -61,6 +61,26 @@ module Disqussion
|
|
61
61
|
options[:post] = args.first
|
62
62
|
response = get('posts/details', options)
|
63
63
|
end
|
64
|
+
|
65
|
+
# Returns the hierarchal tree of a post (all parents).
|
66
|
+
# @accessibility: public key, secret key
|
67
|
+
# @methods: GET
|
68
|
+
# @format: json, jsonp
|
69
|
+
# @authenticated: false
|
70
|
+
# @limited: false
|
71
|
+
# @param post [Integer] Post ID
|
72
|
+
# @param options [Hash] A customizable set of options.
|
73
|
+
# @option options [Integer, String] :related. Allows multiple. Defaults to []. You may specify relations to include with your response. Choices: forum, thread.
|
74
|
+
# @option options [Integer] :depth. Defaults to 10. Minimum value of 1 and maximum value of 10.
|
75
|
+
# @return [Hashie::Rash] hierarchal tree of a post (all parents).
|
76
|
+
# @example Return hierarchal tree for post 193673
|
77
|
+
# Disqussion::Client.posts.getContext(193673)
|
78
|
+
# @see: http://disqus.com/api/3.0/posts/getContext.json
|
79
|
+
def getContext(*args)
|
80
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
81
|
+
options[:post] = args.first
|
82
|
+
response = get('posts/getContext', options)
|
83
|
+
end
|
64
84
|
|
65
85
|
# Highlights a post.
|
66
86
|
# @accessibility: public key, secret key
|
@@ -105,6 +125,32 @@ module Disqussion
|
|
105
125
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
106
126
|
response = get('posts/list', options)
|
107
127
|
end
|
128
|
+
|
129
|
+
|
130
|
+
# Returns a list of the most popular posts
|
131
|
+
# @accessibility: public key, secret key
|
132
|
+
# @methods: GET
|
133
|
+
# @format: json, jsonp, rss
|
134
|
+
# @authenticated: false
|
135
|
+
# @limited: false
|
136
|
+
# @option options [String] :category. Defaults to null
|
137
|
+
# @option options [String] :interval. Defaults to "7d". Choices: 1h, 6h, 12h, 1d, 3d, 7d, 30d, 60d, 90d
|
138
|
+
# @option options [Array, String] :thread allow multiple. Defaults to null. Looks up a thread by ID
|
139
|
+
# @option options [String] :forum. Defaults to null. Defaults to all forums you moderate. Use :all to retrieve all forums.
|
140
|
+
# @option options [Datetime, Timestamp] :since. Unix timestamp (or ISO datetime standard). Defaults to null(Deprecated)
|
141
|
+
# @option options [Integer, String] :related. Allows multiple. Defaults to []. You may specify relations to include with your response. Choices: forum, thread
|
142
|
+
# @option options [Integer] :limit. Defaults to 25. Maximum value of 100
|
143
|
+
# @option options [Integer] :offset. Defaults to 0
|
144
|
+
# @option options [String] :query, Defualts to null
|
145
|
+
# @option options [String, Array] :include. Allows multiple. Defaults to ["approved"]. Choices: unapproved, approved, spam, deleted, flagged
|
146
|
+
# @option options [String] :order. Defaults to "popular". Choices: popular, best
|
147
|
+
# @example list popular posts with forum bobross
|
148
|
+
# Disqussion::Client.posts.listPopular("bobross")
|
149
|
+
# @see: http://disqus.com/api/3.0/posts/listPopular.json
|
150
|
+
def listPopular(*args)
|
151
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
152
|
+
response = get('posts/listPopular', options)
|
153
|
+
end
|
108
154
|
|
109
155
|
# Deletes the requested post(s).
|
110
156
|
# @accessibility: public key, secret key
|
@@ -190,6 +236,29 @@ module Disqussion
|
|
190
236
|
options[:post] = args.first
|
191
237
|
response = post('posts/unhighlight', options)
|
192
238
|
end
|
239
|
+
|
240
|
+
# Updates information on a post.
|
241
|
+
# @accessibility: public key, secret key
|
242
|
+
# @methods: POST
|
243
|
+
# @format: json, jsonp
|
244
|
+
# @authenticated: true
|
245
|
+
# @limited: false
|
246
|
+
# @param post [Integer] Looks up a post by ID.
|
247
|
+
# @param message [String] String of the message
|
248
|
+
# @return [Hashie::Rash] Updated information on the post.
|
249
|
+
# @example Message for post ID 12345678
|
250
|
+
# Disqussion::Client.posts.update(12345678,"Hello")
|
251
|
+
# @see: http://disqus.com/api/3.0/posts/update.json
|
252
|
+
def update(*args)
|
253
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
254
|
+
if args.length == 2
|
255
|
+
options.merge!(:post => args[0])
|
256
|
+
options.merge!(:message => args[1])
|
257
|
+
response = post('posts/update', options)
|
258
|
+
else
|
259
|
+
puts "#{Kernel.caller.first}: posts.update expects 2 arguments: post ID and message"
|
260
|
+
end
|
261
|
+
end
|
193
262
|
|
194
263
|
# Register a vote for a post.
|
195
264
|
# @accessibility: public key, secret key
|
@@ -1,5 +1,29 @@
|
|
1
1
|
module Disqussion
|
2
2
|
class Reactions < Client
|
3
|
+
|
4
|
+
# Returns reaction details
|
5
|
+
# @accessibility: public key, secret key
|
6
|
+
# @methods: GET
|
7
|
+
# @format: json, jsonp
|
8
|
+
# @authenticated: false
|
9
|
+
# @limited: false
|
10
|
+
# @param reaction [Integer] Looks up a reaction by ID.
|
11
|
+
# @param forum [String] Looks up a forum by ID (aka shortname).
|
12
|
+
# @return [Hashie::Rash] Reaction of the forum.
|
13
|
+
# @example Message for post ID 12345678
|
14
|
+
# Disqussion::Client.reactions.detail(12345678,"Hello")
|
15
|
+
# @see: http://disqus.com/api/3.0/reactions/details.json
|
16
|
+
def details(*args)
|
17
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
18
|
+
if args.length == 2
|
19
|
+
options.merge!(:reaction => args[0])
|
20
|
+
options.merge!(:forum => args[1])
|
21
|
+
response = get('reactions/details', options)
|
22
|
+
else
|
23
|
+
puts "#{Kernel.caller.first}: Reactions.details expects 2 arguments: reaction and forum"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
3
27
|
# Returns ??
|
4
28
|
# @accessibility: public key, secret key
|
5
29
|
# @methods: GET
|
@@ -37,6 +61,28 @@ module Disqussion
|
|
37
61
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
38
62
|
response = get('reactions/ips', options)
|
39
63
|
end
|
64
|
+
|
65
|
+
# Returns a list of reactions
|
66
|
+
# @accessibility: public key, secret key
|
67
|
+
# @methods: POST,GET
|
68
|
+
# @format: json, jsonp
|
69
|
+
# @authenticated: false
|
70
|
+
# @limited: false
|
71
|
+
# @param forum [String] Looks up a forum by ID (aka shortname).
|
72
|
+
# @option options [Datetime, Timestamp] :since. Unix timestamp (or ISO datetime standard). Defaults to null
|
73
|
+
# @option options [Integer] :cursor. Defaults to null
|
74
|
+
# @option options [Integer] :limit. Defaults to 25. Maximum length of 100
|
75
|
+
# @option options [Integer] :related. Defaults to []
|
76
|
+
# @option options [String] :order. Defaults to "asc". Choices: asc, desc
|
77
|
+
# @return [Hashie::Rash] Reaction of the forum.
|
78
|
+
# @example Message for post ID 12345678
|
79
|
+
# Disqussion::Client.reactions.detail(12345678,"Hello")
|
80
|
+
# @see: http://disqus.com/api/3.0/reactions/details.json
|
81
|
+
def list(*args)
|
82
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
83
|
+
options[:forum] = args.first
|
84
|
+
response = get('reactions/list', options)
|
85
|
+
end
|
40
86
|
|
41
87
|
# Returns ??
|
42
88
|
# @accessibility: public key, secret key
|
@@ -1,5 +1,35 @@
|
|
1
1
|
module Disqussion
|
2
2
|
class Threads < Client
|
3
|
+
|
4
|
+
# Creates a thread
|
5
|
+
# @accessibility: public key, secret key
|
6
|
+
# @methods: POST
|
7
|
+
# @format: json, jsonp
|
8
|
+
# @authenticated: true
|
9
|
+
# @limited: false
|
10
|
+
# @param forum [String] Looks up a forum by ID (aka forum shortname).
|
11
|
+
# @param title [String] Title of the the new thread
|
12
|
+
# @return [Hashie::Rash] New thread is created.
|
13
|
+
# @option options [Integer] :category. Defaults to null
|
14
|
+
# @option options [String] :url. Defaults to null. URL (defined by RFC 3986). Maximum length of 500
|
15
|
+
# @option options [Integer] :date. Defaults to null. Unix timestamp (or ISO datetime standard)
|
16
|
+
# @option options [String] :message Defaults to null
|
17
|
+
# @option options [Integer] :identifier. Defaults to null. Maximum length of 300
|
18
|
+
# @option options [String] :slug. Defaults to null. Alpha-numeric slug. Maximum length of 200
|
19
|
+
# @example Create thread "Hello World"
|
20
|
+
# Disqussion::Client.threads.create("bobross","Hello World")
|
21
|
+
# @see: http://disqus.com/api/3.0/threads/create.json
|
22
|
+
def create(*args)
|
23
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
24
|
+
if args.length == 2
|
25
|
+
options.merge!(:forum => args[0])
|
26
|
+
options.merge!(:title => args[1])
|
27
|
+
response = post('threads/create', options)
|
28
|
+
else
|
29
|
+
puts "#{Kernel.caller.first}: threads.create expects 2 arguments: forum name (aka forum short name) and title for the thread"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
3
33
|
# Closes a thread
|
4
34
|
# @accessibility: public key, secret key
|
5
35
|
# @methods: POST
|
@@ -88,6 +118,50 @@ module Disqussion
|
|
88
118
|
response = get('threads/listMostLiked', options)
|
89
119
|
end
|
90
120
|
|
121
|
+
# BETA
|
122
|
+
# Returns a list of threads sorted by hotness (date and likes).
|
123
|
+
# @accessibility: public key, secret key
|
124
|
+
# @methods: GET
|
125
|
+
# @format: json, jsonp, rss
|
126
|
+
# @authenticated: false
|
127
|
+
# @limited: false
|
128
|
+
# @return [Hashie::Rash] List of the hottest threads sorted by hotness.
|
129
|
+
# @option options [Integer] :category. Looks up a category by ID. Defualts to null.
|
130
|
+
# @option options [String] :forum. Defaults to null. Looks up a forum by ID (aka short name)
|
131
|
+
# @option options [String, Integer] :author. Defaults to null. Looks up a user by ID. You may look up a user by username using the 'username' query type.
|
132
|
+
# @option options [String, Array] :related. allows multiple. Defaults to []. You may specify relations to include with your response. Choices: forum, author,category
|
133
|
+
# @option options [Integer] :limit. Defaults to 25. Maximum length of 100
|
134
|
+
# @option options [String, Array] :include .allows multiple. Defaults to ["open", "close"]. Choices: open, closed, killed.
|
135
|
+
# @example Return list of hottest threads of the forum specified
|
136
|
+
# Disqussion::Client.threadslistHot(:forum => "cnn")
|
137
|
+
# @see: http://disqus.com/api/3.0/threads/listHot.json
|
138
|
+
def listHot(*args)
|
139
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
140
|
+
response = get('threads/listHot', options)
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns a list of threads sorted by number of posts made since "interval".
|
144
|
+
# If you are using both "category" and "forum" parameters, the forum of the category must match that as the parameter value for "forum".
|
145
|
+
# @accessibility: public key, secret key
|
146
|
+
# @methods: GET
|
147
|
+
# @format: json, jsonp, rss
|
148
|
+
# @authenticated: false
|
149
|
+
# @limited: false
|
150
|
+
# @return [Hashie::Rash] List of the most popular threads which have had the most posts in an interval.
|
151
|
+
# @option options [Integer] :category. Looks up a category by ID. Defualts to null.
|
152
|
+
# @option options [String] :interval. Defaults to "7d". Choices: 1h, 6h, 12h, 1d, 3d, 7d, 30d, 60d, 90d
|
153
|
+
# @option options [String] :forum. Defaults to null. Looks up a forum by ID (aka short name)
|
154
|
+
# @option options [String, Array] :related allows multiple. Defaults to []. You may specify relations to include with your response. Choices: forum
|
155
|
+
# @option options [Integer] :limit. Defaults to 25. Maximum length of 100
|
156
|
+
# @option options [Boolean] :with_top_post. Defaults to false
|
157
|
+
# @example Return list of the most populat threads in a given interval
|
158
|
+
# Disqussion::Client.threadslistPopular(:forum => "bobross")
|
159
|
+
# @see: http://disqus.com/api/3.0/threads/listPopular.json
|
160
|
+
def listPopular(*args)
|
161
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
162
|
+
response = get('threads/listPopular', options)
|
163
|
+
end
|
164
|
+
|
91
165
|
# Returns a list of posts within a thread.
|
92
166
|
# @accessibility: public key, secret key
|
93
167
|
# @methods: GET
|
@@ -172,6 +246,24 @@ module Disqussion
|
|
172
246
|
response = post('threads/restore', options)
|
173
247
|
end
|
174
248
|
|
249
|
+
# Returns an unsorted set of threads given a list of ids.
|
250
|
+
# @accessibility: public key, secret key
|
251
|
+
# @methods: GET
|
252
|
+
# @format: json, jsonp
|
253
|
+
# @authenticated: false
|
254
|
+
# @limited: false
|
255
|
+
# @option options [String] :related. Defaults to []. You may specify relations to include with your response. Choices forum, author, category
|
256
|
+
# @option options [String] :forum. Defaults to null. Looks up a forum by ID (aka short name).
|
257
|
+
# @example Set thread 12345678
|
258
|
+
# Disqussion::Client.threads.set(12345678)
|
259
|
+
# @see: http://disqus.com/api/3.0/threads/set.json
|
260
|
+
def set(*args)
|
261
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
262
|
+
thread = args.first
|
263
|
+
options.merge!(:thread => thread) if ([:ident, :link] & options.keys).empty?
|
264
|
+
response = get('threads/set', options)
|
265
|
+
end
|
266
|
+
|
175
267
|
def subscribe(*args)
|
176
268
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
177
269
|
response = post('threads/subscribe', options)
|
@@ -182,6 +274,30 @@ module Disqussion
|
|
182
274
|
response = post('threads/unsubscribe', options)
|
183
275
|
end
|
184
276
|
|
277
|
+
# Updates a thread
|
278
|
+
# @accessibility: public key, secret key
|
279
|
+
# @methods: POST
|
280
|
+
# @format: json, jsonp
|
281
|
+
# @authenticated: true
|
282
|
+
# @limited: false
|
283
|
+
# @param thread [Integer] Looks up by Thread ID
|
284
|
+
# @return [Hashie::Rash] Updates a thread.
|
285
|
+
# @option options [Integer] :category. Defaults to null
|
286
|
+
# @option options [String] :forum. Looks up a forum by ID (aka forum shortname)
|
287
|
+
# @option options [String] :title. Defaults to null. Maximum length of 200
|
288
|
+
# @option options [String] :url. Defaults to null. URL (defined by RFC 3986). Maximum length of 500
|
289
|
+
# @option options [Integer] :date. Defaults to null. Unix timestamp (or ISO datetime standard)
|
290
|
+
# @option options [String] :message Defaults to null
|
291
|
+
# @option options [Integer] :identifier. Defaults to null. Maximum length of 300
|
292
|
+
# @option options [String] :slug. Defaults to null. Alpha-numeric slug. Maximum length of 200
|
293
|
+
# @example Updates thread 1
|
294
|
+
# Disqussion::Client.threads.update(1,"bobross","Hello World")
|
295
|
+
# @see: http://disqus.com/api/3.0/threads/update.json
|
296
|
+
# def update(*args)
|
297
|
+
# options = args.last.is_a?(Hash) ? args.pop : {}
|
298
|
+
# response = post('threads/update', options)
|
299
|
+
# end
|
300
|
+
|
185
301
|
# Register a vote on a thread.
|
186
302
|
# @accessibility: public key, secret key
|
187
303
|
# @methods: POST
|