Module: Relaton::Ietf::WgNameResolver
- Defined in:
- lib/relaton/ietf/wg_name_resolver.rb
Overview
Fetches working group and research group names from the IETF Datatracker API. Returns a Hash mapping acronym (lowercase) to full group name.
Constant Summary collapse
- API_URL =
"https://datatracker.ietf.org/api/v1/group/group/"
Class Method Summary collapse
-
.fetch ⇒ Hash{String => String}
Acronym => full name.
Class Method Details
.fetch ⇒ Hash{String => String}
Returns acronym => full name.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/relaton/ietf/wg_name_resolver.rb', line 14 def self.fetch result = {} offset = 0 limit = 1000 loop do uri = URI("#{API_URL}?type__in=wg,rg&limit=#{limit}&offset=#{offset}&format=json") response = Net::HTTP.get_response(uri) break unless response.is_a?(Net::HTTPSuccess) data = JSON.parse(response.body) objects = data["objects"] || [] break if objects.empty? objects.each do |group| acronym = group["acronym"] name = group["name"] result[acronym] = name if acronym && name end offset += limit break unless data.dig("meta", "next") end result rescue StandardError => e Util.warn "Failed to fetch WG names from Datatracker: #{e.}" {} end |