repltalk 0.0.1 → 0.1.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 +302 -1
- data/lib/repltalk.rb +155 -14
- metadata +33 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1f693b0e2f8cc3d1bcf1b646f02c8a551053f35b37f42aa5a6849a1cefcb086b
         | 
| 4 | 
            +
              data.tar.gz: 29a598f83669519a169a2b7717e01cb53531b87e7651349e181f59b01558888a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9ec56f08034f1a82e343d4bca650a418ad2fba543e89e9d12ccf7c0d4e9435bffe5856194b4352c8de6cb0f28de22f884135399ba66d9eb5165050a947779481
         | 
| 7 | 
            +
              data.tar.gz: 7fdcd18d242c366c0a249e31e5fb7b20b6e900e2dfeefa0c583772d13d161ebf171414721418179cc2ec63fc18facf0bbdf166843f4ba0e88d0fe9a4ceca1fb3
         | 
    
        data/lib/queries.rb
    CHANGED
    
    | @@ -1,5 +1,306 @@ | |
| 1 1 | 
             
            class Queries
         | 
| 2 2 | 
             
            	def Queries.get_user
         | 
| 3 | 
            -
            		"query userByUsername($username: String!) { | 
| 3 | 
            +
            		"query userByUsername($username: String!) {
         | 
| 4 | 
            +
            			user: userByUsername(username: $username) {
         | 
| 5 | 
            +
            				id
         | 
| 6 | 
            +
            				username
         | 
| 7 | 
            +
            				fullName
         | 
| 8 | 
            +
            				image
         | 
| 9 | 
            +
            				url
         | 
| 10 | 
            +
            				...ProfileHeaderUser
         | 
| 11 | 
            +
            				__typename
         | 
| 12 | 
            +
            			}
         | 
| 13 | 
            +
            		}
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            		fragment ProfileHeaderUser on User {
         | 
| 16 | 
            +
            			id
         | 
| 17 | 
            +
            			fullName
         | 
| 18 | 
            +
            			username
         | 
| 19 | 
            +
            			image
         | 
| 20 | 
            +
            			bio
         | 
| 21 | 
            +
            			karma
         | 
| 22 | 
            +
            			isHacker
         | 
| 23 | 
            +
            			roles {
         | 
| 24 | 
            +
            				id
         | 
| 25 | 
            +
            				name
         | 
| 26 | 
            +
            				key
         | 
| 27 | 
            +
            				tagline
         | 
| 28 | 
            +
            				__typename
         | 
| 29 | 
            +
            			}
         | 
| 30 | 
            +
            			organization {
         | 
| 31 | 
            +
            				id
         | 
| 32 | 
            +
            				name
         | 
| 33 | 
            +
            				__typename
         | 
| 34 | 
            +
            			}
         | 
| 35 | 
            +
            			languages {
         | 
| 36 | 
            +
            				id
         | 
| 37 | 
            +
            				key
         | 
| 38 | 
            +
            				displayName
         | 
| 39 | 
            +
            				tagline
         | 
| 40 | 
            +
            				icon
         | 
| 41 | 
            +
            				__typename
         | 
| 42 | 
            +
            			}
         | 
| 43 | 
            +
            			__typename
         | 
| 44 | 
            +
            		}"
         | 
| 45 | 
            +
            	end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            	def Queries.get_user_by_id
         | 
| 48 | 
            +
            		"query user($user_id: Int!) {
         | 
| 49 | 
            +
            			user: user(id: $user_id) {
         | 
| 50 | 
            +
            				id
         | 
| 51 | 
            +
            				username
         | 
| 52 | 
            +
            				fullName
         | 
| 53 | 
            +
            				image
         | 
| 54 | 
            +
            				url
         | 
| 55 | 
            +
            				...ProfileHeaderUser
         | 
| 56 | 
            +
            				__typename
         | 
| 57 | 
            +
            			}
         | 
