rdap 0.1.3 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/rdap.rb +8 -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: e381820dc8920d506d751cf7c1d562dd4f7bcaac07aeec9c735bad6777a41019
|
4
|
+
data.tar.gz: 2a5c7562f80f162d88b24a999e67e9ae3cba5b677ff84aab48adfc5ae1c3df7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff41ec54dd637813e4120feeb21048b179d617554da50e02db122da69a37aa066bb44eae785e1840d01b9afb19bd08182c3b8dd364e2b433ad4d89a5b1403968
|
7
|
+
data.tar.gz: 59d8e5dc3ba89b4f22025081710658b248ea062357451fd4952468cb06aba605a2123f3ce8deb0d1fea91d5690a60f4fe9f28812c4b2acaaef1ffa9289b32774
|
data/README.md
CHANGED
@@ -84,6 +84,7 @@ The gem make a query to one of the publicly available RDAP bootstrap server (the
|
|
84
84
|
|
85
85
|
## Changelog
|
86
86
|
|
87
|
+
- **0.1.4** (2022-02-01) - Wrap JSON parser errors as RDAP::InvalidReponse and also raise RDAP::EmptyResponse when body is missing
|
87
88
|
- **0.1.3** (2022-01-10) - Wrap SSL errors as RDAP::SSLError < ServerError < Error
|
88
89
|
- **0.1.2** (2022-01-07) - Added HTTP headers customization
|
89
90
|
- **0.1.1** (2021-12-19) - Added TooManyRequests expection in case of 429
|
data/lib/rdap.rb
CHANGED
@@ -2,7 +2,7 @@ require 'json'
|
|
2
2
|
require 'net/http'
|
3
3
|
|
4
4
|
module RDAP
|
5
|
-
VERSION = "0.1.
|
5
|
+
VERSION = "0.1.4"
|
6
6
|
BOOTSTRAP = "https://rdap.org/"
|
7
7
|
TYPES = [:domain, :ip, :autnum].freeze
|
8
8
|
HEADERS = {
|
@@ -13,6 +13,8 @@ module RDAP
|
|
13
13
|
class Error < StandardError; end
|
14
14
|
class ServerError < Error; end
|
15
15
|
class SSLError < ServerError; end
|
16
|
+
class EmptyResponse < ServerError; end
|
17
|
+
class InvalidResponse < ServerError; end
|
16
18
|
class NotFound < Error; end
|
17
19
|
class TooManyRequests < Error; end
|
18
20
|
|
@@ -48,6 +50,9 @@ module RDAP
|
|
48
50
|
response = http.get(uri.path, HEADERS.merge(headers))
|
49
51
|
case response
|
50
52
|
when Net::HTTPSuccess
|
53
|
+
if !response.body
|
54
|
+
raise EmptyResponse.new("[#{response.code}] #{response.message}")
|
55
|
+
end
|
51
56
|
document = JSON.parse(response.body)
|
52
57
|
if document["errorCode"]
|
53
58
|
raise ServerError.new("[#{document["errorCode"]}] #{document["title"]} (#{uri})")
|
@@ -69,5 +74,7 @@ module RDAP
|
|
69
74
|
end
|
70
75
|
rescue OpenSSL::SSL::SSLError => e
|
71
76
|
raise SSLError.new("#{e.message} (#{uri.host})")
|
77
|
+
rescue JSON::ParserError => e
|
78
|
+
raise InvalidResponse.new("JSON parser error: #{e.message}")
|
72
79
|
end
|
73
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Rey-Jarthon
|
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
|
description:
|
14
14
|
email:
|