readwise 1.1.0 → 1.1.1

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
  SHA256:
3
- metadata.gz: 5e37bd88ff6059f63924f1c72ccb905f1d719fbff923411a00635995fcfe70a3
4
- data.tar.gz: c3454ae039735d62d06c35889534c41ff76c94843ddeb9849d96b2287fa702d7
3
+ metadata.gz: 3755619ff823befb1257dc6968341844f33a51a1abbd56e3afda0c000d741b2a
4
+ data.tar.gz: 860bab106874680a766aa320985e1ff0171708a5254dcca25c8f60259cc13ba5
5
5
  SHA512:
6
- metadata.gz: 45f34de451ad75c000b40ba5a78b7a365e701c8af9a27783128e30a951f8ec6674c8f90b12fb51ad77261c3a9f7378486feae6d5494d50e4b3ef9f0f4e0e8837
7
- data.tar.gz: a5b2fe3e2a4d6c8ea744065f9dd76414db85858b62ae83be3aa65309281a25aa07fbd4cd72bf86f2581dba12796f890da07100d50a8d6892ee0620d0deae60a4
6
+ metadata.gz: 37e89c5a2e3d1a2959d278517b5d6477d6d2811cc20f17d9090de994af4b39bfb227b13990ce71ddd828831511604b968ebf17c3cec5e2853e687f2422d94936
7
+ data.tar.gz: '0568e828d0dc28122867fa07d3a62953f6660e02bc8bc568d0c96578dae77366da13a89cf4aefdc992c979f04392e25ee8a94a47226f4d2c35575e842df7effb'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.1.1] - 2025-07-18
6
+ - Handle 429 (Too Many Requests) errors ([#19](https://github.com/joshbeckman/readwise-ruby/pull/19) from [@andyw8](https://github.com/andyw8))
7
+
5
8
  ## [1.1.0] - 2025-07-04
6
9
  - Add CLI command for creating documents from HTML content or URLs ([#16](https://github.com/joshbeckman/readwise-ruby/pull/16) from [@andyw8](https://github.com/andyw8))
7
10
 
@@ -9,6 +9,15 @@ require_relative 'review'
9
9
  module Readwise
10
10
  class Client
11
11
  class Error < StandardError; end
12
+ class TooManyRequests < Error
13
+ def initialize(retry_after)
14
+ @retry_after = retry_after
15
+ end
16
+
17
+ def message
18
+ "Try again after #{@retry_after} seconds"
19
+ end
20
+ end
12
21
 
13
22
  BASE_URL = "https://readwise.io/api/v2/"
14
23
  V3_BASE_URL = "https://readwise.io/api/v3/"
@@ -302,6 +311,11 @@ module Readwise
302
311
  http.request(req)
303
312
  end
304
313
 
314
+ if res.code == "429" # Too Many Requests
315
+ retry_after = Integer(res.fetch("Retry-After"))
316
+ raise TooManyRequests.new(retry_after)
317
+ end
318
+
305
319
  raise Error, "Get request failed with status code: #{res.code}" unless res.is_a?(Net::HTTPSuccess)
306
320
 
307
321
  JSON.parse(res.body)
@@ -1,3 +1,3 @@
1
1
  module Readwise
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readwise
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Beckman