repltalk 1.0.1 → 1.1.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.
- checksums.yaml +4 -4
- data/lib/queries.rb +21 -0
- data/lib/repltalk.rb +24 -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: f298413413c3c3b6cf63fabc23de37dd86117011d8980b533b5d381769ed5fbd
         | 
| 4 | 
            +
              data.tar.gz: 0a9bdac51d43d47c639f4c8eb64d7e40951de9302cb805b7a5bf40d4504dd38b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: db03ee9bc966d0b3af618b14d2075b3b5037cc6698dac4587c1fa3a8f55c098e1bee72ca09665f0eea3f7475db3fd8fc8cde96981a9a854e11c45f8820df1ffc
         | 
| 7 | 
            +
              data.tar.gz: 2213d3a581ccc4144ac4359835b36ee2b62e3b0f900aa55863fd28ec1e4ded0f097d15588af9968038ea49080904217dbd1556e92f8cb281c21dfb4828f9798a
         | 
    
        data/lib/queries.rb
    CHANGED
    
    | @@ -298,6 +298,14 @@ class Queries | |
| 298 298 | 
             
            		}"
         | 
| 299 299 | 
             
            	end
         | 
| 300 300 |  | 
| 301 | 
            +
            	def Queries.get_board
         | 
| 302 | 
            +
            		"query boardBySlug($slug: String!) {
         | 
| 303 | 
            +
            			board: boardBySlug(slug: $slug) {
         | 
| 304 | 
            +
            				#{@@board}
         | 
| 305 | 
            +
            			}
         | 
| 306 | 
            +
            		}"
         | 
| 307 | 
            +
            	end
         | 
| 308 | 
            +
             | 
| 301 309 | 
             
            	def Queries.get_posts
         | 
| 302 310 | 
             
            		"query PostsFeed($order: String, $after: String, $searchQuery: String, $languages: [String!], $count: Int, $boardSlugs: [String!], $pinAnnouncements: Boolean, $pinPinned: Boolean) {
         | 
| 303 311 | 
             
            			posts(order: $order, after: $after, searchQuery: $searchQuery, languages: $languages, count: $count, boardSlugs: $boardSlugs, pinAnnouncements: $pinAnnouncements, pinPinned: $pinPinned) {
         | 
| @@ -318,4 +326,17 @@ class Queries | |
| 318 326 | 
             
            			}
         | 
| 319 327 | 
             
            		}"
         | 
| 320 328 | 
             
            	end
         | 
| 329 | 
            +
            end
         | 
| 330 | 
            +
             | 
| 331 | 
            +
             | 
| 332 | 
            +
            class Mutations < Queries
         | 
| 333 | 
            +
            	def Mutations.create_post
         | 
| 334 | 
            +
            		"mutation createPost($input: CreatePostInput!) {
         | 
| 335 | 
            +
            			createPost(input: $input) {
         | 
| 336 | 
            +
            				post {
         | 
| 337 | 
            +
            					#{@@post}
         | 
| 338 | 
            +
            				}
         | 
| 339 | 
            +
            			}
         | 
| 340 | 
            +
            		}"
         | 
| 341 | 
            +
            	end
         | 
| 321 342 | 
             
            end
         | 
    
        data/lib/repltalk.rb
    CHANGED
    
    | @@ -438,6 +438,15 @@ class Client | |
| 438 438 | 
             
            		Repl.new(self, r["repl"])
         | 
| 439 439 | 
             
            	end
         | 
| 440 440 |  | 
| 441 | 
            +
            	def get_board(name)
         | 
| 442 | 
            +
            		b = graphql(
         | 
| 443 | 
            +
            			"boardBySlug",
         | 
| 444 | 
            +
            			Queries.get_board,
         | 
| 445 | 
            +
            			slug: name
         | 
| 446 | 
            +
            		)
         | 
| 447 | 
            +
            		Board.new(b["board"])
         | 
| 448 | 
            +
            	end
         | 
| 449 | 
            +
             | 
| 441 450 | 
             
            	def get_leaderboard(count: nil, since: nil, after: nil)
         | 
| 442 451 | 
             
            		u = graphql(
         | 
| 443 452 | 
             
            			"LeaderboardQuery",
         | 
| @@ -462,4 +471,19 @@ class Client | |
| 462 471 | 
             
            		)
         | 
| 463 472 | 
             
            		p["posts"]["items"].map { |post| Post.new(self, post) }
         | 
| 464 473 | 
             
            	end
         | 
| 474 | 
            +
             | 
| 475 | 
            +
            	def create_post(board_name, title, content, repl_id: nil, show_hosted: false)
         | 
| 476 | 
            +
            		p = graphql(
         | 
| 477 | 
            +
            			"createPost",
         | 
| 478 | 
            +
            			Mutations.create_post,
         | 
| 479 | 
            +
            			input: {
         | 
| 480 | 
            +
            				boardId: get_board(board_name).id,
         | 
| 481 | 
            +
            				title: title,
         | 
| 482 | 
            +
            				body: content,
         | 
| 483 | 
            +
            				replId: repl_id,
         | 
| 484 | 
            +
            				showHosted: show_hosted
         | 
| 485 | 
            +
            			}
         | 
| 486 | 
            +
            		)
         | 
| 487 | 
            +
            		Post.new(self, p["createPost"]["post"])
         | 
| 488 | 
            +
            	end
         | 
| 465 489 | 
             
            end
         |