Sha256: 7901cfcc439648eadb218cc37ded34fc8eb3ebe59448ca1bbb8f89bf84675ae8
Contents?: true
Size: 567 Bytes
Versions: 2
Compression:
Stored size: 567 Bytes
Contents
# frozen_string_literal: true require "uri" require "net/http" require "json" module Icarus module Mod module Tools module Sync class RequestFailed < StandardError; end # Sync helper methods module Helpers def retrieve_from_url(url) res = Net::HTTP.get_response(URI(url)) raise RequestFailed, "HTTP Request failed for #{url} (#{res.code}): #{res.message}" unless res&.code == "200" JSON.parse(res.body, symbolize_names: true) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Icarus-Mod-Tools-1.8.2.1 | lib/icarus/mod/tools/sync/helpers.rb |
Icarus-Mod-Tools-1.8.2 | lib/icarus/mod/tools/sync/helpers.rb |