repltalk 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/queries.rb +148 -0
- data/lib/repltalk.rb +27 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c29ae54ca39ef4007759029d6fe54038a6be1d78899531f28f125f7e005d1da
|
4
|
+
data.tar.gz: 56b3e5523034aa80ceddd37be953e4ce6f41035cf719c2e1e8472ddfd25c1280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8583dc5b8e2ea98ae39dc3d1eaa5b8896f9730b877c246a37ef3761c31c3333f259e6e33adf6174dbbf5e8452cc35dfd6f16103bfa8f1cffdbce8259aa960d8b
|
7
|
+
data.tar.gz: df881342da9575ddaf044a7bc49ad3846470936fed45815365203d57854c271802108d7db505e5114a260ac13ff6f443b8c088cbf6484d688593517bfb938028
|
data/lib/queries.rb
CHANGED
@@ -303,4 +303,152 @@ class Queries
|
|
303
303
|
__typename
|
304
304
|
}"
|
305
305
|
end
|
306
|
+
|
307
|
+
def Queries.get_post
|
308
|
+
"query post($id: Int!) {
|
309
|
+
post(id: $id) {
|
310
|
+
id
|
311
|
+
title
|
312
|
+
preview(removeMarkdown: true, length: 150)
|
313
|
+
body
|
314
|
+
isAnnouncement
|
315
|
+
url
|
316
|
+
isAnswerable
|
317
|
+
isHidden
|
318
|
+
answeredBy {
|
319
|
+
id
|
320
|
+
...PostAnsweredCardUser
|
321
|
+
__typename
|
322
|
+
}
|
323
|
+
answer {
|
324
|
+
id
|
325
|
+
...PostAnsweredCardComment
|
326
|
+
__typename
|
327
|
+
}
|
328
|
+
board {
|
329
|
+
id
|
330
|
+
url
|
331
|
+
description
|
332
|
+
slug
|
333
|
+
__typename
|
334
|
+
}
|
335
|
+
...PostDetailPost
|
336
|
+
__typename
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
fragment PostDetailPost on Post {
|
341
|
+
id
|
342
|
+
title
|
343
|
+
body
|
344
|
+
timeCreated
|
345
|
+
canReport
|
346
|
+
hasReported
|
347
|
+
isAnnouncement
|
348
|
+
isPinned
|
349
|
+
isLocked
|
350
|
+
isHidden
|
351
|
+
commentCount
|
352
|
+
isAnswered
|
353
|
+
isAnswerable
|
354
|
+
...PostVoteControlPost
|
355
|
+
user {
|
356
|
+
id
|
357
|
+
roles {
|
358
|
+
id
|
359
|
+
name
|
360
|
+
key
|
361
|
+
tagline
|
362
|
+
__typename
|
363
|
+
}
|
364
|
+
organization {
|
365
|
+
id
|
366
|
+
name
|
367
|
+
__typename
|
368
|
+
}
|
369
|
+
languages {
|
370
|
+
id
|
371
|
+
key
|
372
|
+
displayName
|
373
|
+
tagline
|
374
|
+
icon
|
375
|
+
__typename
|
376
|
+
}
|
377
|
+
...UserPostHeaderUser
|
378
|
+
__typename
|
379
|
+
}
|
380
|
+
repl {
|
381
|
+
id
|
382
|
+
url
|
383
|
+
title
|
384
|
+
description
|
385
|
+
isPrivate
|
386
|
+
isAlwaysOn
|
387
|
+
lang {
|
388
|
+
id
|
389
|
+
icon
|
390
|
+
key
|
391
|
+
displayName
|
392
|
+
tagline
|
393
|
+
__typename
|
394
|
+
}
|
395
|
+
__typename
|
396
|
+
}
|
397
|
+
board {
|
398
|
+
id
|
399
|
+
name
|
400
|
+
color
|
401
|
+
__typename
|
402
|
+
}
|
403
|
+
__typename
|
404
|
+
}
|
405
|
+
|
406
|
+
fragment PostVoteControlPost on Post {
|
407
|
+
id
|
408
|
+
voteCount
|
409
|
+
canVote
|
410
|
+
hasVoted
|
411
|
+
__typename
|
412
|
+
}
|
413
|
+
|
414
|
+
fragment UserPostHeaderUser on User {
|
415
|
+
id
|
416
|
+
image
|
417
|
+
isHacker
|
418
|
+
isModerator: hasRole(role: MODERATOR)
|
419
|
+
isAdmin: hasRole(role: ADMIN)
|
420
|
+
...DepreciatedUserLabelUser
|
421
|
+
...UserLinkUser
|
422
|
+
__typename
|
423
|
+
}
|
424
|
+
|
425
|
+
fragment UserLinkUser on User {
|
426
|
+
id
|
427
|
+
url
|
428
|
+
username
|
429
|
+
__typename
|
430
|
+
}
|
431
|
+
|
432
|
+
fragment DepreciatedUserLabelUser on User {
|
433
|
+
id
|
434
|
+
image
|
435
|
+
username
|
436
|
+
url
|
437
|
+
karma
|
438
|
+
__typename
|
439
|
+
}
|
440
|
+
|
441
|
+
fragment PostAnsweredCardUser on User {
|
442
|
+
id
|
443
|
+
username
|
444
|
+
...DepreciatedUserLabelUser
|
445
|
+
__typename
|
446
|
+
}
|
447
|
+
|
448
|
+
fragment PostAnsweredCardComment on Comment {
|
449
|
+
id
|
450
|
+
url
|
451
|
+
__typename
|
452
|
+
}"
|
453
|
+
end
|
306
454
|
end
|
data/lib/repltalk.rb
CHANGED
@@ -16,6 +16,8 @@ class Role
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
|
20
|
+
|
19
21
|
class Organization
|
20
22
|
attr_reader :id, :name
|
21
23
|
|
@@ -29,6 +31,8 @@ class Organization
|
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
34
|
+
|
35
|
+
|
32
36
|
class Language
|
33
37
|
attr_reader :id, :key, :name, :tagline, :icon
|
34
38
|
|
@@ -45,6 +49,8 @@ class Language
|
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
52
|
+
|
53
|
+
|
48
54
|
class Repl
|
49
55
|
attr_reader :id, :url, :title, :description, :language, :is_private, :is_always_on
|
50
56
|
|
@@ -64,6 +70,8 @@ class Repl
|
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
73
|
+
|
74
|
+
|
67
75
|
class Board
|
68
76
|
attr_reader :id, :name, :color
|
69
77
|
|
@@ -78,6 +86,8 @@ class Board
|
|
78
86
|
end
|
79
87
|
end
|
80
88
|
|
89
|
+
|
90
|
+
|
81
91
|
class Comment
|
82
92
|
attr_reader :id, :url, :author, :content, :vote_count, :can_vote, :has_voted
|
83
93
|
|
@@ -99,8 +109,10 @@ class Comment
|
|
99
109
|
end
|
100
110
|
end
|
101
111
|
|
112
|
+
|
113
|
+
|
102
114
|
class Post
|
103
|
-
attr_reader :id, :url, :repl, :board, :title, :author, :content, :preview, :timestamp, :vote_count, :comment_count, :can_vote, :has_voted, :
|
115
|
+
attr_reader :id, :url, :repl, :board, :title, :author, :content, :preview, :timestamp, :vote_count, :comment_count, :can_vote, :has_voted, :is_answered, :is_answerable, :is_hidden, :is_pinned, :is_locked, :is_announcement
|
104
116
|
|
105
117
|
def initialize(client, post)
|
106
118
|
@client = client
|
@@ -136,6 +148,8 @@ class Post
|
|
136
148
|
end
|
137
149
|
end
|
138
150
|
|
151
|
+
|
152
|
+
|
139
153
|
class User
|
140
154
|
attr_reader :id, :username, :name, :pfp, :bio, :cycles, :is_hacker, :roles, :organization, :languages
|
141
155
|
|
@@ -187,6 +201,8 @@ class User
|
|
187
201
|
end
|
188
202
|
end
|
189
203
|
|
204
|
+
|
205
|
+
|
190
206
|
class Client
|
191
207
|
attr_writer :sid
|
192
208
|
|
@@ -236,6 +252,15 @@ class Client
|
|
236
252
|
Queries.get_user_by_id,
|
237
253
|
user_id: id
|
238
254
|
)
|
239
|
-
User.new(u["user"])
|
255
|
+
User.new(self, u["user"])
|
256
|
+
end
|
257
|
+
|
258
|
+
def get_post(id)
|
259
|
+
p = graphql(
|
260
|
+
"post",
|
261
|
+
Queries.get_post,
|
262
|
+
id: id
|
263
|
+
)
|
264
|
+
Post.new(self, p["post"])
|
240
265
|
end
|
241
266
|
end
|