| 58 | 
            +
            		}
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            		fragment ProfileHeaderUser on User {
         | 
| 61 | 
            +
            			id
         | 
| 62 | 
            +
            			fullName
         | 
| 63 | 
            +
            			username
         | 
| 64 | 
            +
            			image
         | 
| 65 | 
            +
            			bio
         | 
| 66 | 
            +
            			karma
         | 
| 67 | 
            +
            			isHacker
         | 
| 68 | 
            +
            			roles {
         | 
| 69 | 
            +
            				id
         | 
| 70 | 
            +
            				name
         | 
| 71 | 
            +
            				key
         | 
| 72 | 
            +
            				tagline
         | 
| 73 | 
            +
            				__typename
         | 
| 74 | 
            +
            			}
         | 
| 75 | 
            +
            			organization {
         | 
| 76 | 
            +
            				id
         | 
| 77 | 
            +
            				name
         | 
| 78 | 
            +
            				__typename
         | 
| 79 | 
            +
            			}
         | 
| 80 | 
            +
            			languages {
         | 
| 81 | 
            +
            				id
         | 
| 82 | 
            +
            				key
         | 
| 83 | 
            +
            				displayName
         | 
| 84 | 
            +
            				tagline
         | 
| 85 | 
            +
            				icon
         | 
| 86 | 
            +
            				__typename
         | 
| 87 | 
            +
            			}
         | 
| 88 | 
            +
            			__typename
         | 
| 89 | 
            +
            		}"
         | 
| 90 | 
            +
            	end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            	def Queries.get_user_posts
         | 
| 93 | 
            +
            		"query ProfilePosts($username: String!, $after: String, $order: String, $count: Int) {
         | 
| 94 | 
            +
            			user: userByUsername(username: $username) {
         | 
| 95 | 
            +
            				id
         | 
| 96 | 
            +
            				displayName
         | 
| 97 | 
            +
            				posts(after: $after, order: $order, count: $count) {
         | 
| 98 | 
            +
            					items {
         | 
| 99 | 
            +
            						id
         | 
| 100 | 
            +
            						isHidden
         | 
| 101 | 
            +
            						...PostsFeedItemPost
         | 
| 102 | 
            +
            						board {
         | 
| 103 | 
            +
            							id
         | 
| 104 | 
            +
            							name
         | 
| 105 | 
            +
            							url
         | 
| 106 | 
            +
            							color
         | 
| 107 | 
            +
            							__typename
         | 
| 108 | 
            +
            						}
         | 
| 109 | 
            +
            						__typename
         | 
| 110 | 
            +
            					}
         | 
| 111 | 
            +
            					pageInfo {
         | 
| 112 | 
            +
            						nextCursor
         | 
| 113 | 
            +
            						__typename
         | 
| 114 | 
            +
            					}
         | 
| 115 | 
            +
            					__typename
         | 
| 116 | 
            +
            				}
         | 
| 117 | 
            +
            				__typename
         | 
| 118 | 
            +
            			}
         | 
| 119 | 
            +
            		}
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            		fragment PostsFeedItemPost on Post {
         | 
| 122 | 
            +
            			id
         | 
| 123 | 
            +
            			title
         | 
| 124 | 
            +
            			body
         | 
| 125 | 
            +
            			preview(removeMarkdown: true, length: 150)
         | 
| 126 | 
            +
            			url
         | 
| 127 | 
            +
            			commentCount
         | 
| 128 | 
            +
            			isPinned
         | 
| 129 | 
            +
            			isLocked
         | 
| 130 | 
            +
            			isAnnouncement
         | 
| 131 | 
            +
            			timeCreated
         | 
| 132 | 
            +
            			isAnswered
         | 
| 133 | 
            +
            			isAnswerable
         | 
| 134 | 
            +
            			...PostVoteControlPost
         | 
| 135 | 
            +
            			...PostLinkPost
         | 
| 136 | 
            +
            			user {
         | 
| 137 | 
            +
            				id
         | 
| 138 | 
            +
            				username
         | 
| 139 | 
            +
            				isHacker
         | 
| 140 | 
            +
            				image
         | 
| 141 | 
            +
            				...UserLabelUser
         | 
| 142 | 
            +
            				...UserLinkUser
         | 
| 143 | 
            +
            				__typename
         | 
| 144 | 
            +
            			}
         | 
| 145 | 
            +
            			repl {
         | 
| 146 | 
            +
            				id
         | 
| 147 | 
            +
            				url
         | 
| 148 | 
            +
            				title
         | 
| 149 | 
            +
            				description
         | 
| 150 | 
            +
            				isPrivate
         | 
| 151 | 
            +
            				isAlwaysOn
         | 
| 152 | 
            +
            				lang {
         | 
| 153 | 
            +
            					id
         | 
| 154 | 
            +
            					icon
         | 
| 155 | 
            +
            					key
         | 
| 156 | 
            +
            					displayName
         | 
| 157 | 
            +
            					tagline
         | 
| 158 | 
            +
            					__typename
         | 
| 159 | 
            +
            				}
         | 
| 160 | 
            +
            				__typename
         | 
| 161 | 
            +
            			}
         | 
| 162 | 
            +
            			board {
         | 
| 163 | 
            +
            				id
         | 
| 164 | 
            +
            				name
         | 
| 165 | 
            +
            				color
         | 
| 166 | 
            +
            				__typename
         | 
| 167 | 
            +
            			}
         | 
| 168 | 
            +
            		}
         | 
