diff --git a/app/jobs/upvs/find_public_authority_active_edesks_list_job.rb b/app/jobs/upvs/find_public_authority_active_edesks_list_job.rb index 589b091..20f5b00 100644 --- a/app/jobs/upvs/find_public_authority_active_edesks_list_job.rb +++ b/app/jobs/upvs/find_public_authority_active_edesks_list_job.rb @@ -27,10 +27,12 @@ def perform response = Faraday.get(BASE_URL, {query: query}) if response.success? - csv_dataset_url = response.body.split("\n")[1..].map(&:strip) + dataset_url = response.body.split("\n")[1..].map(&:strip) .find { |url| Faraday.get(url).headers['Content-Disposition']&.include?('.csv') } - Upvs::FetchPublicAuthorityActiveEdesksListJob.perform_now(csv_dataset_url) if csv_dataset_url + raise "Dataset URL not found in response. Job: Upvs::FindPublicAuthorityActiveEdesksListJob" if dataset_url.nil? + + Upvs::FetchPublicAuthorityActiveEdesksListJob.perform_now(dataset_url) else raise "Request to find latest dataset URL for set: #{SET_URL} failed with status code #{response.status}" end diff --git a/app/jobs/upvs/find_public_authority_edesks_list_job.rb b/app/jobs/upvs/find_public_authority_edesks_list_job.rb index 9a659a5..37bd2a5 100644 --- a/app/jobs/upvs/find_public_authority_edesks_list_job.rb +++ b/app/jobs/upvs/find_public_authority_edesks_list_job.rb @@ -30,7 +30,9 @@ def perform dataset_url = response.body.split("\n")[1..].map(&:strip) .find { |url| Faraday.get(url).headers['Content-Disposition']&.include?('.csv') } - Upvs::FetchPublicAuthorityEdesksListJob.perform_now(dataset_url) if dataset_url + raise "Dataset URL not found in response. Job: Upvs::FindPublicAuthorityEdesksListJob" if dataset_url.nil? + + Upvs::FetchPublicAuthorityEdesksListJob.perform_now(dataset_url) else raise "Request to find latest dataset URL for set: #{SET_URL} failed with status code #{response.status}" end diff --git a/app/jobs/upvs/find_services_with_forms_list_job.rb b/app/jobs/upvs/find_services_with_forms_list_job.rb index ba31a45..2cccb5e 100644 --- a/app/jobs/upvs/find_services_with_forms_list_job.rb +++ b/app/jobs/upvs/find_services_with_forms_list_job.rb @@ -30,7 +30,9 @@ def perform dataset_url = response.body.split("\n")[1..].map(&:strip) .find { |url| Faraday.get(url).headers['Content-Disposition']&.include?('.zip') } - Upvs::FetchServicesWithFormsListJob.perform_now(dataset_url) if dataset_url + raise "Dataset URL not found in response. Job: Upvs::FindServicesWithFormsListJob" if dataset_url.nil? + + Upvs::FetchServicesWithFormsListJob.perform_now(dataset_url) else raise "Request to find latest dataset URL for set: #{SET_URL} failed with status code #{response.status}" end