Module: RDAP
Defined Under Namespace
Classes: Error, NotFound, ServerError, TooManyRequests
Constant Summary
collapse
- VERSION =
"0.1.2"
- BOOTSTRAP =
"https://rdap.org/"
- TYPES =
[:domain, :ip, :autnum].freeze
{
"User-Agent" => "RDAP ruby gem (#{VERSION})",
"Accept" => "application/rdap+json"
}
Class Method Summary
collapse
Class Method Details
.as(name, **opts) ⇒ Object
26
27
28
|
# File 'lib/rdap.rb', line 26
def self.as name, **opts
query name, type: :autnum, **opts
end
|
.domain(name, **opts) ⇒ Object
18
19
20
|
# File 'lib/rdap.rb', line 18
def self.domain name, **opts
query name, type: :domain, **opts
end
|
.ip(name, **opts) ⇒ Object
22
23
24
|
# File 'lib/rdap.rb', line 22
def self.ip name, **opts
query name, type: :ip, **opts
end
|
.query(name, type:, timeout: 5, server: BOOTSTRAP, headers: {}) ⇒ Object
30
31
32
33
34
|
# File 'lib/rdap.rb', line 30
def self.query name, type:, timeout: 5, server: BOOTSTRAP, headers: {}
TYPES.include?(type) or raise ArgumentError.new("RDAP: Invalid query type: #{type}, supported types: #{TYPES}")
uri = URI("#{server.chomp('/')}/#{type}/#{name}")
get_follow_redirects(uri, timeout: timeout, headers: )
end
|