disqussion 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +80 -0
- data/HISTORY.mkd +5 -0
- data/LICENSE.mkd +20 -0
- data/README.mkd +139 -0
- data/Rakefile +23 -0
- data/disqussion.gemspec +37 -0
- data/lib/disqussion/api.rb +21 -0
- data/lib/disqussion/client/.DS_Store +0 -0
- data/lib/disqussion/client/applications.rb +20 -0
- data/lib/disqussion/client/blacklists.rb +4 -0
- data/lib/disqussion/client/categories.rb +4 -0
- data/lib/disqussion/client/exports.rb +4 -0
- data/lib/disqussion/client/forums.rb +122 -0
- data/lib/disqussion/client/imports.rb +4 -0
- data/lib/disqussion/client/posts.rb +217 -0
- data/lib/disqussion/client/reactions.rb +79 -0
- data/lib/disqussion/client/reports.rb +4 -0
- data/lib/disqussion/client/threads.rb +199 -0
- data/lib/disqussion/client/trends.rb +23 -0
- data/lib/disqussion/client/users.rb +103 -0
- data/lib/disqussion/client/utils.rb +90 -0
- data/lib/disqussion/client/whitelists.rb +4 -0
- data/lib/disqussion/client.rb +46 -0
- data/lib/disqussion/configuration.rb +121 -0
- data/lib/disqussion/connection.rb +36 -0
- data/lib/disqussion/error.rb +51 -0
- data/lib/disqussion/request.rb +38 -0
- data/lib/disqussion/version.rb +3 -0
- data/lib/disqussion/view_helpers.rb +9 -0
- data/lib/disqussion/widget.rb +183 -0
- data/lib/disqussion.rb +25 -0
- data/lib/faraday/response/raise_http_4xx.rb +41 -0
- data/lib/faraday/response/raise_http_5xx.rb +20 -0
- data/spec/disqussion/api_spec.rb +63 -0
- data/spec/disqussion/client/.DS_Store +0 -0
- data/spec/disqussion/client/applications_spec.rb +24 -0
- data/spec/disqussion/client/forums_spec.rb +80 -0
- data/spec/disqussion/client/posts_spec.rb +154 -0
- data/spec/disqussion/client/reactions_spec.rb +63 -0
- data/spec/disqussion/client/threads_spec.rb +128 -0
- data/spec/disqussion/client/trends_spec.rb +24 -0
- data/spec/disqussion/client/users_spec.rb +33 -0
- data/spec/disqussion/client_spec.rb +15 -0
- data/spec/disqussion_spec.rb +101 -0
- data/spec/faraday/response_spec.rb +30 -0
- data/spec/fixtures/applications/listUsage.json +129 -0
- data/spec/fixtures/forums/create.json +12 -0
- data/spec/fixtures/forums/details.json +12 -0
- data/spec/fixtures/forums/listCategories.json +21 -0
- data/spec/fixtures/forums/listPosts.json +859 -0
- data/spec/fixtures/forums/listThreads.json +533 -0
- data/spec/fixtures/posts/approve.json +6 -0
- data/spec/fixtures/posts/create.json +6 -0
- data/spec/fixtures/posts/details.json +35 -0
- data/spec/fixtures/posts/highlight.json +6 -0
- data/spec/fixtures/posts/list.json +247 -0
- data/spec/fixtures/posts/remove.json +6 -0
- data/spec/fixtures/posts/report.json +6 -0
- data/spec/fixtures/posts/restore.json +6 -0
- data/spec/fixtures/posts/spam.json +6 -0
- data/spec/fixtures/posts/unhighlight.json +6 -0
- data/spec/fixtures/posts/vote.json +6 -0
- data/spec/fixtures/reactions/domains.json +4 -0
- data/spec/fixtures/reactions/ips.json +131 -0
- data/spec/fixtures/reactions/threads.json +4 -0
- data/spec/fixtures/reactions/users.json +124 -0
- data/spec/fixtures/threads/close.json +4 -0
- data/spec/fixtures/threads/create.json +22 -0
- data/spec/fixtures/threads/details.json +24 -0
- data/spec/fixtures/threads/list.json +531 -0
- data/spec/fixtures/threads/listMostLiked.json +530 -0
- data/spec/fixtures/threads/listPosts.json +87 -0
- data/spec/fixtures/threads/open.json +8 -0
- data/spec/fixtures/threads/remove.json +4 -0
- data/spec/fixtures/threads/restore.json +4 -0
- data/spec/fixtures/threads/vote.json +4 -0
- data/spec/fixtures/trends/listTreads.json +283 -0
- data/spec/fixtures/users/details.json +19 -0
- data/spec/fixtures/users/follow.json +4 -0
- data/spec/helper.rb +47 -0
- metadata +348 -0
@@ -0,0 +1,283 @@
|
|
1
|
+
{
|
2
|
+
"code": 0,
|
3
|
+
"response": [
|
4
|
+
{
|
5
|
+
"thread": {
|
6
|
+
"category": "282363",
|
7
|
+
"reactions": 0,
|
8
|
+
"identifiers": [
|
9
|
+
"46327 http://thoughtcatalog.com/?p=46327"
|
10
|
+
],
|
11
|
+
"forum": "thoughtcatalog",
|
12
|
+
"title": "Private:",
|
13
|
+
"dislikes": 0,
|
14
|
+
"isDeleted": false,
|
15
|
+
"author": "1755784",
|
16
|
+
"userScore": 0,
|
17
|
+
"id": "297786378",
|
18
|
+
"isClosed": false,
|
19
|
+
"posts": 14,
|
20
|
+
"link": "http://thoughtcatalog.com/2011/46327/",
|
21
|
+
"likes": 12,
|
22
|
+
"message": "My parents divorced before I could remember\u2014I only know of the aftermath. I remember the loneliness of diaspora, the accelerated rate of my emotional growth, my distrust of anyone trying to get close to me. My parents were young and forced to marry due to an unplanned pregnancy. I do thi",
|
23
|
+
"slug": "private_71",
|
24
|
+
"createdAt": "2011-05-07T14:43:46"
|
25
|
+
},
|
26
|
+
"postLikes": 15,
|
27
|
+
"posts": 14,
|
28
|
+
"score": "1.4523809523809524",
|
29
|
+
"link": "http://thoughtcatalog.com/2011/46327/",
|
30
|
+
"likes": 12
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"thread": {
|
34
|
+
"category": "802989",
|
35
|
+
"reactions": 0,
|
36
|
+
"identifiers": [
|
37
|
+
"062666e91e_id7017"
|
38
|
+
],
|
39
|
+
"forum": "sabahkini",
|
40
|
+
"title": "KASARI ORANG AWAM, JAIKOL DITAHAN KERJA",
|
41
|
+
"dislikes": 2,
|
42
|
+
"isDeleted": false,
|
43
|
+
"author": "9920510",
|
44
|
+
"userScore": 0,
|
45
|
+
"id": "295668774",
|
46
|
+
"isClosed": false,
|
47
|
+
"posts": 360,
|
48
|
+
"link": "http://sabahkini.net/index.php?option=com_content&view=article&id=7017:kasari-orang-awam-jaikol-ditahan-kerja&catid=35:berita-sabah&Itemid=27",
|
49
|
+
"likes": 6,
|
50
|
+
"message": "",
|
51
|
+
"slug": "kasari_orang_awam_jaikol_ditahan_kerja",
|
52
|
+
"createdAt": "2011-05-05T03:53:53"
|
53
|
+
},
|
54
|
+
"postLikes": 281,
|
55
|
+
"posts": 360,
|
56
|
+
"score": "1.5666666666666667",
|
57
|
+
"link": "http://sabahkini.net/index.php?option=com_content&view=article&id=7017:kasari-orang-awam-jaikol-ditahan-kerja&catid=35:berita-sabah&Itemid=27",
|
58
|
+
"likes": 6
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"thread": {
|
62
|
+
"category": "437866",
|
63
|
+
"reactions": 0,
|
64
|
+
"identifiers": [
|
65
|
+
"node/111472"
|
66
|
+
],
|
67
|
+
"forum": "motherjones",
|
68
|
+
"title": "The GOP's Stealth Plan to Redefine Rape",
|
69
|
+
"dislikes": 0,
|
70
|
+
"isDeleted": false,
|
71
|
+
"author": "3383198",
|
72
|
+
"userScore": 0,
|
73
|
+
"id": "291587107",
|
74
|
+
"isClosed": false,
|
75
|
+
"posts": 219,
|
76
|
+
"link": "http://motherjones.com/node/111472",
|
77
|
+
"likes": 9,
|
78
|
+
"message": "",
|
79
|
+
"slug": "the_return_of_redefining_rape",
|
80
|
+
"createdAt": "2011-04-29T20:37:12"
|
81
|
+
},
|
82
|
+
"postLikes": 1790,
|
83
|
+
"posts": 219,
|
84
|
+
"score": "1.5945945945945946",
|
85
|
+
"link": "http://motherjones.com/node/111472",
|
86
|
+
"likes": 9
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"thread": {
|
90
|
+
"category": "448367",
|
91
|
+
"reactions": 0,
|
92
|
+
"identifiers": [
|
93
|
+
"2580"
|
94
|
+
],
|
95
|
+
"forum": "tralerighedibreakingdawnit",
|
96
|
+
"title": "Le critiche cinematografiche di Come l'aqua per gli elefanti",
|
97
|
+
"dislikes": 0,
|
98
|
+
"isDeleted": false,
|
99
|
+
"author": "3940095",
|
100
|
+
"userScore": 0,
|
101
|
+
"id": "298588757",
|
102
|
+
"isClosed": false,
|
103
|
+
"posts": 37,
|
104
|
+
"link": "http://www.tralerighedibreakingdawn.it/index.php/slideshow2/robert-pattinson/rp-film/2580-le-critiche-cinematografiche-di-come-laqua-per-gli-elefanti.html",
|
105
|
+
"likes": 0,
|
106
|
+
"message": "",
|
107
|
+
"slug": "le_critiche_cinematografiche_di_come_laqua_per_gli_elefanti",
|
108
|
+
"createdAt": "2011-05-08T17:34:55"
|
109
|
+
},
|
110
|
+
"postLikes": 24,
|
111
|
+
"posts": 37,
|
112
|
+
"score": "1.6833333333333333",
|
113
|
+
"link": "http://www.tralerighedibreakingdawn.it/index.php/slideshow2/robert-pattinson/rp-film/2580-le-critiche-cinematografiche-di-come-laqua-per-gli-elefanti.html",
|
114
|
+
"likes": 0
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"thread": {
|
118
|
+
"category": "429848",
|
119
|
+
"reactions": 0,
|
120
|
+
"identifiers": [
|
121
|
+
"2011/05/08/after-heart-failure-cheney-keeps-ticking"
|
122
|
+
],
|
123
|
+
"forum": "politicsblog",
|
124
|
+
"title": "After Heart Failure, Cheney Keeps Ticking",
|
125
|
+
"dislikes": 0,
|
126
|
+
"isDeleted": false,
|
127
|
+
"author": "2500343",
|
128
|
+
"userScore": 0,
|
129
|
+
"id": "298631513",
|
130
|
+
"isClosed": false,
|
131
|
+
"posts": 54,
|
132
|
+
"link": "http://origin.politics.blogs.foxnews.com/2011/05/08/after-heart-failure-cheney-keeps-ticking",
|
133
|
+
"likes": 0,
|
134
|
+
"message": "",
|
135
|
+
"slug": "after_heart_failure_cheney_keeps_ticking",
|
136
|
+
"createdAt": "2011-05-08T18:53:54"
|
137
|
+
},
|
138
|
+
"postLikes": 123,
|
139
|
+
"posts": 54,
|
140
|
+
"score": "1.9230769230769231",
|
141
|
+
"link": "http://origin.politics.blogs.foxnews.com/2011/05/08/after-heart-failure-cheney-keeps-ticking",
|
142
|
+
"likes": 0
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"thread": {
|
146
|
+
"category": "617006",
|
147
|
+
"reactions": 0,
|
148
|
+
"identifiers": [
|
149
|
+
"@zhouminews - 67309777134432256"
|
150
|
+
],
|
151
|
+
"forum": "tweetdeck",
|
152
|
+
"title": "http://www.tweetdeck.com/twitter/zhouminews/~IYWHz",
|
153
|
+
"dislikes": 0,
|
154
|
+
"isDeleted": false,
|
155
|
+
"author": "6391107",
|
156
|
+
"userScore": 0,
|
157
|
+
"id": "298650154",
|
158
|
+
"isClosed": false,
|
159
|
+
"posts": 69,
|
160
|
+
"link": "http://www.tweetdeck.com/twitter/zhouminews/~IYWHz",
|
161
|
+
"likes": 4,
|
162
|
+
"message": "",
|
163
|
+
"slug": "thread_4866950",
|
164
|
+
"createdAt": "2011-05-08T19:28:07"
|
165
|
+
},
|
166
|
+
"postLikes": 1,
|
167
|
+
"posts": 69,
|
168
|
+
"score": "1.7857142857142857",
|
169
|
+
"link": "http://www.tweetdeck.com/twitter/zhouminews/~IYWHz",
|
170
|
+
"likes": 4
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"thread": {
|
174
|
+
"category": "528502",
|
175
|
+
"reactions": 0,
|
176
|
+
"identifiers": [
|
177
|
+
"nt-686968"
|
178
|
+
],
|
179
|
+
"forum": "gazetaesportivanet",
|
180
|
+
"title": "Corinthians e Santos empatam em branco e deixam gols para Vila Belmiro | Gazeta Esportiva.Net",
|
181
|
+
"dislikes": 0,
|
182
|
+
"isDeleted": false,
|
183
|
+
"author": "5195193",
|
184
|
+
"userScore": 0,
|
185
|
+
"id": "298690564",
|
186
|
+
"isClosed": false,
|
187
|
+
"posts": 94,
|
188
|
+
"link": "http://edge-f.fcl.com.br/304,,PREVIEW/686968,2011:05:08,/",
|
189
|
+
"likes": 0,
|
190
|
+
"message": "",
|
191
|
+
"slug": "corinthians_e_santos_empatam_em_branco_e_deixam_gols_para_vila_belmiro_gazeta_esportivanet",
|
192
|
+
"createdAt": "2011-05-08T20:42:58"
|
193
|
+
},
|
194
|
+
"postLikes": 77,
|
195
|
+
"posts": 94,
|
196
|
+
"score": "2.2445652173913043",
|
197
|
+
"link": "http://edge-f.fcl.com.br/304,,PREVIEW/686968,2011:05:08,/",
|
198
|
+
"likes": 0
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"thread": {
|
202
|
+
"category": "269303",
|
203
|
+
"reactions": 0,
|
204
|
+
"identifiers": [
|
205
|
+
"S118098"
|
206
|
+
],
|
207
|
+
"forum": "newser",
|
208
|
+
"title": "Discussion of: Noam Chomsky: Osama bin Laden Was Just a 'Suspect,' and Deserved 'Fair Trial'",
|
209
|
+
"dislikes": 0,
|
210
|
+
"isDeleted": false,
|
211
|
+
"author": "411914",
|
212
|
+
"userScore": 0,
|
213
|
+
"id": "298702825",
|
214
|
+
"isClosed": false,
|
215
|
+
"posts": 21,
|
216
|
+
"link": "http://www.newser.com/story/comments/118098/noam-chomsky-osama-bin-laden-was-just-a-suspect-and-deserved-fair-trial.html",
|
217
|
+
"likes": 0,
|
218
|
+
"message": "",
|
219
|
+
"slug": "discussion_of_noam_chomsky_osama_bin_laden_was_just_a_suspect_and_deserved_fair_trial",
|
220
|
+
"createdAt": "2011-05-08T21:04:11"
|
221
|
+
},
|
222
|
+
"postLikes": 16,
|
223
|
+
"posts": 21,
|
224
|
+
"score": "1.9503546099290780",
|
225
|
+
"link": "http://www.newser.com/story/comments/118098/noam-chomsky-osama-bin-laden-was-just-a-suspect-and-deserved-fair-trial.html",
|
226
|
+
"likes": 0
|
227
|
+
},
|
228
|
+
{
|
229
|
+
"thread": {
|
230
|
+
"category": "528502",
|
231
|
+
"reactions": 0,
|
232
|
+
"identifiers": [
|
233
|
+
"nt-686977"
|
234
|
+
],
|
235
|
+
"forum": "gazetaesportivanet",
|
236
|
+
"title": "Ganso tem poucas chances de enfrentar o Once Caldas | Gazeta Esportiva.Net",
|
237
|
+
"dislikes": 0,
|
238
|
+
"isDeleted": false,
|
239
|
+
"author": "5195193",
|
240
|
+
"userScore": 0,
|
241
|
+
"id": "298706711",
|
242
|
+
"isClosed": false,
|
243
|
+
"posts": 28,
|
244
|
+
"link": "http://www.gazetaesportiva.net/noticia/2011/05/santos/ganso-tem-poucas-chances-de-enfrentar-o-once-caldas.html",
|
245
|
+
"likes": 0,
|
246
|
+
"message": "",
|
247
|
+
"slug": "ganso_tem_poucas_chances_de_enfrentar_o_once_caldas_gazeta_esportivanet",
|
248
|
+
"createdAt": "2011-05-08T21:10:17"
|
249
|
+
},
|
250
|
+
"postLikes": 16,
|
251
|
+
"posts": 28,
|
252
|
+
"score": "2.2445652173913043",
|
253
|
+
"link": "http://www.gazetaesportiva.net/noticia/2011/05/santos/ganso-tem-poucas-chances-de-enfrentar-o-once-caldas.html",
|
254
|
+
"likes": 0
|
255
|
+
},
|
256
|
+
{
|
257
|
+
"thread": {
|
258
|
+
"category": "364368",
|
259
|
+
"reactions": 0,
|
260
|
+
"identifiers": [],
|
261
|
+
"forum": "phxb",
|
262
|
+
"title": "Feathered Bastard - Stephen Lemons - Joe Arpaio Pummeled By Kids and Tea Baggers Undone By Kindness at Phoenix May Day Rally",
|
263
|
+
"dislikes": 0,
|
264
|
+
"isDeleted": false,
|
265
|
+
"author": "2707503",
|
266
|
+
"userScore": 0,
|
267
|
+
"id": "297317883",
|
268
|
+
"isClosed": false,
|
269
|
+
"posts": 84,
|
270
|
+
"link": "http://blogs.phoenixnewtimes.com/bastard/2011/05/joe_arpaio_pummeled_by_kids_an.php",
|
271
|
+
"likes": 0,
|
272
|
+
"message": "",
|
273
|
+
"slug": "feathered_bastard_stephen_lemons_joe_arpaio_pummeled_by_kids_and_tea_baggers_undone_by_kindness_a_07",
|
274
|
+
"createdAt": "2011-05-06T22:41:26"
|
275
|
+
},
|
276
|
+
"postLikes": 142,
|
277
|
+
"posts": 84,
|
278
|
+
"score": "1.8292682926829268",
|
279
|
+
"link": "http://blogs.phoenixnewtimes.com/bastard/2011/05/joe_arpaio_pummeled_by_kids_an.php",
|
280
|
+
"likes": 0
|
281
|
+
}
|
282
|
+
]
|
283
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"code": 0,
|
3
|
+
"response": {
|
4
|
+
"username": "the88",
|
5
|
+
"about": "",
|
6
|
+
"name": "the88",
|
7
|
+
"url": "",
|
8
|
+
"isFollowing": false,
|
9
|
+
"isFollowedBy": false,
|
10
|
+
"profileUrl": "http://disqus.com/the88/",
|
11
|
+
"emailHash": "bb59f077c9689d923dd856c31dba3098",
|
12
|
+
"avatar": {
|
13
|
+
"permalink": "http://disqus.com/api/users/avatars/the88.jpg",
|
14
|
+
"cache": "http://mediacdn.disqus.com/1304545408/images/noavatar92.png"
|
15
|
+
},
|
16
|
+
"isAnonymous": false,
|
17
|
+
"id": "6138058"
|
18
|
+
}
|
19
|
+
}
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_group 'Disqussion', 'lib/disqussion'
|
4
|
+
add_group 'Specs', 'spec'
|
5
|
+
end
|
6
|
+
require 'disqussion'
|
7
|
+
require 'rspec'
|
8
|
+
require 'webmock/rspec'
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.include WebMock::API
|
11
|
+
|
12
|
+
config.before(:each) do
|
13
|
+
Disqussion.api_secret = 'w00t'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def a_get(path, options = {})
|
18
|
+
options[:query] ||= {}
|
19
|
+
options[:query].merge! :api_secret => Disqussion.api_secret
|
20
|
+
a_request(:get, Disqussion.endpoint + path).with(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def a_post(path, options = {})
|
24
|
+
options[:body] ||= {}
|
25
|
+
options[:body].merge! :api_secret => Disqussion.api_secret
|
26
|
+
a_request(:post, Disqussion.endpoint + path).with(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def stub_get(path, options = {})
|
30
|
+
options[:query] ||= {}
|
31
|
+
options[:query].merge! :api_secret => Disqussion.api_secret
|
32
|
+
stub_request(:get, Disqussion.endpoint + path).with(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
def stub_post(path, options = {})
|
36
|
+
options[:body] ||= {}
|
37
|
+
options[:body].merge! :api_secret => Disqussion.api_secret
|
38
|
+
stub_request(:post, Disqussion.endpoint + path).with(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def fixture_path
|
42
|
+
File.expand_path("../fixtures", __FILE__)
|
43
|
+
end
|
44
|
+
|
45
|
+
def fixture(file)
|
46
|
+
File.new(fixture_path + '/' + file)
|
47
|
+
end
|