| 169 | 
            +
             | 
| 170 | 
            +
            		fragment PostVoteControlPost on Post {
         | 
| 171 | 
            +
            			id
         | 
| 172 | 
            +
            			voteCount
         | 
| 173 | 
            +
            			canVote
         | 
| 174 | 
            +
            			hasVoted
         | 
| 175 | 
            +
            			__typename
         | 
| 176 | 
            +
            		}
         | 
| 177 | 
            +
             | 
| 178 | 
            +
            		fragment PostLinkPost on Post {
         | 
| 179 | 
            +
            			id
         | 
| 180 | 
            +
            			url
         | 
| 181 | 
            +
            			__typename
         | 
| 182 | 
            +
            		}
         | 
| 183 | 
            +
             | 
| 184 | 
            +
            		fragment UserLabelUser on User {
         | 
| 185 | 
            +
            			id
         | 
| 186 | 
            +
            			username
         | 
| 187 | 
            +
            			karma
         | 
| 188 | 
            +
            			...UserLinkUser
         | 
| 189 | 
            +
            			__typename
         | 
| 190 | 
            +
            		}
         | 
| 191 | 
            +
             | 
| 192 | 
            +
            		fragment UserLinkUser on User {
         | 
| 193 | 
            +
            			id
         | 
| 194 | 
            +
            			url
         | 
| 195 | 
            +
            			username
         | 
| 196 | 
            +
            			roles {
         | 
| 197 | 
            +
            				id
         | 
| 198 | 
            +
            				name
         | 
| 199 | 
            +
            				key
         | 
| 200 | 
            +
            				tagline
         | 
| 201 | 
            +
            				__typename
         | 
| 202 | 
            +
            			}
         | 
| 203 | 
            +
            			organization {
         | 
| 204 | 
            +
            				id
         | 
| 205 | 
            +
            				name
         | 
| 206 | 
            +
            				__typename
         | 
| 207 | 
            +
            			}
         | 
| 208 | 
            +
            			languages {
         | 
| 209 | 
            +
            				id
         | 
| 210 | 
            +
            				key
         | 
| 211 | 
            +
            				displayName
         | 
| 212 | 
            +
            				tagline
         | 
| 213 | 
            +
            				icon
         | 
| 214 | 
            +
            				__typename
         | 
| 215 | 
            +
            			}
         | 
| 216 | 
            +
            			__typename
         | 
| 217 | 
            +
            		}"
         | 
| 218 | 
            +
            	end
         | 
| 219 | 
            +
             | 
| 220 | 
            +
            	def Queries.get_user_comments
         | 
| 221 | 
            +
            		"query ProfileComments($username: String!, $after: String, $order: String, $count: Int) {
         | 
