repltalk 1.2.0 → 1.3.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/queries.rb +37 -0
  3. data/lib/repltalk.rb +45 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a90787033dba7f358725b78a75e013fe4dce8f6ba58129097efbebf908bb74ea
4
- data.tar.gz: de1143f3aa2068eef3a62e781bd3cea4bc734623f39167b7a38f77538eb77bc8
3
+ metadata.gz: ade4342442037dfec06df6d42dc4fb825aa0ae28020a9a65a8cc6072ff1d5a83
4
+ data.tar.gz: eabb22b821d0170bbec6a1cdcf1a9b8ab877d7cf5c746796ed56d098fa07b23f
5
5
  SHA512:
6
- metadata.gz: 9695086e996e64538e30321da4163b3891e0f72561f97e1a329346dd681de05c62fd8cebacd0b6301986d1ce5b57513395057c6c64f260dbb12640a391ac7831
7
- data.tar.gz: 5b940e9378ef07c3f42b1b7cd2ce1906a6acebbe470bcc67bfec605c8cbdcb3e0ffedaa8bc6c35fad91618ed4e77e1992f60788283e46f857a68220c6c6029ea
6
+ metadata.gz: 8e1d95df4fa09ec118ee4d82115652831fded6cb0b9b55b09045d68f7ff0cc48c975a28de0b6e207de5d786c8ebc3f1482cdf4225b80f06baf407074e10b264c
7
+ data.tar.gz: fc16a9bccab5cca65fa7041b9dce1720198d686582a47beb64310c0b6eb3d5e5359685bfbdd5120366d3df797608468e11040b9d5fce1cdaa32d98dd126ad7c7
data/lib/queries.rb CHANGED
@@ -340,6 +340,25 @@ class Mutations < Queries
340
340
  }"
341
341
  end
342
342
 
343
+ def Mutations.edit_post
344
+ "mutation updatePost($input: UpdatePostInput!) {
345
+ updatePost(input: $input) {
346
+ post {
347
+ #{@@post}
348
+ }
349
+ }
350
+ }
351
+ "
352
+ end
353
+
354
+ def Mutations.delete_post
355
+ "mutation deletePost($id: Int!) {
356
+ deletePost(id: $id) {
357
+ id
358
+ }
359
+ }"
360
+ end
361
+
343
362
  def Mutations.create_comment
344
363
  "mutation createComment($input: CreateCommentInput!) {
345
364
  createComment(input: $input) {
@@ -349,4 +368,22 @@ class Mutations < Queries
349
368
  }
350
369
  }"
351
370
  end
371
+
372
+ def Mutations.edit_comment
373
+ "mutation updateComment($input: UpdateCommentInput!) {
374
+ updateComment(input: $input) {
375
+ comment {
376
+ #{@@comment}
377
+ }
378
+ }
379
+ }"
380
+ end
381
+
382
+ def Mutations.delete_comment
383
+ "mutation deleteComment($id: Int!) {
384
+ deleteComment(id: $id) {
385
+ id
386
+ }
387
+ }"
388
+ end
352
389
  end
data/lib/repltalk.rb CHANGED
@@ -221,6 +221,27 @@ class Comment
221
221
  Comment.new(@client, c["createComment"]["comment"])
222
222
  end
223
223
 
224
+ def edit(content)
225
+ c = @client.graphql(
226
+ "updateComment",
227
+ Mutations.edit_comment,
228
+ input: {
229
+ id: @id,
230
+ body: content
231
+ }
232
+ )
233
+ Comment.new(@client, c["updateComment"]["comment"])
234
+ end
235
+
236
+ def delete
237
+ @client.graphql(
238
+ "deleteComment",
239
+ Mutations.delete_comment,
240
+ id: @id
241
+ )
242
+ nil
243
+ end
244
+
224
245
  def to_s
225
246
  @content
226
247
  end
@@ -295,6 +316,30 @@ class Post
295
316
  Comment.new(@client, c["createComment"]["comment"])
296
317
  end
297
318
 
319
+ def edit(title: @title, content: @content, repl_id: @repl.id, show_hosted: false)
320
+ p = @client.graphql(
321
+ "updatePost",
322
+ Mutations.edit_post,
323
+ input: {
324
+ id: @id,
325
+ title: title,
326
+ body: content,
327
+ replId: repl_id,
328
+ showHosted: show_hosted
329
+ }
330
+ )
331
+ Post.new(@client, p["updatePost"]["post"])
332
+ end
333
+
334
+ def delete
335
+ @client.graphql(
336
+ "deletePost",
337
+ Mutations.delete_post,
338
+ id: @id
339
+ )
340
+ nil
341
+ end
342
+
298
343
  def to_s
299
344
  @title
300
345
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repltalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CodingCactus