pilha 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/lib/pilha.rb +7 -10
  2. data/lib/pilha/stack_overflow/answer.rb +7 -8
  3. data/lib/pilha/stack_overflow/badge.rb +8 -6
  4. data/lib/pilha/stack_overflow/base.rb +27 -0
  5. data/lib/pilha/stack_overflow/comment.rb +21 -9
  6. data/lib/pilha/stack_overflow/question.rb +41 -0
  7. data/lib/pilha/stack_overflow/statistics.rb +7 -6
  8. data/lib/pilha/stack_overflow/user.rb +5 -8
  9. data/pilha.gemspec +8 -21
  10. data/spec/fixtures/answer_comments.json +37 -0
  11. data/spec/fixtures/answers_by_question_id.json +430 -0
  12. data/spec/fixtures/answers_by_question_id.json.gz +0 -0
  13. data/spec/fixtures/badges_name.json +400 -0
  14. data/spec/fixtures/badges_name.json.gz +0 -0
  15. data/spec/fixtures/comments_by_mentioned_user_id.json +117 -0
  16. data/spec/fixtures/comments_by_mentioned_user_id.json.gz +0 -0
  17. data/spec/fixtures/comments_by_question_id.json +22 -0
  18. data/spec/fixtures/comments_by_question_id.json.gz +0 -0
  19. data/spec/fixtures/comments_by_user_id.json +464 -0
  20. data/spec/fixtures/comments_by_user_id.json.gz +0 -0
  21. data/spec/fixtures/comments_by_user_id_to_mentioned_user_id.json.gz +0 -0
  22. data/spec/fixtures/comments_by_user_to_mentioned_user.json +29 -0
  23. data/spec/fixtures/comments_by_user_to_mentioned_user.json.gz +0 -0
  24. data/spec/fixtures/comments_by_user_to_mentioned_user_id.json.gz +0 -0
  25. data/spec/fixtures/question_by_id.json +162 -0
  26. data/spec/fixtures/question_by_id.json.gz +0 -0
  27. data/spec/fixtures/question_by_id_with_body.json +169 -0
  28. data/spec/fixtures/question_by_id_with_body.json.gz +0 -0
  29. data/spec/fixtures/question_by_user_id.json.gz +0 -0
  30. data/spec/fixtures/questions.json +1773 -0
  31. data/spec/fixtures/questions.json.gz +0 -0
  32. data/spec/fixtures/questions.part +859 -0
  33. data/spec/fixtures/questions_by_user_id.json +35 -0
  34. data/spec/fixtures/questions_by_user_id.json.gz +0 -0
  35. data/spec/fixtures/users.json +983 -0
  36. data/spec/fixtures/users_by_id.json +40 -0
  37. data/spec/fixtures/users_by_id.json.gz +0 -0
  38. data/spec/pilha/stack_overflow/badge_spec.rb +3 -3
  39. data/spec/pilha/stack_overflow/comment_spec.rb +52 -1
  40. data/spec/pilha/stack_overflow/question_spec.rb +63 -0
  41. data/spec/pilha/stack_overflow/stack_overflow_spec.rb +2 -4
  42. data/spec/spec_helper.rb +7 -1
  43. metadata +53 -22
