reddit_api 0.1.15 → 0.1.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 938e73303ef5d5500103a633f46bf38e69064379
4
- data.tar.gz: a1723b3ac6830678c303913493f0b0b80f93ec28
3
+ metadata.gz: dc9b1b02673711ba7cb8a571000382da02f1743f
4
+ data.tar.gz: 5aafc07034858ad972eda2948300f110d67cf6d4
5
5
  SHA512:
6
- metadata.gz: 4fcade335a8155da720714b4c6d4c72632e0c2282b1825a9d759c9a95d7c11385619588a4688929d55f57ac64cd7e568f002824394d331158638c64a1dfa3465
7
- data.tar.gz: 17478cf3fbcaa86cf71265fdc07eb0531e56108b116c7a9ccce5fc09be9028dddb32cfd23f1d5788d02ae06373525db5af97e934a044c0c7fbf447598da3d210
6
+ metadata.gz: 2303fc5ac90a406531a6bb0feaf893825dfbc20bca991511956884c657f587423f495c1bae1a8ad2180aa4d72901fb605dbc294bdb81fc31d3d10bef240c9f9b
7
+ data.tar.gz: f49a9eb6f7c5d59afa76fb9cf03b5288f45963bc320204a5ad3315cfe234b46c923b3201da38a9c37cdecfc63cc143db178e05c6eea740f533814ae613441264
@@ -2,7 +2,7 @@
2
2
  module RedditApi
3
3
  class Comments
4
4
 
5
- MAX_QUERIES = 5
5
+ MAX_FAILURES = 5
6
6
 
7
7
  def initialize(args = {})
8
8
  @client = args.fetch(:client, RedditApi::Client.new)
@@ -14,11 +14,14 @@ module RedditApi
14
14
  def most_recent_subreddits(user, count)
15
15
  self.failures = 0
16
16
  subreddits = {}
17
- MAX_QUERIES.times do
17
+ loops = 0
18
+ while subreddits.length < count &&
19
+ failures < MAX_QUERIES &&
20
+ loops < MAX_FAILURES
18
21
  comments = most_recent_comments(user, 100, offset)
19
22
  update_progress(comments)
20
23
  collect_subreddits(comments, count, subreddits)
21
- break if subreddits.length >= count || failures >= MAX_QUERIES
24
+ loops += 1
22
25
  end
23
26
  subreddits.keys
24
27
  end
@@ -1,3 +1,3 @@
1
1
  module RedditApi
2
- VERSION = "0.1.15"
2
+ VERSION = "0.1.16"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reddit_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Fuentes