repltalk 1.2.0 → 1.3.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 +37 -0
- data/lib/repltalk.rb +45 -0
- 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: ade4342442037dfec06df6d42dc4fb825aa0ae28020a9a65a8cc6072ff1d5a83
|
4
|
+
data.tar.gz: eabb22b821d0170bbec6a1cdcf1a9b8ab877d7cf5c746796ed56d098fa07b23f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|