lib/icarus/mod/tools/sync_helpers.rb in Icarus-Mod-Tools-1.3.5 vs lib/icarus/mod/tools/sync_helpers.rb in Icarus-Mod-Tools-1.4.0

- old
+ new

@@ -5,17 +5,17 @@ require "json" module Icarus module Mod module Tools + class RequestFailed < StandardError; end + # Sync helper methods module SyncHelpers - class RequestFailed < StandardError; end - 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" + raise Icarus::Mod::Tools::RequestFailed, "HTTP Request failed for #{url} (#{res.code}): #{res.message}" unless res&.code == "200" JSON.parse(res.body, symbolize_names: true) end end end