repltalk 4.1.2 → 4.4.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: 95d4d159cc45dc30677912ab1b44b9e9439fb12248119430334987a8a11275df
4
+ data.tar.gz: 5faf5eeb5e8de1b0d87e17903fac87e178ca12aa5531bfae41a52a170fa7754b
5
5
  SHA512:
6
- metadata.gz: 7fa905a802f5bbba4d8f7c3d0ee403b3d7885d8069e04c4e68e73ed8891b0403c2e2e4880f2a2ec0155325556f31ff3f50abc4109d0086bb0abd1065000005d2
7
- data.tar.gz: 0f319ab29a06dbb6424d9cf71cff28dbaba96951ab537f5f6a5819e4988dc26f734f5b27a3df71aab22307c756ef4fc3a7a9c8ebbbf0e491182d28c846dda9e2
6
+ metadata.gz: d4a6228db66bf89454a6587e4e4cdd470f3b3f38bc354b4ea37209acc8d9a5b7c01043800cddcd01dca6bafa28b9b3a042c80a6a748bf7c3b5aac50f6c5a1a45
7
+ data.tar.gz: 00f21639a3fcf8f8294ac8b596817b548f216da6e75560629ebbac7a1f3098edbd5c94510eccf25176b26ab67587ac4a5ec3cf1178c62ff4177fc0229a5de254
@@ -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
@@ -46,13 +46,6 @@ module ReplTalk
46
46
  replCount
47
47
  replsTaggedTodayCount
48
48
  creatorCount
49
- isTrending
50
- "
51
-
52
- REACTIONS = "
53
- id
54
- type
55
- count
56
49
  "
57
50
 
58
51
  REPL = "
@@ -70,9 +63,6 @@ module ReplTalk
70
63
  tags {
71
64
  #{TAG}
72
65
  }
73
- reactions {
74
- #{REACTIONS}
75
- }
76
66
  lang {
77
67
  #{LANGUAGE}
78
68
  }
@@ -342,17 +332,6 @@ module ReplTalk
342
332
  }
343
333
  "
344
334
 
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
335
  GET_EXPLORE_FEATURED_REPLS = "
357
336
  query ExploreFeaturedRepls {
358
337
  featuredRepls {
@@ -512,18 +491,6 @@ module ReplTalk
512
491
  }
513
492
  "
514
493
 
515
- TOGGLE_REACTION = "
516
- mutation ReplViewReactionsToggleReactions($input: SetReplReactionInput!) {
517
- setReplReaction(input: $input) {
518
- ... on Repl {
519
- reactions {
520
- #{Fields::REACTIONS}
521
- }
522
- }
523
- }
524
- }
525
- "
526
-
527
494
  REPORT_POST = "
528
495
  mutation createBoardReport($id: Int!, $reason: String!) {
529
496
  createBoardReport(postId: $id, reason: $reason) {
@@ -85,24 +85,6 @@ module ReplTalk
85
85
 
86
86
 
87
87
 
88
-
89
- class Reaction
90
- attr_reader :id, :type, :count
91
-
92
- def initialize(reaction)
93
- @id = reaction["id"]
94
- @type = reaction["type"]
95
- @count = reaction["count"]
96
- end
97
-
98
- def to_s
99
- @type
100
- end
101
- end
102
-
103
-
104
-
105
-
106
88
  class ReplComment
107
89
  attr_reader :id, :content, :author, :repl, :replies
108
90
 
@@ -157,7 +139,7 @@ module ReplTalk
157
139
 
158
140
 
159
141
  class Repl
160
- attr_reader :id, :url, :title, :author, :description, :timestamp, :size, :run_count, :fork_count, :language, :img_url, :origin_url, :is_private, :is_always_on, :tags, :reactions
142
+ attr_reader :id, :url, :title, :author, :description, :timestamp, :size, :run_count, :fork_count, :language, :img_url, :origin_url, :is_private, :is_always_on, :tags
161
143
 
162
144
  def initialize(client, repl)
163
145
  @client = client
@@ -166,7 +148,7 @@ module ReplTalk
166
148
  @url = $BASE_URL + repl["url"]
167
149
  @title = repl["title"]
168
150
  @author = User.new(@client, repl["user"])
169
- @description = repl["description"]
151
+ @description = repl["description"].to_s
170
152
  @timestamp = repl["timeCreated"]
171
153
  @size = repl["size"]
172
154
  @run_count = repl["runCount"]
@@ -179,7 +161,6 @@ module ReplTalk
179
161
  @is_always_on = repl["isAlwaysOn"]
180
162
 
181
163
  @tags = repl["tags"].map { |tag| Tag.new(@client, tag) }
182
- @reactions = repl["reactions"].map { |reaction| Reaction.new(reaction) }
183
164
  end
184
165
 
185
166
  def get_forks(count: 100, after: nil)
@@ -388,7 +369,7 @@ module ReplTalk
388
369
  @title = post["title"]
389
370
  @timestamp = post["timeCreated"]
390
371
 
391
- @board = Board.new(post["board"])
372
+ @board = post["board"].nil? ? nil : Board.new(post["board"])
392
373
  @repl = post["repl"] == nil ? nil : Repl.new(@client, post["repl"])
393
374
  @author = post["user"] == nil ? nil : User.new(@client, post["user"])
394
375
  @answer = post["answer"] == nil ? nil : Comment.new(@client, post["answer"])
@@ -396,9 +377,15 @@ module ReplTalk
396
377
  @content = post["body"]
397
378
  @preview = post["preview"]
398
379
 
399
- if @content == "" # new post type
400
- @url = "#{@repl.url}?c=#{post["replComment"]["id"]}"
401
- @content = post["replComment"]["body"]
380
+ if @content == "" && @repl != nil # new post type
381
+ if post["replComment"].nil? # no post attached
382
+ @url = @repl.url
383
+ @title = @repl.title
384
+ @content = @repl.description
385
+ else # post attached
386
+ @url = "#{@repl.url}?c=#{post["replComment"]["id"]}"
387
+ @content = post["replComment"]["body"]
388
+ end
402
389
  @preview = @content.length > 150 ? @content[0..150] : @content
403
390
  end
404
391
 
@@ -555,15 +542,4 @@ module ReplTalk
555
542
  @username
556
543
  end
557
544
  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
545
  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.4.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.4.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-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http