repltalk 4.1.2 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17af54edd0d1552ed38a2f3e971da22cb42eb3540eac53642f2347555284c4b1
4
- data.tar.gz: 5a30898e823d5d5959b1fe33e2f6508865f6538982c3e605ef83e9e684b4e52a
3
+ metadata.gz: a53c13e1afa3b083432593518f24be2413de67b4ac7c9c3d0a325e118ce5a21b
4
+ data.tar.gz: c3973f28be9f38c34c9fbab0b194bb9bc4c76dd8b6cea92f4fca6b135dd93656
5
5
  SHA512:
6
- metadata.gz: 7fa905a802f5bbba4d8f7c3d0ee403b3d7885d8069e04c4e68e73ed8891b0403c2e2e4880f2a2ec0155325556f31ff3f50abc4109d0086bb0abd1065000005d2
7
- data.tar.gz: 0f319ab29a06dbb6424d9cf71cff28dbaba96951ab537f5f6a5819e4988dc26f734f5b27a3df71aab22307c756ef4fc3a7a9c8ebbbf0e491182d28c846dda9e2
6
+ metadata.gz: 838143889e780ba16a2701a3acaa108851f17f37dd806a1e75f9a078825e3851cfba69aae0ce43699d11d3bc0b5d0066ee3926f17b711c2e564eb3421ef64a44
7
+ data.tar.gz: 2b41a5f852a0afdb1ac84b2fb6ee8c51b137ac945f93a670d9af3680d801ba68fcd4c3e3cf9d5a1724c40f33b5330a9f0d024d7ebcfc0126fc7a58fa0d9a015c
@@ -120,25 +120,14 @@ module ReplTalk
120
120
  return nil if b == nil || b["board"] == nil
121
121
  Board.new(b["board"])
122
122
  end
123
-
124
- def get_leaderboard(count: nil, since: nil, after: nil)
125
- u = graphql(
126
- "LeaderboardQuery",
127
- GQL::Queries::GET_LEADERBOARD,
128
- count: count,
129
- since: since,
130
- after: after
131
- )
132
- u["leaderboard"]["items"].map { |user| LeaderboardUser.new(self, user) }
133
- end
134
123
 
135
- def get_posts(board: "all", order: "New", count: nil, after: nil, search: nil)
124
+ def get_posts(board: "all", order: "new", count: nil, after: nil, search: nil)
136
125
  p = graphql(
137
126
  "ReplPostsFeed",
138
127
  GQL::Queries::GET_POSTS,
139
128
  options: {
140
129
  boardSlugs: [board],
141
- order: order,
130
+ order: order.capitalize,
142
131
  count: count,
143
132
  after: after,
144
133
  searchQuery: search
@@ -342,17 +342,6 @@ module ReplTalk
342
342
  }
343
343
  "
344
344
 
345
- GET_LEADERBOARD = "
346
- query LeaderboardQuery($count: Int, $after: String, $since: KarmaSince) {
347
- leaderboard(count: $count, after: $after, since: $since) {
348
- items {
349
- #{Fields::USER}
350
- karmaSince: karma(since: $since)
351
- }
352
- }
353
- }
354
- "
355
-
356
345
  GET_EXPLORE_FEATURED_REPLS = "
357
346
  query ExploreFeaturedRepls {
358
347
  featuredRepls {
@@ -166,7 +166,7 @@ module ReplTalk
166
166
  @url = $BASE_URL + repl["url"]
167
167
  @title = repl["title"]
168
168
  @author = User.new(@client, repl["user"])
169
- @description = repl["description"]
169
+ @description = repl["description"].to_s
170
170
  @timestamp = repl["timeCreated"]
171
171
  @size = repl["size"]
172
172
  @run_count = repl["runCount"]
@@ -388,7 +388,7 @@ module ReplTalk
388
388
  @title = post["title"]
389
389
  @timestamp = post["timeCreated"]
390
390
 
391
- @board = Board.new(post["board"])
391
+ @board = post["board"].nil? ? nil : Board.new(post["board"])
392
392
  @repl = post["repl"] == nil ? nil : Repl.new(@client, post["repl"])
393
393
  @author = post["user"] == nil ? nil : User.new(@client, post["user"])
394
394
  @answer = post["answer"] == nil ? nil : Comment.new(@client, post["answer"])
@@ -397,8 +397,14 @@ module ReplTalk
397
397
  @preview = post["preview"]
398
398
 
399
399
  if @content == "" # new post type
400
- @url = "#{@repl.url}?c=#{post["replComment"]["id"]}"
401
- @content = post["replComment"]["body"]
400
+ if post["replComment"].nil? # no post attached
401
+ @url = @repl.url
402
+ @title = @repl.title
403
+ @content = @repl.description
404
+ else # post attached
405
+ @url = "#{@repl.url}?c=#{post["replComment"]["id"]}"
406
+ @content = post["replComment"]["body"]
407
+ end
402
408
  @preview = @content.length > 150 ? @content[0..150] : @content
403
409
  end
404
410
 
@@ -555,15 +561,4 @@ module ReplTalk
555
561
  @username
556
562
  end
557
563
  end
558
-
559
-
560
-
561
- class LeaderboardUser < User
562
- attr_reader :cycles_since
563
-
564
- def initialize(client, user)
565
- super(client, user)
566
- @cycles_since = user["karmaSince"]
567
- end
568
- end
569
564
  end
data/lib/repltalk.rb CHANGED
@@ -4,5 +4,5 @@ require_relative "repltalk/structures"
4
4
 
5
5
  module ReplTalk
6
6
  $BASE_URL = "https://replit.com"
7
- VERSION = "4.1.0"
7
+ VERSION = "4.2.0"
8
8
  end
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.1.2
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CodingCactus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-03 00:00:00.000000000 Z
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http