repltalk 1.1.0 → 2.0.2
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 +114 -0
- data/lib/repltalk.rb +162 -17
- 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: dadabaf060273fe7f67d860c1453b2b4ecaa055cfe75c2a7f04c64c1fafb994d
         | 
| 4 | 
            +
              data.tar.gz: 7b27ee02ccfa0814f0525cccd2add843da6b7ec4fb21609d145c39b6dd4e53d9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4ec71d1e1f75d119786012f7bfebbe424d7ca643422cb6fabeb5785dc1f2c9a624501751a9b401d3e2e8f81f1e6a272794052aaf5c603fd7c702b495c624be87
         | 
| 7 | 
            +
              data.tar.gz: 21a6ce4f2ac9777ac79a1ea1cb18505e4294b7e6c2fe4b00b03771f853212d1311dbb2e91bef4fb5a733be2438ae759d67e2eefae42622a9d15064f311dd1ccd
         | 
    
        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) {
         | 
| @@ -339,4 +350,107 @@ class Mutations < Queries | |
| 339 350 | 
             
            			}
         | 
| 340 351 | 
             
            		}"
         | 
| 341 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
         | 
| 342 456 | 
             
            end
         | 
    
        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 |  | 
| @@ -208,6 +254,50 @@ class Comment | |
| 208 254 | 
             
            		c["comment"]["parentComment"] == nil ? nil : Comment.new(@client, c["comment"]["parentComment"])
         | 
| 209 255 | 
             
            	end
         | 
| 210 256 |  | 
| 257 | 
            +
            	def create_comment(content)
         | 
| 258 | 
            +
            		c = @client.graphql(
         | 
| 259 | 
            +
            			"createComment",
         | 
| 260 | 
            +
            			Mutations.create_comment,
         | 
| 261 | 
            +
            			input: {
         | 
| 262 | 
            +
            				postId: @post_id,
         | 
| 263 | 
            +
            				commentId: @id,
         | 
| 264 | 
            +
            				body: content
         | 
| 265 | 
            +
            			}
         | 
| 266 | 
            +
            		)
         | 
| 267 | 
            +
            		Comment.new(@client, c["createComment"]["comment"])
         | 
| 268 | 
            +
            	end
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            	def edit(content)
         | 
| 271 | 
            +
            		c = @client.graphql(
         | 
| 272 | 
            +
            			"updateComment",
         | 
| 273 | 
            +
            			Mutations.edit_comment,
         | 
| 274 | 
            +
            			input: {
         | 
| 275 | 
            +
            				id: @id,
         | 
| 276 | 
            +
            				body: content
         | 
| 277 | 
            +
            			}
         | 
| 278 | 
            +
            		)
         | 
| 279 | 
            +
            		Comment.new(@client, c["updateComment"]["comment"])
         | 
| 280 | 
            +
            	end
         | 
| 281 | 
            +
             | 
| 282 | 
            +
            	def delete
         | 
| 283 | 
            +
            		@client.graphql(
         | 
| 284 | 
            +
            			"deleteComment",
         | 
| 285 | 
            +
            			Mutations.delete_comment,
         | 
| 286 | 
            +
            			id: @id
         | 
| 287 | 
            +
            		)
         | 
| 288 | 
            +
            		nil
         | 
| 289 | 
            +
            	end
         | 
| 290 | 
            +
             | 
| 291 | 
            +
            	def report(reason)
         | 
| 292 | 
            +
            		@client.graphql(
         | 
| 293 | 
            +
            			"createBoardReport",
         | 
| 294 | 
            +
            			Mutations.report_comment,
         | 
| 295 | 
            +
            			id: @id,
         | 
| 296 | 
            +
            			reason: reason
         | 
| 297 | 
            +
            		)
         | 
| 298 | 
            +
            		nil
         | 
| 299 | 
            +
            	end
         | 
| 300 | 
            +
             | 
| 211 301 | 
             
            	def to_s
         | 
| 212 302 | 
             
            		@content
         | 
| 213 303 | 
             
            	end
         | 
