repltalk 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repltalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CodingCactus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-04 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -50,15 +50,17 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 2.5.1
53
- description: With the repltalk gem, you can easily interect with the repltalk graphql
54
- api. See https://github.com/Coding-Cactus/repltalk for documentation
53
+ description: With the ReplTalk gem, you can easily interect with the repltalk GraphQL
54
+ API. See https://github.com/Coding-Cactus/repltalk for documentation.
55
55
  email: codingcactus.cc@gmail.com
56
56
  executables: []
57
57
  extensions: []
58
58
  extra_rdoc_files: []
59
59
  files:
60
- - lib/queries.rb
61
60
  - lib/repltalk.rb
61
+ - lib/repltalk/client.rb
62
+ - lib/repltalk/graphql.rb
63
+ - lib/repltalk/structures.rb
62
64
  homepage: https://github.com/Coding-Cactus/repltalk
63
65
  licenses:
64
66
  - MIT
@@ -83,5 +85,5 @@ rubyforge_project:
83
85
  rubygems_version: 2.7.6
84
86
  signing_key:
85
87
  specification_version: 4
86
- summary: A ruby client for the repltalk api
88
+ summary: A Ruby client for the ReplTalk API
87
89
  test_files: []
data/lib/queries.rb DELETED
@@ -1,467 +0,0 @@
1
- class Fields
2
- @@roles = "
3
- id
4
- name
5
- key
6
- tagline
7
- "
8
-
9
- @@organization = "
10
- id
11
- name
12
- country
13
- postalCode
14
- state
15
- city
16
- timeCreated
17
- "
18
-
19
- @@subscription = "
20
- id
21
- planId
22
- quantity
23
- timeCreated
24
- "
25
-
26
- @@language = "
27
- id
28
- key
29
- displayName
30
- tagline
31
- icon
32
- category
33
- "
34
-
35
- @@board = "
36
- id
37
- name
38
- color
39
- description
40
- "
41
-
42
- @@user = "
43
- id
44
- fullName
45
- username
46
- image
47
- bio
48
- karma
49
- isHacker
50
- timeCreated
51
- roles {
52
- #{@@roles}
53
- }
54
- organization {
55
- #{@@organization}
56
- }
57
- subscription {
58
- #{@@subscription}
59
- }
60
- languages {
61
- #{@@language}
62
- }
63
- "
64
-
65
- @@repl = "
66
- id
67
- url
68
- title
69
- description
70
- timeCreated
71
- size
72
- imageUrl
73
- isPrivate
74
- isAlwaysOn
75
- lang {
76
- #{@@language}
77
- }
78
- user {
79
- #{@@user}
80
- }
81
- origin {
82
- url
83
- }
84
- "
85
-
86
- @@comment = "
87
- id
88
- body
89
- timeCreated
90
- url
91
- isAnswer
92
- voteCount
93
- canVote
94
- hasVoted
95
- user {
96
- #{@@user}
97
- }
98
- post {
99
- id
100
- }
101
- "
102
-
103
- @@repl_comment = "
104
- id
105
- body
106
- timeCreated
107
- user {
108
- #{@@user}
109
- }
110
- repl {
111
- #{@@repl}
112
- }
113
- "
114
-
115
- @@post = "
116
- id
117
- title
118
- body
119
- preview(removeMarkdown: true, length: 150)
120
- url
121
- commentCount
122
- isHidden
123
- isPinned
124
- isLocked
125
- isAnnouncement
126
- timeCreated
127
- isAnswered
128
- isAnswerable
129
- voteCount
130
- canVote
131
- hasVoted
132
- user {
133
- #{@@user}
134
- }
135
- repl {
136
- #{@@repl}
137
- }
138
- board {
139
- #{@@board}
140
- }
141
- answer {
142
- #{@@comment}
143
- }
144
- "
145
- end
146
-
147
-
148
- class Queries < Fields
149
- def Queries.get_user
150
- "query userByUsername($username: String!) {
151
- user: userByUsername(username: $username) {
152
- #{@@user}
153
- }
154
- }"
155
- end
156
-
157
- def Queries.get_user_by_id
158
- "query user($user_id: Int!) {
159
- user: user(id: $user_id) {
160
- #{@@user}
161
- }
162
- }"
163
- end
164
-
165
- def Queries.user_search
166
- "query usernameSearch($username: String!, $count: Int) {
167
- usernameSearch(query: $username, limit: $count) {
168
- #{@@user}
169
- }
170
- }"
171
- end
172
-
173
- def Queries.get_user_posts
174
- "query user($username: String!, $after: String, $order: String, $count: Int) {
175
- user: userByUsername(username: $username) {
176
- posts(after: $after, order: $order, count: $count) {
177
- items {
178
- #{@@post}
179
- }
180
- }
181
- }
182
- }"
183
- end
184
-
185
- def Queries.get_user_comments
186
- "query user($username: String!, $after: String, $order: String, $count: Int) {
187
- user: userByUsername(username: $username) {
188
- comments(after: $after, order: $order, count: $count) {
189
- items {
190
- #{@@comment}
191
- }
192
- }
193
- }
194
- }"
195
- end
196
-
197
- def Queries.get_user_repls
198
- "query user($username: String!, $count: Int, $order: String, $direction: String, $before: String, $after: String, $pinnedReplsFirst: Boolean, $showUnnamed: Boolean) {
199
- user: userByUsername(username: $username) {
200
- publicRepls(count: $count, order: $order, direction: $direction, before: $before, after: $after, pinnedReplsFirst: $pinnedReplsFirst, showUnnamed: $showUnnamed) {
201
- items {
202
- #{@@repl}
203
- }
204
- }
205
- }
206
- }"
207
- end
208
-
209
- def Queries.get_post
210
- "query post($id: Int!) {
211
- post(id: $id) {
212
- #{@@post}
213
- }
214
- }"
215
- end
216
-
217
- def Queries.get_posts_comments
218
- "query post($postId: Int!, $order: String, $count: Int, $after: String) {
219
- post(id: $postId) {
220
- comments(order: $order, count: $count, after: $after) {
221
- items {
222
- #{@@comment}
223
- }
224
- }
225
- }
226
- }"
227
- end
228
-
229
- def Queries.get_posts_upvoters
230
- "query post($id: Int!, $count: Int) {
231
- post(id: $id) {
232
- votes(count: $count) {
233
- items {
234
- user {
235
- #{@@user}
236
- }
237
- }
238
- }
239
- }
240
- }"
241
- end
242
-
243
- def Queries.get_comment
244
- "query comment ($id: Int!) {
245
- comment(id: $id) {
246
- #{@@comment}
247
- }
248
- }"
249
- end
250
-
251
- def Queries.get_comments_comments
252
- "query comment ($id: Int!) {
253
- comment(id: $id) {
254
- comments {
255
- #{@@comment}
256
- }
257
- }
258
- }"
259
- end
260
-
261
- def Queries.get_parent_comment
262
- "query comment ($id: Int!) {
263
- comment(id: $id) {
264
- parentComment {
265
- #{@@comment}
266
- }
267
- }
268
- }"
269
- end
270
-
271
- def Queries.get_repl
272
- "query ReplView($url: String!) {
273
- repl(url: $url) {
274
- ... on Repl {
275
- #{@@repl}
276
- }
277
- }
278
- }"
279
- end
280
-
281
- def Queries.get_repl_forks
282
- "query ReplViewForks($url: String!, $count: Int!, $after: String) {
283
- repl(url: $url) {
284
- ... on Repl {
285
- publicForks(count: $count, after: $after) {
286
- items {
287
- #{@@repl}
288
- }
289
- }
290
- }
291
- }
292
- }"
293
- end
294
-
295
- def Queries.get_repl_comments
296
- "query ReplViewComments($url: String!, $count: Int, $after: String) {
297
- repl(url: $url) {
298
- ... on Repl {
299
- comments(count: $count, after: $after) {
300
- items {
301
- #{@@repl_comment}
302
- replies {
303
- #{@@repl_comment}
304
- }
305
- }
306
- }
307
- }
308
- }
309
- }"
310
- end
311
-
312
- def Queries.get_repl_comment
313
- "query ReplViewComment($id: Int!) {
314
- replComment(id: $id) {
315
- ... on ReplComment {
316
- #{@@repl_comment}
317
- }
318
- }
319
- }"
320
- end
321
-
322
-
323
- def Queries.get_board
324
- "query boardBySlug($slug: String!) {
325
- board: boardBySlug(slug: $slug) {
326
- #{@@board}
327
- }
328
- }"
329
- end
330
-
331
- def Queries.get_posts
332
- "query PostsFeed($order: String, $after: String, $searchQuery: String, $languages: [String!], $count: Int, $boardSlugs: [String!], $pinAnnouncements: Boolean, $pinPinned: Boolean) {
333
- posts(order: $order, after: $after, searchQuery: $searchQuery, languages: $languages, count: $count, boardSlugs: $boardSlugs, pinAnnouncements: $pinAnnouncements, pinPinned: $pinPinned) {
334
- items {
335
- #{@@post}
336
- }
337
- }
338
- }"
339
- end
340
-
341
- def Queries.get_leaderboard
342
- "query LeaderboardQuery($count: Int, $after: String, $since: KarmaSince) {
343
- leaderboard(count: $count, after: $after, since: $since) {
344
- items {
345
- #{@@user}
346
- karmaSince: karma(since: $since)
347
- }
348
- }
349
- }"
350
- end
351
- end
352
-
353
-
354
- class Mutations < Fields
355
- def Mutations.create_post
356
- "mutation createPost($input: CreatePostInput!) {
357
- createPost(input: $input) {
358
- post {
359
- #{@@post}
360
- }
361
- }
362
- }"
363
- end
364
-
365
- def Mutations.edit_post
366
- "mutation updatePost($input: UpdatePostInput!) {
367
- updatePost(input: $input) {
368
- post {
369
- #{@@post}
370
- }
371
- }
372
- }
373
- "
374
- end
375
-
376
- def Mutations.delete_post
377
- "mutation deletePost($id: Int!) {
378
- deletePost(id: $id) {
379
- id
380
- }
381
- }"
382
- end
383
-
384
- def Mutations.create_comment
385
- "mutation createComment($input: CreateCommentInput!) {
386
- createComment(input: $input) {
387
- comment {
388
- #{@@comment}
389
- }
390
- }
391
- }"
392
- end
393
-
394
- def Mutations.edit_comment
395
- "mutation updateComment($input: UpdateCommentInput!) {
396
- updateComment(input: $input) {
397
- comment {
398
- #{@@comment}
399
- }
400
- }
401
- }"
402
- end
403
-
404
- def Mutations.delete_comment
405
- "mutation deleteComment($id: Int!) {
406
- deleteComment(id: $id) {
407
- id
408
- }
409
- }"
410
- end
411
-
412
- def Mutations.create_repl_comment
413
- "mutation ReplViewCreateReplComment($input: CreateReplCommentInput!) {
414
- createReplComment(input: $input) {
415
- ... on ReplComment {
416
- #{@@repl_comment}
417
- }
418
- }
419
- }"
420
- end
421
-
422
- def Mutations.reply_repl_comment
423
- "mutation ReplViewCreateReplCommentReply($input: CreateReplCommentReplyInput!) {
424
- createReplCommentReply(input: $input) {
425
- ... on ReplComment {
426
- #{@@repl_comment}
427
- }
428
- }
429
- }"
430
- end
431
-
432
- def Mutations.edit_repl_comment
433
- "mutation ReplViewCommentsUpdateReplComment($input: UpdateReplCommentInput!) {
434
- updateReplComment(input: $input) {
435
- ... on ReplComment {
436
- #{@@repl_comment}
437
- }
438
- }
439
- }"
440
- end
441
-
442
- def Mutations.delete_repl_comment
443
- "mutation ReplViewCommentsDeleteReplComment($id: Int!) {
444
- deleteReplComment(id: $id) {
445
- ... on ReplComment {
446
- id
447
- }
448
- }
449
- }"
450
- end
451
-
452
- def Mutations.report_post
453
- "mutation createBoardReport($id: Int!, $reason: String!) {
454
- createBoardReport(postId: $id, reason: $reason) {
455
- id
456
- }
457
- }"
458
- end
459
-
460
- def Mutations.report_comment
461
- "mutation createBoardReport($id: Int!, $reason: String!) {
462
- createBoardReport(commentId: $id, reason: $reason) {
463
- id
464
- }
465
- }"
466
- end
467
- end