repltalk 2.0.3 → 2.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repltalk.rb +11 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6ea03b8b7ed292b98d72d5d221d74d66aefc4daffea069349115273729b0b3d
4
- data.tar.gz: 650883b757e95b3509d22221855a8c0b868da61149b12efe24b79d19b4436cf7
3
+ metadata.gz: f7698843f4821cfa70c70212835ca464d12aef28d561f918f95d644f3c4656b7
4
+ data.tar.gz: 6386104c0526471dc1501e90e2f9cbfd22efef4a8de53c0490b1942478283815
5
5
  SHA512:
6
- metadata.gz: 825db510c06db9c763e99cd585a4e7e396aa94a04b90e9615efd8ebc661d88d413b978f3f950869fa99e7f1b5bcdee54c388664ad7c066a404cfbe0718d8cb3a
7
- data.tar.gz: 7badfaf3cae0930a7c4927d3cbd32ce8a675e7acd7ef37534e0d0541f783c9a347f661819cf65400e94e89fe6a306616817618e466005490ae0f087931d3baab
6
+ metadata.gz: d3803dcf7ec09ecbbb63fd4819f48f4464138264a462e384a923747374525c37764e3f50fcdc796e7d581602179d24e0b9d3e93b5507d4020ebbb13a3846145a
7
+ data.tar.gz: ee2a048806996c587420ca9a6ec33a9ab45de7a357c8e0c61c177b628bfe9796d75396da0d6e3746b3ec9125ac0700757679fb35dc987c73ace13c8ba31ba8e5
data/lib/repltalk.rb CHANGED
@@ -101,8 +101,8 @@ class ReplComment
101
101
 
102
102
  @id = comment["id"]
103
103
  @content = comment["body"]
104
- @author = comment["user"] == nil ? "[deleted user]" : User.new(@client, comment["user"])
105
- @repl = Repl.new(@client, comment["repl"])
104
+ @author = comment["user"] == nil ? nil : User.new(@client, comment["user"])
105
+ @repl = comment["repl"] == nil ? nil : Repl.new(@client, comment["repl"])
106
106
  @replies = comment["replies"] == nil ? nil : comment["replies"].map { |c| ReplComment.new(@client, c) }
107
107
  end
108
108
 
@@ -127,7 +127,6 @@ class ReplComment
127
127
  body: content
128
128
  }
129
129
  )
130
- puts c
131
130
  ReplComment.new(@client, c["updateReplComment"])
132
131
  end
133
132
 
@@ -320,7 +319,7 @@ class Post
320
319
 
321
320
  @board = Board.new(post["board"])
322
321
  @repl = post["repl"] == nil ? nil : Repl.new(@client, post["repl"])
323
- @author = post["user"] == nil ? "[deleted user]" : User.new(@client, post["user"])
322
+ @author = post["user"] == nil ? nil : User.new(@client, post["user"])
324
323
  @answer = post["answer"] == nil ? nil : Comment.new(@client, post["answer"])
325
324
 
326
325
  @vote_count = post["voteCount"]
@@ -417,6 +416,7 @@ class User
417
416
  attr_reader :id, :username, :name, :pfp, :bio, :cycles, :is_hacker, :timestamp, :subscription, :roles, :organization, :languages
418
417
 
419
418
  def initialize(client, user)
419
+ return nil if user == nil
420
420
  @client = client
421
421
 
422
422
  @id = user["id"]
@@ -535,6 +535,7 @@ class Client
535
535
  Queries.get_user,
536
536
  username: name
537
537
  )
538
+ return nil if u == nil || u["user"] == nil
538
539
  User.new(self, u["user"])
539
540
  end
540
541
 
@@ -544,6 +545,7 @@ class Client
544
545
  Queries.get_user_by_id,
545
546
  user_id: id
546
547
  )
548
+ return nil if u == nil || u["user"] == nil
547
549
  User.new(self, u["user"])
548
550
  end
549
551
 
@@ -553,6 +555,7 @@ class Client
553
555
  Queries.get_post,
554
556
  id: id
555
557
  )
558
+ return nil if p == nil || p["post"] == nil
556
559
  Post.new(self, p["post"])
557
560
  end
558
561
 
@@ -562,6 +565,7 @@ class Client
562
565
  Queries.get_comment,
563
566
  id: id
564
567
  )
568
+ return nil if c == nil || c["comment"] == nil
565
569
  Comment.new(self, c["comment"])
566
570
  end
567
571
 
@@ -571,6 +575,7 @@ class Client
571
575
  Queries.get_repl,
572
576
  url: url
573
577
  )
578
+ return nil if r == nil || r["repl"] == nil
574
579
  Repl.new(self, r["repl"])
575
580
  end
576
581
 
@@ -580,6 +585,7 @@ class Client
580
585
  Queries.get_repl_comment,
581
586
  id: id
582
587
  )
588
+ return nil if c == nil || c["replComment"] == nil
583
589
  ReplComment.new(self, c["replComment"])
584
590
  end
585
591
 
@@ -589,6 +595,7 @@ class Client
589
595
  Queries.get_board,
590
596
  slug: name
591
597
  )
598
+ return nil if b == nil || b["board"] == nil
592
599
  Board.new(b["board"])
593
600
  end
594
601
 
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: 2.0.3
4
+ version: 2.0.4
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-17 00:00:00.000000000 Z
11
+ date: 2021-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http