| @@ -270,6 +360,52 @@ class Post | |
| 270 360 | 
             
            		u["post"]["votes"]["items"].map { |vote| User.new(@client, vote["user"]) }
         | 
| 271 361 | 
             
            	end
         | 
| 272 362 |  | 
| 363 | 
            +
            	def create_comment(content)
         | 
| 364 | 
            +
            		c = @client.graphql(
         | 
| 365 | 
            +
            			"createComment",
         | 
| 366 | 
            +
            			Mutations.create_comment,
         | 
| 367 | 
            +
            			input: {
         | 
| 368 | 
            +
            				postId: @id,
         | 
| 369 | 
            +
            				body: content
         | 
| 370 | 
            +
            			}
         | 
| 371 | 
            +
            		)
         | 
| 372 | 
            +
            		Comment.new(@client, c["createComment"]["comment"])
         | 
| 373 | 
            +
            	end
         | 
| 374 | 
            +
             | 
| 375 | 
            +
            	def edit(title: @title, content: @content, repl_id: @repl.id, show_hosted: false)
         | 
| 376 | 
            +
            		p = @client.graphql(
         | 
| 377 | 
            +
            			"updatePost",
         | 
| 378 | 
            +
            			Mutations.edit_post,
         | 
| 379 | 
            +
            			input: {
         | 
| 380 | 
            +
            				id: @id,
         | 
| 381 | 
            +
            				title: title,
         | 
| 382 | 
            +
            				body: content,
         | 
| 383 | 
            +
            				replId: repl_id,
         | 
| 384 | 
            +
            				showHosted: show_hosted
         | 
| 385 | 
            +
            			}
         | 
| 386 | 
            +
            		)
         | 
| 387 | 
            +
            		Post.new(@client, p["updatePost"]["post"])
         | 
| 388 | 
            +
            	end
         | 
| 389 | 
            +
             | 
| 390 | 
            +
            	def delete
         | 
| 391 | 
            +
            		@client.graphql(
         | 
| 392 | 
            +
            			"deletePost",
         | 
| 393 | 
            +
            			Mutations.delete_post,
         | 
| 394 | 
            +
            			id: @id
         | 
| 395 | 
            +
            		)
         | 
| 396 | 
            +
            		nil
         | 
| 397 | 
            +
            	end
         | 
| 398 | 
            +
             | 
| 399 | 
            +
            	def report(reason)
         | 
| 400 | 
            +
            		@client.graphql(
         | 
| 401 | 
            +
            			"createBoardReport",
         | 
| 402 | 
            +
            			Mutations.report_post,
         | 
| 403 | 
            +
            			id: @id,
         | 
| 404 | 
            +
            			reason: reason
         | 
| 405 | 
            +
            		)
         | 
| 406 | 
            +
            		nil
         | 
| 407 | 
            +
            	end
         | 
| 408 | 
            +
             | 
| 273 409 | 
             
            	def to_s
         | 
| 274 410 | 
             
            		@title
         | 
| 275 411 | 
             
            	end
         | 
| @@ -438,6 +574,15 @@ class Client | |
| 438 574 | 
             
            		Repl.new(self, r["repl"])
         | 
| 439 575 | 
             
            	end
         | 
| 440 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 | 
            +
             | 
| 441 586 | 
             
            	def get_board(name)
         | 
| 442 587 | 
             
            		b = graphql(
         | 
| 443 588 | 
             
            			"boardBySlug",
         | 
| @@ -462,7 +607,7 @@ class Client | |
| 462 607 | 
             
            		p = graphql(
         | 
| 463 608 | 
             
            			"PostsFeed",
         | 
| 464 609 | 
             
            			Queries.get_posts,
         | 
| 465 | 
            -
            			 | 
| 610 | 
            +
            			boardSlugs: [board],
         | 
| 466 611 | 
             
            			order: order,
         | 
| 467 612 | 
             
            			count: count,
         | 
| 468 613 | 
             
            			after: after,
         | 
    
        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.2
         | 
| 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-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: http
         |