From e0901760f7dd267a5d8eccf193996e6b6ad2b979 Mon Sep 17 00:00:00 2001 From: anero Date: Tue, 21 Oct 2025 16:06:12 -0300 Subject: [PATCH] New method for calculating the endpoint for updating prefill forms state for Campact --- lib/tokyo_api/campact.rb | 4 ++++ spec/campact_spec.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib/tokyo_api/campact.rb b/lib/tokyo_api/campact.rb index 2002996..398027d 100644 --- a/lib/tokyo_api/campact.rb +++ b/lib/tokyo_api/campact.rb @@ -34,6 +34,10 @@ def user_path(session_id, petition_id:, with_subscription_status: false, require path end + def update_prefill_forms_path(session_id) + String.new("/#{normalized_base_path}user/#{url_escape(session_id)}/prefill_forms") + end + def subscription_status_path(token) "/#{normalized_base_path}subscription_status/#{url_escape(token)}" end diff --git a/spec/campact_spec.rb b/spec/campact_spec.rb index 2f6aab4..2d35ad3 100644 --- a/spec/campact_spec.rb +++ b/spec/campact_spec.rb @@ -117,6 +117,12 @@ end end + describe '#update_prefill_forms_path' do + it 'should return relative path to prefill forms endpoint' do + expect(subject.campact.update_prefill_forms_path('123abc456')).to eq '/campact/user/123abc456/prefill_forms' + end + end + describe '#subscription_status_path' do subject { TokyoApi::Campact.new }