repltalk 1.4.0 → 2.0.1
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.
- checksums.yaml +4 -4
- data/lib/queries.rb +51 -0
- data/lib/repltalk.rb +71 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ada3715121c7d61ea64ba460d56d128540495ad5d0e6e40f7b2b3356449a6928
|
4
|
+
data.tar.gz: f514edbaeb4ffe4bfd90b5d9821329349e5c917d70e7cc91f32c9ce4d74d9684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32cf8cc7d8d8bbcee551ef1fe73ddc1c54102a655fc26d0ea465e77f576ee297f446b4ec9314a9a7e198b9ad9e0566743491a4a52905c3f4ea4e318901b3243f
|
7
|
+
data.tar.gz: a06595ab22910394812a9144bae621a90570a110785c1d5acf1964e8c58737a3d8d0c2b5847817189c410e4c213b483e53e55960821473d1cd6886d55405e37c
|
data/lib/queries.rb
CHANGED
@@ -298,6 +298,17 @@ class Queries
|
|
298
298
|
}"
|
299
299
|
end
|
300
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
|
+
|
301
312
|
def Queries.get_board
|
302
313
|
"query boardBySlug($slug: String!) {
|
303
314
|
board: boardBySlug(slug: $slug) {
|
@@ -387,6 +398,46 @@ class Mutations < Queries
|
|
387
398
|
}"
|
388
399
|
end
|
389
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
|
+
|
390
441
|
def Mutations.report_post
|
391
442
|
"mutation createBoardReport($id: Int!, $reason: String!) {
|
392
443
|
createBoardReport(postId: $id, reason: $reason) {
|
data/lib/repltalk.rb
CHANGED
@@ -76,6 +76,23 @@ end
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
+
class Board
|
80
|
+
attr_reader :id, :name, :color, :description
|
81
|
+
|
82
|
+
def initialize(board)
|
83
|
+
@id = board["id"]
|
84
|
+
@name = board["name"]
|
85
|
+
@color = board["color"]
|
86
|
+
@description = board["description"]
|
87
|
+
end
|
88
|
+
|
89
|
+
def to_s
|
90
|
+
@name
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
|
79
96
|
class ReplComment
|
80
97
|
attr_reader :id, :content, :author, :repl, :replies
|
81
98
|
|
@@ -89,6 +106,40 @@ class ReplComment
|
|
89
106
|
@replies = comment["replies"] == nil ? nil : comment["replies"].map { |c| ReplComment.new(@client, c) }
|
90
107
|
end
|
91
108
|
|
109
|
+
def create_comment(content)
|
110
|
+
c = @client.graphql(
|
111
|
+
"ReplViewCreateReplCommentReply",
|
112
|
+
Mutations.reply_repl_comment,
|
113
|
+
input: {
|
114
|
+
replCommentId: @id,
|
115
|
+
body: content
|
116
|
+
}
|
117
|
+
)
|
118
|
+
ReplComment.new(@client, c["createReplCommentReply"])
|
119
|
+
end
|
120
|
+
|
121
|
+
def edit(content)
|
122
|
+
c = @client.graphql(
|
123
|
+
"ReplViewCommentsUpdateReplComment",
|
124
|
+
Mutations.edit_repl_comment,
|
125
|
+
input: {
|
126
|
+
id: @id,
|
127
|
+
body: content
|
128
|
+
}
|
129
|
+
)
|
130
|
+
puts c
|
131
|
+
ReplComment.new(@client, c["updateReplComment"])
|
132
|
+
end
|
133
|
+
|
134
|
+
def delete
|
135
|
+
@client.graphql(
|
136
|
+
"ReplViewCommentsDeleteReplComment",
|
137
|
+
Mutations.delete_repl_comment,
|
138
|
+
id: @id
|
139
|
+
)
|
140
|
+
nil
|
141
|
+
end
|
142
|
+
|
92
143
|
def to_s
|
93
144
|
@content
|
94
145
|
end
|
@@ -138,25 +189,20 @@ class Repl
|
|
138
189
|
c["repl"]["comments"]["items"].map { |comment| ReplComment.new(@client, comment) }
|
139
190
|
end
|
140
191
|
|
141
|
-
def
|
142
|
-
@
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
def initialize(board)
|
152
|
-
@id = board["id"]
|
153
|
-
@name = board["name"]
|
154
|
-
@color = board["color"]
|
155
|
-
@description = board["description"]
|
192
|
+
def create_comment(content)
|
193
|
+
c = @client.graphql(
|
194
|
+
"ReplViewCreateReplComment",
|
195
|
+
Mutations.create_repl_comment,
|
196
|
+
input: {
|
197
|
+
replId: @id,
|
198
|
+
body: content
|
199
|
+
}
|
200
|
+
)
|
201
|
+
ReplComment.new(@client, c["createReplComment"])
|
156
202
|
end
|
157
203
|
|
158
204
|
def to_s
|
159
|
-
@
|
205
|
+
@title
|
160
206
|
end
|
161
207
|
end
|
162
208
|
|
@@ -528,6 +574,15 @@ class Client
|
|
528
574
|
Repl.new(self, r["repl"])
|
529
575
|
end
|
530
576
|
|
577
|
+
def get_repl_comment(id)
|
578
|
+
c = graphql(
|
579
|
+
"ReplViewComment",
|
580
|
+
Queries.get_repl_comment,
|
581
|
+
id: id
|
582
|
+
)
|
583
|
+
ReplComment.new(self, c["replComment"])
|
584
|
+
end
|
585
|
+
|
531
586
|
def get_board(name)
|
532
587
|
b = graphql(
|
533
588
|
"boardBySlug",
|
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:
|
4
|
+
version: 2.0.1
|
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-
|
11
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|