From e055fb2871dbf52483e4aa8c642cc5bfa504949a Mon Sep 17 00:00:00 2001 From: pskl Date: Tue, 14 Jan 2025 15:29:18 +0100 Subject: [PATCH] Scaffold RUA client --- lib/rua/client.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/rua/client.rb diff --git a/lib/rua/client.rb b/lib/rua/client.rb new file mode 100644 index 000000000..e900eac83 --- /dev/null +++ b/lib/rua/client.rb @@ -0,0 +1,31 @@ +module Rua + class Client + BASE_URL = "https://pr-api-tst-rac.omogen.in.phm.education.gouv.fr/mesirh/pp/rua/pp-grh-mes/v2" + API_KEY = ENV.fetch("APLYPRO_RUA_API_KEY") + + attr_reader :conn + + def initialize + @conn = connection + end + + def agents + conn.get("agents") + end + + def connection + Faraday.new( + url: BASE_URL, + params: {}, + headers: headers + ) + end + + def headers + { + "X-Omogen-Api-Key" => API_KEY, + "Content-Type" => "application/json" + } + end + end +end