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 +4 -4
- data/lib/repltalk/client.rb +2 -13
- data/lib/repltalk/graphql.rb +0 -11
- data/lib/repltalk/structures.rb +10 -15
- data/lib/repltalk.rb +1 -1
- 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: a53c13e1afa3b083432593518f24be2413de67b4ac7c9c3d0a325e118ce5a21b
|
4
|
+
data.tar.gz: c3973f28be9f38c34c9fbab0b194bb9bc4c76dd8b6cea92f4fca6b135dd93656
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 838143889e780ba16a2701a3acaa108851f17f37dd806a1e75f9a078825e3851cfba69aae0ce43699d11d3bc0b5d0066ee3926f17b711c2e564eb3421ef64a44
|
7
|
+
data.tar.gz: 2b41a5f852a0afdb1ac84b2fb6ee8c51b137ac945f93a670d9af3680d801ba68fcd4c3e3cf9d5a1724c40f33b5330a9f0d024d7ebcfc0126fc7a58fa0d9a015c
|
data/lib/repltalk/client.rb
CHANGED
@@ -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: "
|
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
|
data/lib/repltalk/graphql.rb
CHANGED
@@ -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 {
|
data/lib/repltalk/structures.rb
CHANGED
@@ -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
|
-
|
401
|
-
|
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
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.
|
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
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|