| 222 | 
            +
            			user: userByUsername(username: $username) {
         | 
| 223 | 
            +
            				id
         | 
| 224 | 
            +
            				displayName
         | 
| 225 | 
            +
            				comments(after: $after, order: $order, count: $count) {
         | 
| 226 | 
            +
            					items {
         | 
| 227 | 
            +
            						id
         | 
| 228 | 
            +
            						...ProfileCommentsComment
         | 
| 229 | 
            +
            						__typename
         | 
| 230 | 
            +
            					}
         | 
| 231 | 
            +
            					pageInfo {
         | 
| 232 | 
            +
            						nextCursor
         | 
| 233 | 
            +
            						__typename
         | 
| 234 | 
            +
            					}
         | 
| 235 | 
            +
            					__typename
         | 
| 236 | 
            +
            				}
         | 
| 237 | 
            +
            				__typename
         | 
| 238 | 
            +
            			}
         | 
| 239 | 
            +
            		}
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            		fragment ProfileCommentsComment on Comment {
         | 
| 242 | 
            +
            			id
         | 
| 243 | 
            +
            			body
         | 
| 244 | 
            +
            			timeCreated
         | 
| 245 | 
            +
            			url
         | 
| 246 | 
            +
            			...CommentVoteControlComment
         | 
| 247 | 
            +
            			user {
         | 
| 248 | 
            +
            				id
         | 
| 249 | 
            +
            				fullName
         | 
| 250 | 
            +
            				username
         | 
| 251 | 
            +
            				image
         | 
| 252 | 
            +
            				bio
         | 
| 253 | 
            +
            				karma
         | 
| 254 | 
            +
            				isHacker
         | 
| 255 | 
            +
            				roles {
         | 
| 256 | 
            +
            					id
         | 
| 257 | 
            +
            					name
         | 
| 258 | 
            +
            					key
         | 
| 259 | 
            +
            					tagline
         | 
| 260 | 
            +
            					__typename
         | 
| 261 | 
            +
            				}
         | 
| 262 | 
            +
            				organization {
         | 
| 263 | 
            +
            					id
         | 
| 264 | 
            +
            					name
         | 
| 265 | 
            +
            					__typename
         | 
| 266 | 
            +
            				}
         | 
| 267 | 
            +
            				languages {
         | 
| 268 | 
            +
            					id
         | 
| 269 | 
            +
            					key
         | 
| 270 | 
            +
            					displayName
         | 
| 271 | 
            +
            					tagline
         | 
| 272 | 
            +
            					icon
         | 
| 273 | 
            +
            					__typename
         | 
| 274 | 
            +
            				}
         | 
| 275 | 
            +
            			}
         | 
| 276 | 
            +
            			post {
         | 
| 277 | 
            +
            				id
         | 
| 278 | 
            +
            				title
         | 
| 279 | 
            +
            				url
         | 
| 280 | 
            +
            				user {
         | 
| 281 | 
            +
            					id
         | 
| 282 | 
            +
            					username
         | 
| 283 | 
            +
            					url
         | 
| 284 | 
            +
            					__typename
         | 
| 285 | 
            +
            				}
         | 
| 286 | 
            +
            				board {
         | 
| 287 | 
            +
            					id
         | 
| 288 | 
            +
            					name
         | 
| 289 | 
            +
            					url
         | 
| 290 | 
            +
            					slug
         | 
| 291 | 
            +
            					__typename
         | 
| 292 | 
            +
            				}
         | 
| 293 | 
            +
            				__typename
         | 
| 294 | 
            +
            			}
         | 
| 295 | 
            +
            			__typename
         | 
| 296 | 
            +
            		}
         | 
| 297 | 
            +
             | 
| 298 | 
            +
            		fragment CommentVoteControlComment on Comment {
         | 
| 299 | 
            +
            			id
         | 
| 300 | 
            +
            			voteCount
         | 
| 301 | 
            +
            			canVote
         | 
| 302 | 
            +
            			hasVoted
         | 
| 303 | 
            +
            			__typename
         | 
| 304 | 
            +
            		}"
         | 
| 4 305 | 
             
            	end
         | 
| 5 306 | 
             
            end
         | 
    
        data/lib/repltalk.rb
    CHANGED
    
    | @@ -16,6 +16,19 @@ class Role | |
| 16 16 | 
             
            	end
         | 
