repltalk 2.0.2 → 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.0.2
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-03-15 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,456 +0,0 @@
1
- class Queries
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
- size
71
- imageUrl
72
- isPrivate
73
- isAlwaysOn
74
- lang {
75
- #{@@language}
76
- }
77
- user {
78
- #{@@user}
79
- }
80
- origin {
81
- url
82
- }
83
- "
84
-
85
- @@comment = "
86
- id
87
- body
88
- timeCreated
89
- url
90
- isAnswer
91
- voteCount
92
- canVote
93
- hasVoted
94
- user {
95
- #{@@user}
96
- }
97
- post {
98
- id
99
- }
100
- "
101
-
102
- @@repl_comment = "
103
- id
104
- body
105
- timeCreated
106
- user {
107
- #{@@user}
108
- }
109
- repl {
110
- #{@@repl}
111
- }
112
- "
113
-
114
- @@post = "
115
- id
116
- title
117
- body
118
- preview(removeMarkdown: true, length: 150)
119
- url
120
- commentCount
121
- isHidden
122
- isPinned
123
- isLocked
124
- isAnnouncement
125
- timeCreated
126
- isAnswered
127
- isAnswerable
128
- voteCount
129
- canVote
130
- hasVoted
131
- user {
132
- #{@@user}
133
- }
134
- repl {
135
- #{@@repl}
136
- }
137
- board {
138
- #{@@board}
139
- }
140
- answer {
141
- #{@@comment}
142
- }
143
- "
144
-
145
-
146
- def Queries.get_user
147
- "query userByUsername($username: String!) {
148
- user: userByUsername(username: $username) {
149
- #{@@user}
150
- }
151
- }"
152
- end
153
-
154
- def Queries.get_user_by_id
155
- "query user($user_id: Int!) {
156
- user: user(id: $user_id) {
157
- #{@@user}
158
- }
159
- }"
160
- end
161
-
162
- def Queries.get_user_posts
163
- "query user($username: String!, $after: String, $order: String, $count: Int) {
164
- user: userByUsername(username: $username) {
165
- posts(after: $after, order: $order, count: $count) {
166
- items {
167
- #{@@post}
168
- }
169
- }
170
- }
171
- }"
172
- end
173
-
174
- def Queries.get_user_comments
175
- "query user($username: String!, $after: String, $order: String, $count: Int) {
176
- user: userByUsername(username: $username) {
177
- comments(after: $after, order: $order, count: $count) {
178
- items {
179
- #{@@comment}
180
- }
181
- }
182
- }
183
- }"
184
- end
185
-
186
- def Queries.get_user_repls
187
- "query user($username: String!, $count: Int, $order: String, $direction: String, $before: String, $after: String, $pinnedReplsFirst: Boolean, $showUnnamed: Boolean) {
188
- user: userByUsername(username: $username) {
189
- publicRepls(count: $count, order: $order, direction: $direction, before: $before, after: $after, pinnedReplsFirst: $pinnedReplsFirst, showUnnamed: $showUnnamed) {
190
- items {
191
- #{@@repl}
192
- }
193
- }
194
- }
195
- }"
196
- end
197
-
198
- def Queries.get_post
199
- "query post($id: Int!) {
200
- post(id: $id) {
201
- #{@@post}
202
- }
203
- }"
204
- end
205
-
206
- def Queries.get_posts_comments
207
- "query post($postId: Int!, $order: String, $count: Int, $after: String) {
208
- post(id: $postId) {
209
- comments(order: $order, count: $count, after: $after) {
210
- items {
211
- #{@@comment}
212
- }
213
- }
214
- }
215
- }"
216
- end
217
-
218
- def Queries.get_posts_upvoters
219
- "query post($id: Int!, $count: Int) {
220
- post(id: $id) {
221
- votes(count: $count) {
222
- items {
223
- user {
224
- #{@@user}
225
- }
226
- }
227
- }
228
- }
229
- }"
230
- end
231
-
232
- def Queries.get_comment
233
- "query comment ($id: Int!) {
234
- comment(id: $id) {
235
- #{@@comment}
236
- }
237
- }"
238
- end
239
-
240
- def Queries.get_comments_comments
241
- "query comment ($id: Int!) {
242
- comment(id: $id) {
243
- comments {
244
- #{@@comment}
245
- }
246
- }
247
- }"
248
- end
249
-
250
- def Queries.get_parent_comment
251
- "query comment ($id: Int!) {
252
- comment(id: $id) {
253
- parentComment {
254
- #{@@comment}
255
- }
256
- }
257
- }"
258
- end
259
-
260
- def Queries.get_repl
261
- "query ReplView($url: String!) {
262
- repl(url: $url) {
263
- ... on Repl {
264
- #{@@repl}
265
- }
266
- }
267
- }"
268
- end
269
-
270
- def Queries.get_repl_forks
271
- "query ReplViewForks($url: String!, $count: Int!, $after: String) {
272
- repl(url: $url) {
273
- ... on Repl {
274
- publicForks(count: $count, after: $after) {
275
- items {
276
- #{@@repl}
277
- }
278
- }
279
- }
280
- }
281
- }"
282
- end
283
-
284
- def Queries.get_repl_comments
285
- "query ReplViewComments($url: String!, $count: Int, $after: String) {
286
- repl(url: $url) {
287
- ... on Repl {
288
- comments(count: $count, after: $after) {
289
- items {
290
- #{@@repl_comment}
291
- replies {
292
- #{@@repl_comment}
293
- }
294
- }
295
- }
296
- }
297
- }
298
- }"
299
- end
300
-
301
- def Queries.get_repl_comment
302
- "query ReplViewComment($id: Int!) {
303
- replComment(id: $id) {
304
- ... on ReplComment {
305
- #{@@repl_comment}
306
- }
307
- }
308
- }"
309
- end
310
-
311
-
312
- def Queries.get_board
313
- "query boardBySlug($slug: String!) {
314
- board: boardBySlug(slug: $slug) {
315
- #{@@board}
316
- }
317
- }"
318
- end
319
-
320
- def Queries.get_posts
321
- "query PostsFeed($order: String, $after: String, $searchQuery: String, $languages: [String!], $count: Int, $boardSlugs: [String!], $pinAnnouncements: Boolean, $pinPinned: Boolean) {
322
- posts(order: $order, after: $after, searchQuery: $searchQuery, languages: $languages, count: $count, boardSlugs: $boardSlugs, pinAnnouncements: $pinAnnouncements, pinPinned: $pinPinned) {
323
- items {
324
- #{@@post}
325
- }
326
- }
327
- }"
328
- end
329
-
330
- def Queries.get_leaderboard
331
- "query LeaderboardQuery($count: Int, $after: String, $since: KarmaSince) {
332
- leaderboard(count: $count, after: $after, since: $since) {
333
- items {
334
- #{@@user}
335
- karmaSince: karma(since: $since)
336
- }
337
- }
338
- }"
339
- end
340
- end
341
-
342
-
343
- class Mutations < Queries
344
- def Mutations.create_post
345
- "mutation createPost($input: CreatePostInput!) {
346
- createPost(input: $input) {
347
- post {
348
- #{@@post}
349
- }
350
- }
351
- }"
352
- end
353
-
354
- def Mutations.edit_post
355
- "mutation updatePost($input: UpdatePostInput!) {
356
- updatePost(input: $input) {
357
- post {
358
- #{@@post}
359
- }
360
- }
361
- }
362
- "
363
- end
364
-
365
- def Mutations.delete_post
366
- "mutation deletePost($id: Int!) {
367
- deletePost(id: $id) {
368
- id
369
- }
370
- }"
371
- end
372
-
373
- def Mutations.create_comment
374
- "mutation createComment($input: CreateCommentInput!) {
375
- createComment(input: $input) {
376
- comment {
377
- #{@@comment}
378
- }
379
- }
380
- }"
381
- end
382
-
383
- def Mutations.edit_comment
384
- "mutation updateComment($input: UpdateCommentInput!) {
385
- updateComment(input: $input) {
386
- comment {
387
- #{@@comment}
388
- }
389
- }
390
- }"
391
- end
392
-
393
- def Mutations.delete_comment
394
- "mutation deleteComment($id: Int!) {
395
- deleteComment(id: $id) {
396
- id
397
- }
398
- }"
399
- end
400
-
401
- def Mutations.create_repl_comment
402
- "mutation ReplViewCreateReplComment($input: CreateReplCommentInput!) {
403
- createReplComment(input: $input) {
404
- ... on ReplComment {
405
- #{@@repl_comment}
406
- }
407
- }
408
- }"
409
- end
410
-
411
- def Mutations.reply_repl_comment
412
- "mutation ReplViewCreateReplCommentReply($input: CreateReplCommentReplyInput!) {
413
- createReplCommentReply(input: $input) {
414
- ... on ReplComment {
415
- #{@@repl_comment}
416
- }
417
- }
418
- }"
419
- end
420
-
421
- def Mutations.edit_repl_comment
422
- "mutation ReplViewCommentsUpdateReplComment($input: UpdateReplCommentInput!) {
423
- updateReplComment(input: $input) {
424
- ... on ReplComment {
425
- #{@@repl_comment}
426
- }
427
- }
428
- }"
429
- end
430
-
431
- def Mutations.delete_repl_comment
432
- "mutation ReplViewCommentsDeleteReplComment($id: Int!) {
433
- deleteReplComment(id: $id) {
434
- ... on ReplComment {
435
- id
436
- }
437
- }
438
- }"
439
- end
440
-
441
- def Mutations.report_post
442
- "mutation createBoardReport($id: Int!, $reason: String!) {
443
- createBoardReport(postId: $id, reason: $reason) {
444
- id
445
- }
446
- }"
447
- end
448
-
449
- def Mutations.report_comment
450
- "mutation createBoardReport($id: Int!, $reason: String!) {
451
- createBoardReport(commentId: $id, reason: $reason) {
452
- id
453
- }
454
- }"
455
- end
456
- end