Skip to content

Commit

Permalink
Merge branch 'master' into ECO-277/find-upvs-urls-with-sparql
Browse files Browse the repository at this point in the history
  • Loading branch information
luciajanikova committed Jun 20, 2024
2 parents 8fa1adb + 07da3b3 commit bddc359
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/jobs/upvs/find_public_authority_active_edesks_list_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion app/jobs/upvs/find_public_authority_edesks_list_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion app/jobs/upvs/find_services_with_forms_list_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bddc359

Please sign in to comment.