| 17 17 | 
             
            end
         | 
| 18 18 |  | 
| 19 | 
            +
            class Organization
         | 
| 20 | 
            +
            	attr_reader :id, :name
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            	def initialize(organization)
         | 
| 23 | 
            +
            		@id = organization["id"]
         | 
| 24 | 
            +
            		@name = organization["name"]
         | 
| 25 | 
            +
            	end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            	def to_s
         | 
| 28 | 
            +
            		@name
         | 
| 29 | 
            +
            	end
         | 
| 30 | 
            +
            end
         | 
| 31 | 
            +
             | 
| 19 32 | 
             
            class Language
         | 
| 20 33 | 
             
            	attr_reader :id, :key, :name, :tagline, :icon
         | 
| 21 34 |  | 
| @@ -32,10 +45,103 @@ class Language | |
| 32 45 | 
             
            	end
         | 
| 33 46 | 
             
            end
         | 
| 34 47 |  | 
| 48 | 
            +
            class Repl
         | 
| 49 | 
            +
            	attr_reader :id, :url, :title, :description, :language, :is_private, :is_always_on
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            	def initialize(repl)
         | 
| 52 | 
            +
            		@id = repl["id"]
         | 
| 53 | 
            +
            		@url = repl["url"]
         | 
| 54 | 
            +
            		@title = repl["title"]
         | 
| 55 | 
            +
            		@description = repl["description"]
         | 
| 56 | 
            +
            		@language = Language.new(repl["lang"])
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            		@is_private = repl["isPrivate"]
         | 
| 59 | 
            +
            		@is_always_on = repl["isAlwaysOn"]
         | 
| 60 | 
            +
            	end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            	def to_s
         | 
| 63 | 
            +
            		@title
         | 
| 64 | 
            +
            	end
         | 
| 65 | 
            +
            end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            class Board
         | 
| 68 | 
            +
            	attr_reader :id, :name, :color
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            	def initialize(board)
         | 
| 71 | 
            +
            		@id = board["id"]
         | 
| 72 | 
            +
            		@name = board["name"]
         | 
| 73 | 
            +
            		@color = board["color"]
         | 
| 74 | 
            +
            	end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            	def to_s
         | 
| 77 | 
            +
            		@name
         | 
| 78 | 
            +
            	end
         | 
| 79 | 
            +
            end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            class Comment
         | 
| 82 | 
            +
            	attr_reader :id, :url, :author, :content, :vote_count, :can_vote, :has_voted
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            	def initialize(client, comment)
         | 
| 85 | 
            +
            		@client = client
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            		@id = comment["id"]
         | 
| 88 | 
            +
            		@url = comment["url"]
         | 
| 89 | 
            +
            		@author = User.new(@client, comment["user"])
         | 
| 90 | 
            +
            		@content = comment["body"]
         | 
| 91 | 
            +
            		@vote_count = comment["voteCount"]
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            		@can_vote = comment["canVote"]
         | 
| 94 | 
            +
            		@has_voted = comment["hasVoted"]
         | 
| 95 | 
            +
            	end
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            	def to_s
         | 
| 98 | 
            +
            		@content
         | 
| 99 | 
            +
            	end
         | 
| 100 | 
            +
            end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
            class Post
         | 
| 103 | 
            +
            	attr_reader :id, :url, :repl, :board, :title, :author, :content, :preview, :timestamp, :vote_count, :comment_count, :can_vote, :has_voted, :is_anwered, :is_answerable, :is_hidden, :is_pinned, :is_locked, :is_announcement
         | 
| 104 | 
            +
             | 
| 105 | 
            +
            	def initialize(client, post)
         | 
| 106 | 
            +
            		@client = client
         | 
| 107 | 
            +
            		
         | 
| 108 | 
            +
            		@id = post["id"]
         | 
| 109 | 
            +
            		@url = post["url"]
         | 
| 110 | 
            +
            		@title = post["title"]
         | 
| 111 | 
            +
            		@content = post["body"]
         | 
| 112 | 
            +
            		@preview = post["preview"]
         | 
