Module: Peddler::Helpers::DataKiosk20231115

Included in:
APIs::DataKiosk20231115
Defined in:
lib/peddler/helpers/data_kiosk_2023_11_15.rb

Instance Method Summary collapse

Instance Method Details

#download_query_document(document_id_or_url) ⇒ Peddler::Response

Convenience method to download a Data Kiosk document by its document ID or URL. This method can handle both document IDs and direct download URLs.

Parameters:

  • document_id_or_url (String)

    The document identifier or download URL

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/peddler/helpers/data_kiosk_2023_11_15.rb', line 13

def download_query_document(document_id_or_url)
  # If it looks like a URL, use direct download
  if document_id_or_url.start_with?("http")
    return download_query_document_from_url(document_id_or_url)
  end

  # Otherwise, treat it as a document ID and get the download URL first
  response = get_document(document_id_or_url)
  document_url = response.parse.document_url

  download_query_document_from_url(document_url)
end