@@ -0,0 +1,400 @@
1
+ {
2
+ "badges": [
3
+ {
4
+ "badge_id": 9,
5
+ "rank": "bronze",
6
+ "name": "Autobiographer",
7
+ "description": "Completed all user profile fields",
8
+ "award_count": 28101,
9
+ "tag_based": false,
10
+ "badges_recipients_url": "/badges/9"
11
+ },
12
+ {
13
+ "badge_id": 30,
14
+ "rank": "silver",
15
+ "name": "Beta",
16
+ "description": "Actively participated in the Stack Overflow private beta",
17
+ "award_count": 2606,
18
+ "tag_based": false,
19
+ "badges_recipients_url": "/badges/30"
20
+ },
21
+ {
22
+ "badge_id": 8,
23
+ "rank": "bronze",
24
+ "name": "Citizen Patrol",
25
+ "description": "First flagged post",
26
+ "award_count": 5693,
27
+ "tag_based": false,
28
+ "badges_recipients_url": "/badges/8"
29
+ },
30
+ {
31
+ "badge_id": 32,
32
+ "rank": "silver",
33
+ "name": "Civic Duty",
34
+ "description": "Voted 300 or more times",
35
+ "award_count": 4696,
36
+ "tag_based": false,
37
+ "badges_recipients_url": "/badges/32"
38
+ },
39
+ {
40
+ "badge_id": 4,
41
+ "rank": "bronze",
42
+ "name": "Cleanup",
43
+ "description": "First rollback",
44
+ "award_count": 3816,
45
+ "tag_based": false,
46
+ "badges_recipients_url": "/badges/4"
47
+ },
48
+ {
49
+ "badge_id": 31,
50
+ "rank": "bronze",
51
+ "name": "Commentator",
52
+ "description": "Left 10 comments",
53
+ "award_count": 31143,
54
+ "tag_based": false,
55
+ "badges_recipients_url": "/badges/31"
56
+ },
57
+ {
58
+ "badge_id": 7,
59
+ "rank": "bronze",
60
+ "name": "Critic",
61
+ "description": "First down vote",
62
+ "award_count": 25349,
63
+ "tag_based": false,
64
+ "badges_recipients_url": "/badges/7"
65
+ },
66
+ {
67
+ "badge_id": 37,
68
+ "rank": "bronze",
69
+ "name": "Disciplined",
70
+ "description": "Deleted own post with score of 3 or higher",
71
+ "award_count": 1666,
72
+ "tag_based": false,
73
+ "badges_recipients_url": "/badges/37"
74
+ },
75
+ {
76
+ "badge_id": 3,
77
+ "rank": "bronze",
78
+ "name": "Editor",
79
+ "description": "First edit",
80
+ "award_count": 63350,
81
+ "tag_based": false,
82
+ "badges_recipients_url": "/badges/3"
83
+ },
84
+ {
85
+ "badge_id": 155,
86
+ "rank": "gold",
87
+ "name": "Electorate",
88
+ "description": "Voted on 600 questions and 25% or more of total votes are on questions",
89
+ "award_count": 279,
90
+ "tag_based": false,
91
+ "badges_recipients_url": "/badges/155"
92
+ },
93
+ {
94
+ "badge_id": 19,
95
+ "rank": "silver",
96
+ "name": "Enlightened",
97
+ "description": "First answer was accepted with score of 10 or more",
98
+ "award_count": 11424,
99
+ "tag_based": false,
100
+ "badges_recipients_url": "/badges/19"
101
+ },
102
+ {
103
+ "badge_id": 71,
104
+ "rank": "silver",
105
+ "name": "Enthusiast",
106
+ "description": "Visited the site each day for 30 consecutive days",
107
+ "award_count": 6941,
108
+ "tag_based": false,
109
+ "badges_recipients_url": "/badges/71"
110
+ },
111
+ {
112
+ "badge_id": 145,
113
+ "rank": "silver",
114
+ "name": "Epic",
115
+ "description": "Hit the daily reputation cap on 50 days",
116
+ "award_count": 87,
117
+ "tag_based": false,
118
+ "badges_recipients_url": "/badges/145"
119
+ },
120
+ {
121
+ "badge_id": 28,
122
+ "rank": "gold",
123
+ "name": "Famous Question",
124
+ "description": "Asked a question with 10,000 views",
125
+ "award_count": 1075,
126
+ "tag_based": false,
127
+ "badges_recipients_url": "/badges/28"
128
+ },
129
+ {
130
+ "badge_id": 83,
131
+ "rank": "gold",
132
+ "name": "Fanatic",
133
+ "description": "Visited the site each day for 100 consecutive days",
134
+ "award_count": 937,
135
+ "tag_based": false,
136
+ "badges_recipients_url": "/badges/83"
137
+ },
138
+ {
139
+ "badge_id": 33,
140
+ "rank": "silver",
141
+ "name": "Favorite Question",
142
+ "description": "Question favorited by 25 users",
143
+ "award_count": 1085,
144
+ "tag_based": false,
145
+ "badges_recipients_url": "/badges/33"
146
+ },
147
+ {
148
+ "badge_id": 15,
149
+ "rank": "silver",
150
+ "name": "Generalist",
151
+ "description": "Provided non-wiki answers of 15 total score in 20 of top 40 tags",
152
+ "award_count": 133,
153
+ "tag_based": false,
154
+ "badges_recipients_url": "/badges/15"
155
+ },
156
+ {
157
+ "badge_id": 24,
158
+ "rank": "silver",
159
+ "name": "Good Answer",
160
+ "description": "Answer score of 25 or more",
161
+ "award_count": 9102,
162
+ "tag_based": false,
163
+ "badges_recipients_url": "/badges/24"
164
+ },
165
+ {
166
+ "badge_id": 21,
167
+ "rank": "silver",
168
+ "name": "Good Question",
169
+ "description": "Question score of 25 or more",
170
+ "award_count": 2275,
171
+ "tag_based": false,
172
+ "badges_recipients_url": "/badges/21"
173
+ },
174
+ {
175
+ "badge_id": 25,
176
+ "rank": "gold",
177
+ "name": "Great Answer",
178
+ "description": "Answer score of 100 or more",
179
+ "award_count": 1020,
180
+ "tag_based": false,
181
+ "badges_recipients_url": "/badges/25"
182
+ },
183
+ {
184
+ "badge_id": 22,
185
+ "rank": "gold",
186
+ "name": "Great Question",
187
+ "description": "Question score of 100 or more",
188
+ "award_count": 197,
189
+ "tag_based": false,
190
+ "badges_recipients_url": "/badges/22"
191
+ },
192
+ {
193
+ "badge_id": 18,
194
+ "rank": "silver",
195
+ "name": "Guru",
196
+ "description": "Accepted answer and score of 40 or more",
197
+ "award_count": 1133,
198
+ "tag_based": false,
199
+ "badges_recipients_url": "/badges/18"
200
+ },
201
+ {
202
+ "badge_id": 146,
203
+ "rank": "gold",
204
+ "name": "Legendary",
205
+ "description": "Hit the daily reputation cap on 150 days",
206
+ "award_count": 18,
207
+ "tag_based": false,
208
+ "badges_recipients_url": "/badges/146"
209
+ },
210
+ {
211
+ "badge_id": 144,
212
+ "rank": "bronze",
213
+ "name": "Mortarboard",
214
+ "description": "Hit the daily reputation cap for the first time",
215
+ "award_count": 4135,
216
+ "tag_based": false,
217
+ "badges_recipients_url": "/badges/144"
218
+ },
219
+ {
220
+ "badge_id": 17,
221
+ "rank": "silver",
222
+ "name": "Necromancer",
223
+ "description": "Answered a question more than 60 days later with score of 5 or more",
224
+ "award_count": 4905,
225
+ "tag_based": false,
226
+ "badges_recipients_url": "/badges/17"
227
+ },
228
+ {
229
+ "badge_id": 23,
230
+ "rank": "bronze",
231
+ "name": "Nice Answer",
232
+ "description": "Answer score of 10 or more",
233
+ "award_count": 55585,
234
+ "tag_based": false,
235
+ "badges_recipients_url": "/badges/23"
236
+ },
237
+ {
238
+ "badge_id": 20,
239
+ "rank": "bronze",
240
+ "name": "Nice Question",
241
+ "description": "Question score of 10 or more",
242
+ "award_count": 13382,
243
+ "tag_based": false,
244
+ "badges_recipients_url": "/badges/20"
245
+ },
246
+ {
247
+ "badge_id": 27,
248
+ "rank": "silver",
249
+ "name": "Notable Question",
250
+ "description": "Asked a question with 2,500 views",
251
+ "award_count": 14428,
252
+ "tag_based": false,
253
+ "badges_recipients_url": "/badges/27"
254
+ },
255
+ {
256
+ "badge_id": 5,
257
+ "rank": "bronze",
258
+ "name": "Organizer",
259
+ "description": "First retag",
260
+ "award_count": 12073,
261
+ "tag_based": false,
262
+ "badges_recipients_url": "/badges/5"
263
+ },
264
+ {
265
+ "badge_id": 38,
266
+ "rank": "bronze",
267
+ "name": "Peer Pressure",
268
+ "description": "Deleted own post with score of -3 or lower",
269
+ "award_count": 2968,
270
+ "tag_based": false,
271
+ "badges_recipients_url": "/badges/38"
272
+ },
273
+ {
274
+ "badge_id": 26,
275
+ "rank": "bronze",
276
+ "name": "Popular Question",
277
+ "description": "Asked a question with 1,000 views",
278
+ "award_count": 52055,
279
+ "tag_based": false,
280
+ "badges_recipients_url": "/badges/26"
281
+ },
282
+ {
283
+ "badge_id": 62,
284
+ "rank": "gold",
285
+ "name": "Populist",
286
+ "description": "Answer outscored an accepted answer with score of more than 10 by more than 2x",
287
+ "award_count": 345,
288
+ "tag_based": false,
289
+ "badges_recipients_url": "/badges/62"
290
+ },
291
+ {
292
+ "badge_id": 94,
293
+ "rank": "silver",
294
+ "name": "Pundit",
295
+ "description": "Left 10 comments with score of 10 or more",
296
+ "award_count": 84,
297
+ "tag_based": false,
298
+ "badges_recipients_url": "/badges/94"
299
+ },
300
+ {
301
+ "badge_id": 95,
302
+ "rank": "gold",
303
+ "name": "Reversal",
304
+ "description": "Provided answer of +20 score to a question of -5 score",
305
+ "award_count": 38,
306
+ "tag_based": false,
307
+ "badges_recipients_url": "/badges/95"
308
+ },
309
+ {
310
+ "badge_id": 10,
311
+ "rank": "bronze",
312
+ "name": "Scholar",
313
+ "description": "Asked a question and accepted an answer",
314
+ "award_count": 69466,
315
+ "tag_based": false,
316
+ "badges_recipients_url": "/badges/10"
317
+ },
318
+ {
319
+ "badge_id": 14,
320
+ "rank": "bronze",
321
+ "name": "Self-Learner",
322
+ "description": "Answered your own question with score of 3 or more",
323
+ "award_count": 3851,
324
+ "tag_based": false,
325
+ "badges_recipients_url": "/badges/14"
326
+ },
327
+ {
328
+ "badge_id": 36,
329
+ "rank": "gold",
330
+ "name": "Stellar Question",
331
+ "description": "Question favorited by 100 users",
332
+ "award_count": 153,
333
+ "tag_based": false,
334
+ "badges_recipients_url": "/badges/36"
335
+ },
336
+ {
337
+ "badge_id": 12,
338
+ "rank": "silver",
339
+ "name": "Strunk & White",
340
+ "description": "Edited 100 entries",
341
+ "award_count": 650,
342
+ "tag_based": false,
343
+ "badges_recipients_url": "/badges/12"
344
+ },
345
+ {
346
+ "badge_id": 2,
347
+ "rank": "bronze",
348
+ "name": "Student",
349
+ "description": "Asked first question with at least one up vote",
350
+ "award_count": 85962,
351
+ "tag_based": false,
352
+ "badges_recipients_url": "/badges/2"
353
+ },
354
+ {
355
+ "badge_id": 6,
356
+ "rank": "bronze",
357
+ "name": "Supporter",
358
+ "description": "First up vote",
359
+ "award_count": 61402,
360
+ "tag_based": false,
361
+ "badges_recipients_url": "/badges/6"
362
+ },
363
+ {
364
+ "badge_id": 11,
365
+ "rank": "silver",
366
+ "name": "Taxonomist",
367
+ "description": "Created a tag used by 50 questions",
368
+ "award_count": 2085,
369
+ "tag_based": false,
370
+ "badges_recipients_url": "/badges/11"
371
+ },
372
+ {
373
+ "badge_id": 1,
374
+ "rank": "bronze",
375
+ "name": "Teacher",
376
+ "description": "Answered first question with score of 1 or more",
377
+ "award_count": 71655,
378
+ "tag_based": false,
379
+ "badges_recipients_url": "/badges/1"
380
+ },
381
+ {
382
+ "badge_id": 63,
383
+ "rank": "bronze",
384
+ "name": "Tumbleweed",
385
+ "description": "Asked a question with no answers, no comments, and low views for a week",
386
+ "award_count": 23318,
387
+ "tag_based": false,
388
+ "badges_recipients_url": "/badges/63"
389
+ },
390
+ {
391
+ "badge_id": 13,
392
+ "rank": "silver",
393
+ "name": "Yearling",
394
+ "description": "Active member for a year, earning at least 200 reputation",
395
+ "award_count": 19478,
396
+ "tag_based": false,
397
+ "badges_recipients_url": "/badges/13"
398
+ }
399
+ ]
400
+ }
Binary file
@@ -0,0 +1,117 @@
1
+ {
2
+ "total": 5,
3
+ "page": 1,
4
+ "pagesize": 30,
5
+ "comments": [
6
+ {
7
+ "comment_id": 2289139,
8
+ "creation_date": 1266949196,
9
+ "owner": {
10
+ "user_id": 77814,
11
+ "user_type": "registered",
12
+ "display_name": "nickyt",
13
+ "reputation": 1130,
14
+ "email_hash": "243668a44dc257d64fa88656beb94469"
15
+ },
16
+ "reply_to_user": {
17
+ "user_id": 549,
18
+ "user_type": "registered",
19
+ "display_name": "Josh Kodroff",
20
+ "reputation": 1542,
21
+ "email_hash": "9e7ef08258f04dab37b43842d261aea8"
22
+ },
23
+ "post_id": 2320184,
24
+ "post_type": "answer",
25
+ "score": 0,
26
+ "body": "@Josh - why not use a pagemethod then? You can just pass back the selected value and then your dependent picklist can use that value to populate itself. Might mean you need to change your approach, but less stuff goes down the wire this way."
27
+ },
28
+ {
29
+ "comment_id": 2093324,
30
+ "creation_date": 1264630592,
31
+ "owner": {
32
+ "user_id": 5274,
33
+ "user_type": "registered",
34
+ "display_name": "Jonathan Allen",
35
+ "reputation": 6414,
36
+ "email_hash": "205db6eb5e26b56ab69cd4bffbbc9b3d"
37
+ },
38
+ "reply_to_user": {
39
+ "user_id": 549,
40
+ "user_type": "registered",
41
+ "display_name": "Josh Kodroff",
42
+ "reputation": 1542,
43
+ "email_hash": "9e7ef08258f04dab37b43842d261aea8"
44
+ },
45
+ "post_id": 2150581,
46
+ "post_type": "question",
47
+ "score": 0,
48
+ "body": "@Josh, that could result in what amounts to a memory leak if he does it a lot."
49
+ },
50
+ {
51
+ "comment_id": 2093269,
52
+ "creation_date": 1264630294,
53
+ "owner": {
54
+ "user_id": 17516,
55
+ "user_type": "registered",
56
+ "display_name": "AnthonyWJones",
57
+ "reputation": 41517,
58
+ "email_hash": "91973b1bef91ee4f314cd95a37a45f2b"
59
+ },
60
+ "reply_to_user": {
61
+ "user_id": 549,
62
+ "user_type": "registered",
63
+ "display_name": "Josh Kodroff",
64
+ "reputation": 1542,
65
+ "email_hash": "9e7ef08258f04dab37b43842d261aea8"
66
+ },
67
+ "post_id": 2150581,
68
+ "post_type": "question",
69
+ "score": 0,
70
+ "body": "@josh: The goal is remove the delegate rather than to have it fire and do nothing. "
71
+ },
72
+ {
73
+ "comment_id": 2093258,
74
+ "creation_date": 1264630214,
75
+ "owner": {
76
+ "user_id": 17516,
77
+ "user_type": "registered",
78
+ "display_name": "AnthonyWJones",
79
+ "reputation": 41517,
80
+ "email_hash": "91973b1bef91ee4f314cd95a37a45f2b"
81
+ },
82
+ "reply_to_user": {
83
+ "user_id": 549,
84
+ "user_type": "registered",
85
+ "display_name": "Josh Kodroff",
86
+ "reputation": 1542,
87
+ "email_hash": "9e7ef08258f04dab37b43842d261aea8"
88
+ },
89
+ "post_id": 2150581,
90
+ "post_type": "question",
91
+ "score": 0,
92
+ "body": "@Josh: I agree it is "spaghetti-ish", so thats another reason to have a tidier solution."
93
+ },
94
+ {
95
+ "comment_id": 2084922,
96
+ "creation_date": 1264548804,
97
+ "owner": {
98
+ "user_id": 141229,
99
+ "user_type": "registered",
100
+ "display_name": "Martin Aatmaa",
101
+ "reputation": 138,
102
+ "email_hash": "db1e5a97a3d1f61d79e9e933df15fe7c"
103
+ },
104
+ "reply_to_user": {
105
+ "user_id": 549,
106
+ "user_type": "registered",
107
+ "display_name": "Josh Kodroff",
108
+ "reputation": 1542,
109
+ "email_hash": "9e7ef08258f04dab37b43842d261aea8"
110
+ },
111
+ "post_id": 2075288,
112
+ "post_type": "question",
113
+ "score": 0,
114
+ "body": "@Josh - In order to establish a clean level of separation, among other reasons. In any case, I think debating the DTO pattern is a separate topic."
115
+ }
116
+ ]
117
+ }