| 113 | 
            +
            		@timestamp = post["timeCreated"]
         | 
| 114 | 
            +
             | 
| 115 | 
            +
            		@board = Board.new(post["board"])
         | 
| 116 | 
            +
            		@author = User.new(@client, post["user"])
         | 
| 117 | 
            +
            		@repl = post["repl"] == nil ? nil : Repl.new(post["repl"])
         | 
| 118 | 
            +
             | 
| 119 | 
            +
            		@vote_count = post["voteCount"]
         | 
| 120 | 
            +
            		@comment_count = post["commentCount"]
         | 
| 121 | 
            +
             | 
| 122 | 
            +
            		@can_vote = post["canVote"]
         | 
| 123 | 
            +
            		@has_voted = post["hasVoted"]
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            		@is_answered = post["isAnswered"]
         | 
| 126 | 
            +
            		@is_answerable = post["isAnswerable"]
         | 
| 127 | 
            +
             | 
| 128 | 
            +
            		@is_hidden = post["isHidden"]
         | 
| 129 | 
            +
            		@is_pinned = post["isPinned"]
         | 
| 130 | 
            +
            		@is_locked = post["isLocked"]
         | 
| 131 | 
            +
            		@is_announcement = post["isAnnouncement"]
         | 
| 132 | 
            +
            	end
         | 
| 133 | 
            +
             | 
| 134 | 
            +
            	def to_s
         | 
| 135 | 
            +
            		@title
         | 
| 136 | 
            +
            	end
         | 
| 137 | 
            +
            end
         | 
| 138 | 
            +
             | 
| 35 139 | 
             
            class User
         | 
| 36 | 
            -
            	attr_reader :id, :username, :name, :pfp, :bio, :cycles, :is_hacker, :roles, :languages
         | 
| 140 | 
            +
            	attr_reader :id, :username, :name, :pfp, :bio, :cycles, :is_hacker, :roles, :organization, :languages
         | 
| 141 | 
            +
             | 
| 142 | 
            +
            	def initialize(client, user)
         | 
| 143 | 
            +
            		@client = client
         | 
| 37 144 |  | 
| 38 | 
            -
            	def initialize(user)
         | 
| 39 145 | 
             
            		@id = user["id"]
         | 
| 40 146 | 
             
            		@username = user["username"]
         | 
| 41 147 | 
             
            		@name = user["fullName"]
         | 
| @@ -44,9 +150,38 @@ class User | |
| 44 150 | 
             
            		@cycles = user["karma"]
         | 
| 45 151 | 
             
            		@is_hacker = user["isHacker"]
         | 
| 46 152 | 
             
            		@roles = user["roles"].map { |role| Role.new(role) }
         | 
| 153 | 
            +
            		@organization = user["organization"] == nil ? nil : Organization.new(user["organization"])
         | 
| 47 154 | 
             
            		@languages = user["languages"].map { |lang| Language.new(lang) }
         | 
| 48 155 | 
             
            	end
         | 
| 49 156 |  | 
| 157 | 
            +
            	def get_posts(order: "new", count: nil, after: nil)
         | 
| 158 | 
            +
            		p = @client.graphql(
         | 
| 159 | 
            +
            			"ProfilePosts",
         | 
| 160 | 
            +
            			Queries.get_user_posts,
         | 
| 161 | 
            +
            			username: @username,
         | 
| 162 | 
            +
            			order: order,
         | 
| 163 | 
            +
            			count: count,
         | 
| 164 | 
            +
            			after: after
         | 
| 165 | 
            +
            		)
         | 
| 166 | 
            +
            		posts = Array.new
         | 
| 167 | 
            +
            		p["user"]["posts"]["items"].each { |post| posts << Post.new(@client, post) }
         | 
| 168 | 
            +
            		posts
         | 
| 169 | 
            +
            	end
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            	def get_comments(order: "new", count: nil, after: nil)
         | 
| 172 | 
            +
            		c = @client.graphql(
         | 
| 173 | 
            +
            			"ProfileComments",
         | 
| 174 | 
            +
            			Queries.get_user_comments,
         | 
| 175 | 
            +
            			username: @username,
         | 
| 176 | 
            +
            			order: order,
         | 
| 177 | 
            +
            			count: count,
         | 
| 178 | 
            +
            			after: after
         | 
| 179 | 
            +
            		)
         | 
