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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/readwise/client.rb +14 -0
- data/lib/readwise/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3755619ff823befb1257dc6968341844f33a51a1abbd56e3afda0c000d741b2a
|
4
|
+
data.tar.gz: 860bab106874680a766aa320985e1ff0171708a5254dcca25c8f60259cc13ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/readwise/client.rb
CHANGED
@@ -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)
|
data/lib/readwise/version.rb
CHANGED