Files
wehub-resource-sync d88fd01084
CI / test (3.10) (push) Failing after 1s
CI / test (3.12) (push) Failing after 0s
CI / skillgen-check (push) Failing after 0s
CI / security-scan (push) Failing after 0s
chore: import upstream snapshot with attribution
2026-07-13 12:09:14 +08:00

34 lines
441 B
Ruby

require 'json'
require 'net/http'
class ApiClient
def initialize(base_url)
@base_url = base_url
end
def get(path)
fetch(path, 'GET')
end
def post(path, body)
fetch(path, 'POST')
end
private
def fetch(path, method)
uri = URI(@base_url + path)
Net::HTTP.get(uri)
end
end
class TimeoutApiClient < ApiClient
def fetch(path, method)
super
end
end
def parse_response(raw)
JSON.parse(raw)
end