| 180 | 
            +
            		comments = Array.new
         | 
| 181 | 
            +
            		c["user"]["comments"]["items"].each { |comment| comments << Comment.new(@client, comment) }
         | 
| 182 | 
            +
            		comments
         | 
| 183 | 
            +
            	end
         | 
| 184 | 
            +
             | 
| 50 185 | 
             
            	def to_s
         | 
| 51 186 | 
             
            		@username
         | 
| 52 187 | 
             
            	end
         | 
| @@ -59,18 +194,6 @@ class Client | |
| 59 194 | 
             
            		@sid = sid
         | 
| 60 195 | 
             
            	end
         | 
| 61 196 |  | 
| 62 | 
            -
            	def get_user(name)
         | 
| 63 | 
            -
            		u = graphql(
         | 
| 64 | 
            -
            			"userByUsername",
         | 
| 65 | 
            -
            			Queries.get_user,
         | 
| 66 | 
            -
            			username: name
         | 
| 67 | 
            -
            		)
         | 
| 68 | 
            -
            		User.new(u["user"])
         | 
| 69 | 
            -
            	end
         | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
            	private
         | 
| 73 | 
            -
             | 
| 74 197 | 
             
            	def graphql(name, query, **variables)
         | 
| 75 198 | 
             
            		payload = {
         | 
| 76 199 | 
             
            			operationName: name,
         | 
| @@ -97,4 +220,22 @@ class Client | |
| 97 220 | 
             
            		data = data["data"] if data.include?("data")
         | 
| 98 221 | 
             
            		data
         | 
| 99 222 | 
             
            	end
         | 
| 223 | 
            +
             | 
| 224 | 
            +
            	def get_user(name)
         | 
| 225 | 
            +
            		u = graphql(
         | 
| 226 | 
            +
            			"userByUsername",
         | 
| 227 | 
            +
            			Queries.get_user,
         | 
| 228 | 
            +
            			username: name
         | 
| 229 | 
            +
            		)
         | 
| 230 | 
            +
            		User.new(self, u["user"])
         | 
| 231 | 
            +
            	end
         | 
| 232 | 
            +
             | 
| 233 | 
            +
            	def get_user_by_id(id)
         | 
| 234 | 
            +
            		u = graphql(
         | 
| 235 | 
            +
            			"user",
         | 
| 236 | 
            +
            			Queries.get_user_by_id,
         | 
| 237 | 
            +
            			user_id: id
         | 
| 238 | 
            +
            		)
         | 
| 239 | 
            +
            		User.new(u["user"])
         | 
| 240 | 
            +
            	end
         | 
| 100 241 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,17 +1,45 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: repltalk
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.1.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- | 
| 12 | 
            -
            dependencies: | 
| 11 | 
            +
            date: 2021-03-04 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: http
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ">="
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: json
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - ">="
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - ">="
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0'
         | 
| 13 41 | 
             
            description: With the repltalk gem, you can easily interect with the repltalk graphql
         | 
| 14 | 
            -
              api.
         | 
| 42 | 
            +
              api. See https://github.com/Coding-Cactus/repltalk for documentation
         | 
| 15 43 | 
             
            email: codingcactus.cc@gmail.com
         | 
| 16 44 | 
             
            executables: []
         | 
| 17 45 | 
             
            extensions: []
         | 
| @@ -22,7 +50,7 @@ files: | |
| 22 50 | 
             
            homepage: 
         | 
| 23 51 | 
             
            licenses: []
         | 
| 24 52 | 
             
            metadata:
         | 
| 25 | 
            -
              source_code_uri: https://github.com/ | 
| 53 | 
            +
              source_code_uri: https://github.com/Coding-Cactus/repltalk
         | 
| 26 54 | 
             
            post_install_message: 
         | 
| 27 55 | 
             
            rdoc_options: []
         | 
| 28 56 | 
             
            require_paths:
         |