├── .Rbuildignore ├── .gitattributes ├── .github ├── .gitignore └── workflows │ ├── check-standard-real-requests.yaml │ └── check-standard.yaml ├── .gitignore ├── CONTRIBUTING.md ├── DESCRIPTION ├── EDIutils.Rproj ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── check_status_create.R ├── check_status_evaluate.R ├── check_status_update.R ├── create_data_package.R ├── create_data_package_archive.R ├── create_dn.R ├── create_event_subscription.R ├── create_journal_citation.R ├── create_reservation.R ├── delete_event_subscription.R ├── delete_journal_citation.R ├── delete_reservation.R ├── evaluate_data_package.R ├── execute_event_subscription.R ├── get_audit_count.R ├── get_audit_record.R ├── get_audit_report.R ├── get_docid_reads.R ├── get_event_subscription.R ├── get_event_subscription_schema.R ├── get_journal_citation.R ├── get_packageid_reads.R ├── get_provenance_metadata.R ├── get_recent_uploads.R ├── is_authorized.R ├── list_active_reservations.R ├── list_data_descendants.R ├── list_data_entities.R ├── list_data_package_citations.R ├── list_data_package_identifiers.R ├── list_data_package_revisions.R ├── list_data_package_scopes.R ├── list_data_sources.R ├── list_deleted_data_packages.R ├── list_principal_owner_citations.R ├── list_recent_changes.R ├── list_recent_uploads.R ├── list_reservation_identifiers.R ├── list_service_methods.R ├── list_user_data_packages.R ├── list_working_on.R ├── login.R ├── logout.R ├── query_event_subscriptions.R ├── read_data_entity.R ├── read_data_entity_checksum.R ├── read_data_entity_name.R ├── read_data_entity_names.R ├── read_data_entity_resource_metadata.R ├── read_data_entity_size.R ├── read_data_entity_sizes.R ├── read_data_package.R ├── read_data_package_archive.R ├── read_data_package_citation.R ├── read_data_package_doi.R ├── read_data_package_error.R ├── read_data_package_from_doi.R ├── read_data_package_report.R ├── read_data_package_report_checksum.R ├── read_data_package_report_resource_metadata.R ├── read_data_package_report_summary.R ├── read_data_package_resource_metadata.R ├── read_evaluate_report.R ├── read_evaluate_report_summary.R ├── read_metadata.R ├── read_metadata_checksum.R ├── read_metadata_dublin_core.R ├── read_metadata_entity.R ├── read_metadata_format.R ├── read_metadata_resource_metadata.R ├── search_data_packages.R ├── update_data_package.R └── utilities.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── codemeta.json ├── cran-comments.md ├── docs ├── .gitignore ├── CODE_OF_CONDUCT.html ├── CONTRIBUTING.html ├── LICENSE-text.html ├── LICENSE.html ├── articles │ ├── daily_downloads-1.png │ ├── evaluate_and_upload.html │ ├── evaluate_and_upload_files │ │ └── header-attrs-2.11 │ │ │ └── header-attrs.js │ ├── index.html │ ├── retrieve_citations.html │ ├── retrieve_citations_files │ │ └── header-attrs-2.11 │ │ │ └── header-attrs.js │ ├── retrieve_downloads.html │ ├── retrieve_downloads_files │ │ └── header-attrs-2.11 │ │ │ └── header-attrs.js │ ├── search_and_access.html │ ├── search_and_access_files │ │ └── header-attrs-2.11 │ │ │ └── header-attrs.js │ ├── tests_requiring_authentication.html │ └── tests_requiring_authentication_files │ │ └── header-attrs-2.11 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── auth_key.html │ ├── check_status_create.html │ ├── check_status_evaluate.html │ ├── check_status_update.html │ ├── compare_eml.html │ ├── compare_node_as_string.html │ ├── compare_tables.html │ ├── convert_missing_value.html │ ├── create_data_package.html │ ├── create_data_package_archive.html │ ├── create_dn.html │ ├── create_event_subscription.html │ ├── create_journal_citation.html │ ├── create_provenance_metadata.html │ ├── create_reservation.html │ ├── delete_event_subscription.html │ ├── delete_journal_citation.html │ ├── delete_reservation.html │ ├── detect_os.html │ ├── evaluate_data_package.html │ ├── execute_event_subscription.html │ ├── get_audit_count.html │ ├── get_audit_record.html │ ├── get_audit_report.html │ ├── get_docid_reads.html │ ├── get_event_subscription.html │ ├── get_event_subscription_schema.html │ ├── get_journal_citation.html │ ├── get_packageid_reads.html │ ├── get_provenance_metadata.html │ ├── get_recent_uploads.html │ ├── index.html │ ├── is_authorized.html │ ├── list_active_reservations.html │ ├── list_data_descendants.html │ ├── list_data_entities.html │ ├── list_data_package_citations.html │ ├── list_data_package_identifiers.html │ ├── list_data_package_revisions.html │ ├── list_data_package_scopes.html │ ├── list_data_sources.html │ ├── list_deleted_data_packages.html │ ├── list_principal_owner_citations.html │ ├── list_recent_changes.html │ ├── list_recent_uploads.html │ ├── list_reservation_identifiers.html │ ├── list_service_methods.html │ ├── list_user_data_packages.html │ ├── list_working_on.html │ ├── login.html │ ├── logout.html │ ├── query_event_subscriptions.html │ ├── read_data_entity.html │ ├── read_data_entity_checksum.html │ ├── read_data_entity_name.html │ ├── read_data_entity_names.html │ ├── read_data_entity_resource_metadata.html │ ├── read_data_entity_size.html │ ├── read_data_entity_sizes.html │ ├── read_data_package.html │ ├── read_data_package_archive.html │ ├── read_data_package_citation.html │ ├── read_data_package_doi.html │ ├── read_data_package_error.html │ ├── read_data_package_from_doi.html │ ├── read_data_package_report.html │ ├── read_data_package_report_checksum.html │ ├── read_data_package_report_resource_metadata.html │ ├── read_data_package_report_summary.html │ ├── read_data_package_resource_metadata.html │ ├── read_evaluate_report.html │ ├── read_evaluate_report_summary.html │ ├── read_metadata.html │ ├── read_metadata_checksum.html │ ├── read_metadata_dublin_core.html │ ├── read_metadata_entity.html │ ├── read_metadata_format.html │ ├── read_metadata_resource_metadata.html │ ├── read_tables.html │ ├── search_data_packages.html │ ├── update_data_package.html │ ├── url_env.html │ ├── validate_arguments.html │ ├── validate_file_names.html │ ├── validate_keywords.html │ ├── validate_path.html │ ├── vocab_lter_id.html │ ├── vocab_lter_scope.html │ └── vocab_lter_term.html └── sitemap.xml ├── inst ├── CITATION └── extdata │ ├── data.txt │ └── eml.xml ├── man ├── check_status_create.Rd ├── check_status_evaluate.Rd ├── check_status_update.Rd ├── create_data_package.Rd ├── create_data_package_archive.Rd ├── create_dn.Rd ├── create_event_subscription.Rd ├── create_journal_citation.Rd ├── create_reservation.Rd ├── delete_event_subscription.Rd ├── delete_journal_citation.Rd ├── delete_reservation.Rd ├── evaluate_data_package.Rd ├── execute_event_subscription.Rd ├── get_audit_count.Rd ├── get_audit_record.Rd ├── get_audit_report.Rd ├── get_docid_reads.Rd ├── get_event_subscription.Rd ├── get_event_subscription_schema.Rd ├── get_journal_citation.Rd ├── get_packageid_reads.Rd ├── get_provenance_metadata.Rd ├── get_recent_uploads.Rd ├── is_authorized.Rd ├── list_active_reservations.Rd ├── list_data_descendants.Rd ├── list_data_entities.Rd ├── list_data_package_citations.Rd ├── list_data_package_identifiers.Rd ├── list_data_package_revisions.Rd ├── list_data_package_scopes.Rd ├── list_data_sources.Rd ├── list_deleted_data_packages.Rd ├── list_principal_owner_citations.Rd ├── list_recent_changes.Rd ├── list_recent_uploads.Rd ├── list_reservation_identifiers.Rd ├── list_service_methods.Rd ├── list_user_data_packages.Rd ├── list_working_on.Rd ├── login.Rd ├── logout.Rd ├── query_event_subscriptions.Rd ├── read_data_entity.Rd ├── read_data_entity_checksum.Rd ├── read_data_entity_name.Rd ├── read_data_entity_names.Rd ├── read_data_entity_resource_metadata.Rd ├── read_data_entity_size.Rd ├── read_data_entity_sizes.Rd ├── read_data_package.Rd ├── read_data_package_archive.Rd ├── read_data_package_citation.Rd ├── read_data_package_doi.Rd ├── read_data_package_error.Rd ├── read_data_package_from_doi.Rd ├── read_data_package_report.Rd ├── read_data_package_report_checksum.Rd ├── read_data_package_report_resource_metadata.Rd ├── read_data_package_report_summary.Rd ├── read_data_package_resource_metadata.Rd ├── read_evaluate_report.Rd ├── read_evaluate_report_summary.Rd ├── read_metadata.Rd ├── read_metadata_checksum.Rd ├── read_metadata_dublin_core.Rd ├── read_metadata_entity.Rd ├── read_metadata_format.Rd ├── read_metadata_resource_metadata.Rd ├── search_data_packages.Rd └── update_data_package.Rd ├── tests ├── fixtures │ ├── check_status_create.yml │ ├── check_status_create_wait.yml │ ├── check_status_evaluate.yml │ ├── check_status_update.yml │ ├── check_status_update_wait.yml │ ├── create_data_package_archive.yml │ ├── create_reservation.yml │ ├── create_reservation_delete_reservation.yml │ ├── delete_event_subscription.yml │ ├── delete_journal_citation.yml │ ├── delete_reservation.yml │ ├── execute_event_subscription.yml │ ├── get_audit_count.yml │ ├── get_audit_report.yml │ ├── get_docid_reads.yml │ ├── get_event_subscription.yml │ ├── get_event_subscription_schema.yml │ ├── get_journal_citation.yml │ ├── get_packageid_reads.yml │ ├── get_provenance_metadata.yml │ ├── is_authorized.yml │ ├── list_active_reservations.yml │ ├── list_data_descendants.yml │ ├── list_data_entities.yml │ ├── list_data_package_citations.yml │ ├── list_data_package_identifiers.yml │ ├── list_data_package_revisions.yml │ ├── list_data_package_revisions_newest.yml │ ├── list_data_package_revisions_oldest.yml │ ├── list_data_package_scopes.yml │ ├── list_data_sources.yml │ ├── list_deleted_data_packages.yml │ ├── list_principal_owner_citations.yml │ ├── list_recent_uploads.yml │ ├── list_reservation_identifiers.yml │ ├── list_service_methods.yml │ ├── list_user_data_packages.yml │ ├── list_working_on.yml │ ├── login.yml │ ├── query_event_subscriptions.yml │ ├── read_data_entity.yml │ ├── read_data_entity_checksum.yml │ ├── read_data_entity_name.yml │ ├── read_data_entity_names.yml │ ├── read_data_entity_resource_metadata.yml │ ├── read_data_entity_size.yml │ ├── read_data_entity_sizes.yml │ ├── read_data_package.yml │ ├── read_data_package_citation.yml │ ├── read_data_package_citation_html.yml │ ├── read_data_package_citation_json.yml │ ├── read_data_package_doi.yml │ ├── read_data_package_error.yml │ ├── read_data_package_from_doi.yml │ ├── read_data_package_ore.yml │ ├── read_data_package_report.yml │ ├── read_data_package_report_char.yml │ ├── read_data_package_report_checksum.yml │ ├── read_data_package_report_html.yml │ ├── read_data_package_report_resource_metadata.yml │ ├── read_data_package_report_summary.yml │ ├── read_data_package_report_summary_with_exceptions.yml │ ├── read_data_package_resource_metadata.yml │ ├── read_evaluate_report.yml │ ├── read_evaluate_report_char.yml │ ├── read_evaluate_report_html.yml │ ├── read_evaluate_report_summary.yml │ ├── read_metadata.yml │ ├── read_metadata_checksum.yml │ ├── read_metadata_dublin_core.yml │ ├── read_metadata_entity.yml │ ├── read_metadata_format.yml │ ├── read_metadata_resource_metadata.yml │ ├── report2char.yml │ └── search_data_packages.yml ├── testthat.R └── testthat │ ├── setup-EDIutils.R │ ├── test_check_status_create.R │ ├── test_check_status_evaluate.R │ ├── test_check_status_update.R │ ├── test_create_data_package.R │ ├── test_create_data_package_archive.R │ ├── test_create_dn.R │ ├── test_create_event_subscription.R │ ├── test_create_journal_citation.R │ ├── test_create_reservation.R │ ├── test_delete_event_subscription.R │ ├── test_delete_journal_citation.R │ ├── test_delete_reservation.R │ ├── test_evaluate_data_package.R │ ├── test_evaluate_report_summary.R │ ├── test_execute_event_subscription.R │ ├── test_get_audit_count.R │ ├── test_get_audit_record.R │ ├── test_get_audit_report.R │ ├── test_get_docid_reads.R │ ├── test_get_event_subscription.R │ ├── test_get_event_subscription_schema.R │ ├── test_get_journal_citation.R │ ├── test_get_packageid_reads.R │ ├── test_get_provenance_metadata.R │ ├── test_get_recent_uploads.R │ ├── test_is_authorized.R │ ├── test_list_active_reservations.R │ ├── test_list_data_descendants.R │ ├── test_list_data_entities.R │ ├── test_list_data_package_citations.R │ ├── test_list_data_package_identifiers.R │ ├── test_list_data_package_revisions.R │ ├── test_list_data_package_scopes.R │ ├── test_list_data_sources.R │ ├── test_list_deleted_data_packages.R │ ├── test_list_principal_owner_citations.R │ ├── test_list_recent_changes.R │ ├── test_list_recent_uploads.R │ ├── test_list_reservation_identifiers.R │ ├── test_list_service_methods.R │ ├── test_list_user_data_packages.R │ ├── test_list_working_on.R │ ├── test_login.R │ ├── test_logout.R │ ├── test_query_event_subscriptions.R │ ├── test_read_data_entity.R │ ├── test_read_data_entity_checksum.R │ ├── test_read_data_entity_name.R │ ├── test_read_data_entity_names.R │ ├── test_read_data_entity_resource_metadata.R │ ├── test_read_data_entity_size.R │ ├── test_read_data_entity_sizes.R │ ├── test_read_data_package.R │ ├── test_read_data_package_archive.R │ ├── test_read_data_package_citation.R │ ├── test_read_data_package_doi.R │ ├── test_read_data_package_error.R │ ├── test_read_data_package_from_doi.R │ ├── test_read_data_package_report.R │ ├── test_read_data_package_report_checksum.R │ ├── test_read_data_package_report_resource_metadata.R │ ├── test_read_data_package_report_summary.R │ ├── test_read_data_package_resource_metadata.R │ ├── test_read_evaluate_report.R │ ├── test_read_metadata.R │ ├── test_read_metadata_checksum.R │ ├── test_read_metadata_entity.R │ ├── test_read_metadata_format.R │ ├── test_read_metadata_resource_metadata.R │ ├── test_read_metdata_dublin_core.R │ ├── test_search_data_packages.R │ ├── test_update_data_package.R │ └── test_utilities.R └── vignettes ├── .gitignore ├── downloads_by_date.png ├── downloads_by_identifier.png ├── evaluate_and_upload.Rmd ├── retrieve_citations.Rmd ├── retrieve_downloads.Rmd ├── search_and_access.Rmd └── tests_requiring_authentication.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^codemeta\.json$ 4 | ^CODE_OF_CONDUCT\.md$ 5 | ^CONTRIBUTING\.md$ 6 | ^LICENSE\.md$ 7 | ^README\.Rmd$ 8 | ^_pkgdown\.yml$ 9 | ^docs$ 10 | ^cran-comments\.md$ 11 | ^CITATION\.cff$ 12 | ^\.github$ 13 | ^doc$ 14 | ^Meta$ 15 | ^CRAN-RELEASE$ 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | tests/fixtures/**/* -diff 3 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | inst/doc 6 | EDIutils.Rproj 7 | *.DS_Store 8 | /doc/ 9 | /Meta/ 10 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: EDIutils 2 | Title: An API Client for the Environmental Data Initiative Repository 3 | Version: 1.0.3 4 | Authors@R: 5 | c(person("Colin", "Smith", email = "colin.smith@wisc.edu", role = c("aut", "cre"), comment = "https://orcid.org/0000-0003-2261-9931"), 6 | person("Corinna", "Gries", role = "ctb", comment = "https://orcid.org/0000-0002-9091-6543"), 7 | person("Jasmine", "Lai", role = "rev", comment = "https://orcid.org/0000-0001-8888-547X"), 8 | person("Rodrigo", "Pires", role = "rev", comment = "https://orcid.org/0000-0001-7384-6849")) 9 | Description: A client for the Environmental Data Initiative repository REST API. The 'EDI' data repository is for publication and reuse of ecological data with emphasis on metadata accuracy and completeness. It is built upon the 'PASTA+' software stack and was developed in collaboration with the US 'LTER' Network . 'EDIutils' includes functions to search and access existing data, evaluate and upload new data, and assist other data management tasks common to repository users. 10 | Imports: curl, httr, jsonlite, xml2 11 | License: MIT + file LICENSE 12 | Encoding: UTF-8 13 | RoxygenNote: 7.2.3 14 | Suggests: knitr, readr, vcr, rmarkdown, roxygen2, testthat 15 | URL: https://github.com/ropensci/EDIutils, https://docs.ropensci.org/EDIutils/ 16 | BugReports: https://github.com/ropensci/EDIutils/issues 17 | VignetteBuilder: knitr 18 | Language: en-US 19 | -------------------------------------------------------------------------------- /EDIutils.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Package 16 | PackageUseDevtools: Yes 17 | PackageInstallArgs: --no-multiarch --with-keep.source 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2021 2 | COPYRIGHT HOLDER: Colin Smith -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Colin Smith 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /R/create_data_package_archive.R: -------------------------------------------------------------------------------- 1 | #' Create data package archive (zip) 2 | #' 3 | #' This function is DEPRECATED. 4 | #' 5 | #' @param packageId (character) Data package identifier 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return transaction (character) Transaction identifier. 10 | #' 11 | #' @family Miscellaneous 12 | #' 13 | #' @export 14 | #' 15 | create_data_package_archive <- function(packageId, env = "production") { 16 | .Deprecated(msg = "The 'create_data_package_archive' function is deprecated.") 17 | url <- paste0( 18 | base_url(env), "/package/archive/eml/", 19 | paste(parse_packageId(packageId), collapse = "/") 20 | ) 21 | resp <- httr::POST(url, set_user_agent(), handle = httr::handle("")) 22 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 23 | httr::stop_for_status(resp, res) 24 | return(res) 25 | } 26 | -------------------------------------------------------------------------------- /R/create_dn.R: -------------------------------------------------------------------------------- 1 | #' Create a users distinguished name 2 | #' 3 | #' @param userId (character) User identifier of an EDI data repository account 4 | #' @param ou (character) Organizational unit in which \code{userId} belongs. 5 | #' Can be "EDI" or "LTER". All \code{userId} issued after "2020-05-01" have 6 | #' \code{ou = "EDI"}. 7 | #' 8 | #' @return (character) Distinguished name 9 | #' 10 | #' @family Miscellaneous 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' # For an EDI account 16 | #' dn <- create_dn(userId = "my_userid", ou = "EDI") 17 | #' dn 18 | #' 19 | #' # For an LTER account 20 | #' dn <- create_dn(userId = "my_userid", ou = "LTER") 21 | #' dn 22 | create_dn <- function(userId, ou = "EDI") { 23 | ou <- toupper(ou) 24 | res <- paste0("uid=", userId, ",o=", ou, ",") 25 | if (ou == "EDI") { 26 | res <- paste0(res, "dc=edirepository,dc=org") 27 | } else { 28 | res <- paste0(res, "dc=ecoinformatics,dc=org") 29 | } 30 | return(res) 31 | } 32 | -------------------------------------------------------------------------------- /R/create_reservation.R: -------------------------------------------------------------------------------- 1 | #' Create reservation 2 | #' 3 | #' @description Reserves the next available identifier for the specified scope 4 | #' 5 | #' @param scope (character) Scope of data package 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (numeric) Identifier of reserved data package 10 | #' 11 | #' @note User authentication is required (see \code{login()}) 12 | #' 13 | #' @family Identifier Reservations 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' login() 21 | #' 22 | #' # Create reservation 23 | #' identifier <- create_reservation(scope = "edi", env = "staging") 24 | #' identifier 25 | #' #> [1] 604 26 | #' 27 | #' # Delete reservation 28 | #' delete_reservation(scope = "edi", identifier = identifier, env = "staging") 29 | #' #> [1] 604 30 | #' 31 | #' logout() 32 | #' } 33 | #' 34 | create_reservation <- function(scope, env = "production") { 35 | url <- paste0(base_url(env), "/package/reservations/eml/", scope) 36 | cookie <- bake_cookie() 37 | resp <- httr::POST(url, set_user_agent(), cookie, handle = httr::handle("")) 38 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 39 | httr::stop_for_status(resp, res) 40 | return(as.numeric(res)) 41 | } 42 | -------------------------------------------------------------------------------- /R/delete_journal_citation.R: -------------------------------------------------------------------------------- 1 | #' Delete journal citation 2 | #' 3 | #' @param journalCitationId (numeric) Journal citation identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (logical) TRUE if deleted 8 | #' 9 | #' @note User authentication is required (see \code{login()}) 10 | #' 11 | #' @family Journal Citations 12 | #' 13 | #' @export 14 | #' 15 | #' @examples 16 | #' \dontrun{ 17 | #' 18 | #' login() 19 | #' 20 | #' # Create journal citation 21 | #' journalCitationId <- create_journal_citation( 22 | #' packageId = "edi.17.1", 23 | #' articleDoi = "https://doi.org/10.1890/11-1026.1", 24 | #' articleTitle = "Corridors promote fire via connectivity and edge effects", 25 | #' journalTitle = "Ecological Applications", 26 | #' relationType = "IsCitedBy", 27 | #' env = "staging" 28 | #' ) 29 | #' journalCitationId 30 | #' #> [1] 74 31 | #' 32 | #' # Delete journal citation 33 | #' delete_journal_citation(journalCitationId, env = "staging") 34 | #' #> [1] TRUE 35 | #' 36 | #' logout() 37 | #' } 38 | #' 39 | delete_journal_citation <- function(journalCitationId, env = "production") { 40 | url <- paste0( 41 | base_url(env), "/package/citation/eml/", 42 | journalCitationId 43 | ) 44 | cookie <- bake_cookie() 45 | resp <- httr::DELETE( 46 | url, 47 | set_user_agent(), 48 | cookie, 49 | handle = httr::handle("") 50 | ) 51 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 52 | httr::stop_for_status(resp, res) 53 | if (resp$status_code == "200") { 54 | return(TRUE) 55 | } else { 56 | return(FALSE) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /R/delete_reservation.R: -------------------------------------------------------------------------------- 1 | #' Delete reservation 2 | #' 3 | #' @param scope (character) Scope of data package 4 | #' @param identifier (numeric) Identifier of data package 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @note User authentication is required (see \code{login()}). The same user 9 | #' who originally authenticated to create the reservation must authenticate to 10 | #' delete it. 11 | #' 12 | #' @return (numeric) The deleted reservation identifier value 13 | #' 14 | #' @family Identifier Reservations 15 | #' 16 | #' @export 17 | #' 18 | #' @examples 19 | #' \dontrun{ 20 | #' 21 | #' login() 22 | #' 23 | #' # Create reservation 24 | #' identifier <- create_reservation(scope = "edi", env = "staging") 25 | #' identifier 26 | #' #> [1] 604 27 | #' 28 | #' # Delete reservation 29 | #' delete_reservation(scope = "edi", identifier = identifier, env = "staging") 30 | #' #> [1] 604 31 | #' 32 | #' logout() 33 | #' } 34 | #' 35 | delete_reservation <- function(scope, identifier, env = "production") { 36 | url <- paste0( 37 | base_url(env), "/package/reservations/eml/", scope, 38 | "/", identifier 39 | ) 40 | cookie <- bake_cookie() 41 | resp <- httr::DELETE(url, set_user_agent(), cookie, handle = httr::handle("")) 42 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 43 | httr::stop_for_status(resp, res) 44 | return(as.numeric(res)) 45 | } 46 | -------------------------------------------------------------------------------- /R/get_audit_record.R: -------------------------------------------------------------------------------- 1 | #' Get audit record 2 | #' 3 | #' @param oid (numeric) Audit identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) An audit record 10 | #' 11 | #' @note User authentication is required (see \code{login()}) 12 | #' 13 | #' @family Audit Manager Services 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' login() 21 | #' 22 | #' # Get audit report 23 | #' auditReport <- get_audit_record(oid = "121606334") 24 | #' 25 | #' logout() 26 | #' } 27 | #' 28 | get_audit_record <- function(oid, as = "data.frame", env = "production") { 29 | url <- paste0(base_url(env), "/audit/report/", oid) 30 | cookie <- bake_cookie() 31 | resp <- httr::GET(url, set_user_agent(), cookie, handle = httr::handle("")) 32 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 33 | httr::stop_for_status(resp, res) 34 | res <- xml2::read_xml(res) 35 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 36 | } 37 | -------------------------------------------------------------------------------- /R/get_docid_reads.R: -------------------------------------------------------------------------------- 1 | #' Get doc ID reads 2 | #' 3 | #' @param scope (character) Scope of data package 4 | #' @param identifier (numeric) Identifier of data package 5 | #' @param as (character) Format of the returned object. Can be: "data.frame" 6 | #' or "xml". 7 | #' @param env (character) Repository environment. Can be: "production", 8 | #' "staging", or "development". 9 | #' 10 | #' @return (data.frame or xml_document) Summary of all the successful reads 11 | #' (total reads and non-robot reads) for all the resources of a given 12 | #' \code{scope} and \code{identifier}. 13 | #' 14 | #' @family Audit Manager Services 15 | #' 16 | #' @export 17 | #' 18 | #' @examples 19 | #' \dontrun{ 20 | #' 21 | #' # Get all reads 22 | #' resourceReads <- get_docid_reads(scope = "knb-lter-sgs", identifier = 817) 23 | #' } 24 | get_docid_reads <- function(scope, 25 | identifier, 26 | as = "data.frame", 27 | env = "production") { 28 | url <- paste0(base_url(env), "/audit/reads/", scope, "/", identifier) 29 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 30 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 31 | httr::stop_for_status(resp, res) 32 | res <- xml2::read_xml(res) 33 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 34 | } 35 | -------------------------------------------------------------------------------- /R/get_event_subscription.R: -------------------------------------------------------------------------------- 1 | #' Get event subscription 2 | #' 3 | #' @param subscriptionId (numeric) Event subscription identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) Subscription metadata 10 | #' 11 | #' @note User authentication is required (see \code{login()}) 12 | #' 13 | #' @family Event Notifications 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' login() 21 | #' 22 | #' # Get subscription 23 | #' subscription <- get_event_subscription( 24 | #' subscriptionId = 21, 25 | #' env = "staging" 26 | #' ) 27 | #' 28 | #' logout() 29 | #' } 30 | #' 31 | get_event_subscription <- function(subscriptionId, 32 | as = "data.frame", 33 | env = "production") { 34 | url <- paste0( 35 | base_url(env), "/package/event/eml/", 36 | subscriptionId 37 | ) 38 | cookie <- bake_cookie() 39 | resp <- httr::GET(url, set_user_agent(), cookie, handle = httr::handle("")) 40 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 41 | httr::stop_for_status(resp, res) 42 | res <- xml2::read_xml(res) 43 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 44 | } 45 | -------------------------------------------------------------------------------- /R/get_event_subscription_schema.R: -------------------------------------------------------------------------------- 1 | #' Get event subscription schema 2 | #' 3 | #' @param env (character) Repository environment. Can be: "production", 4 | #' "staging", or "development". 5 | #' 6 | #' @return (xml_document) Schema for event subscription creation request 7 | #' entities. 8 | #' 9 | #' See the 10 | #' \href{https://CRAN.R-project.org/package=xml2}{xml2} library 11 | #' for more on working with XML. 12 | #' 13 | #' @family Event Notifications 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' # Get schema 21 | #' schema <- get_event_subscription_schema() 22 | #' schema 23 | #' #> {xml_document} 24 | #' #> 25 | #' #> [1] \n \n 30 | #' #> 31 | #' #> 32 | #' #> 33 | #' #> 34 | #' #> 35 | #' #> 36 | #' } 37 | get_event_subscription_schema <- function(env = "production") { 38 | url <- paste0(base_url(env), "/package/event/eml/schema") 39 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 40 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 41 | httr::stop_for_status(resp, res) 42 | return(xml2::read_xml(res)) 43 | } 44 | -------------------------------------------------------------------------------- /R/get_journal_citation.R: -------------------------------------------------------------------------------- 1 | #' Get journal citation 2 | #' 3 | #' @param journalCitationId (numeric) Journal citation identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) Journal citation 10 | #' 11 | #' @family Journal Citations 12 | #' 13 | #' @export 14 | #' 15 | #' @examples 16 | #' \dontrun{ 17 | #' 18 | #' # Get citation 19 | #' journalCitation <- get_journal_citation(381) 20 | #' } 21 | get_journal_citation <- function(journalCitationId, 22 | as = "data.frame", 23 | env = "production") { 24 | url <- paste0( 25 | base_url(env), "/package/citation/eml/", 26 | journalCitationId 27 | ) 28 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 29 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 30 | httr::stop_for_status(resp, res) 31 | res <- xml2::read_xml(res) 32 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 33 | } 34 | -------------------------------------------------------------------------------- /R/get_packageid_reads.R: -------------------------------------------------------------------------------- 1 | #' Get package ID reads 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) Summary of all the successful reads 10 | #' (total reads and non-robot reads) of \code{packageId} 11 | #' 12 | #' @family Audit Manager Services 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' \dontrun{ 18 | #' 19 | #' # Get packageId reads 20 | #' resourceReads <- get_packageid_reads("knb-lter-sgs.817.17") 21 | #' } 22 | get_packageid_reads <- function(packageId, 23 | as = "data.frame", 24 | env = "production") { 25 | url <- paste0( 26 | base_url(env), "/audit/reads/", 27 | paste(parse_packageId(packageId), collapse = "/") 28 | ) 29 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 30 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 31 | httr::stop_for_status(resp, res) 32 | res <- xml2::read_xml(res) 33 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 34 | } 35 | -------------------------------------------------------------------------------- /R/get_provenance_metadata.R: -------------------------------------------------------------------------------- 1 | #' Get provenance metadata 2 | #' 3 | #' @description Generates the provenance metadata of a source data package 4 | #' 5 | #' @param packageId (character) Data package identifier 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (xml_document) Provenance metadata of \code{packageId}, representing 10 | #' a element that can be inserted into the section of a 11 | #' dependent data package. 12 | #' 13 | #' See the 14 | #' \href{https://CRAN.R-project.org/package=emld}{emld} library 15 | #' for more on working with EML as a list or JSON-LD. See the 16 | #' \href{https://CRAN.R-project.org/package=xml2}{xml2} library 17 | #' for working with EML as XML. 18 | #' 19 | #' @family Provenance 20 | #' 21 | #' @export 22 | #' 23 | #' @examples 24 | #' \dontrun{ 25 | #' 26 | #' methodStep <- get_provenance_metadata("knb-lter-pal.309.1") 27 | #' methodStep 28 | #' #> {xml_document} 29 | #' #> 30 | #' #> [1] \n This method step describes provenance-based ... 31 | #' #> [2] \n Stable isotope composition (d18O) of seawat ... 32 | #' } 33 | get_provenance_metadata <- function(packageId, env = "production") { 34 | url <- paste0( 35 | base_url(env), "/package/provenance/eml/", 36 | paste(parse_packageId(packageId), collapse = "/") 37 | ) 38 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 39 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 40 | httr::stop_for_status(resp, res) 41 | return(xml2::read_xml(res)) 42 | } 43 | -------------------------------------------------------------------------------- /R/is_authorized.R: -------------------------------------------------------------------------------- 1 | #' Is authorized to read 2 | #' 3 | #' @param resourceId (character) Resource identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (logical) TRUE if the authenticated user has permission to read the 8 | #' specified resource 9 | #' 10 | #' @note User authentication is required (see \code{login()}) 11 | #' 12 | #' @family Miscellaneous 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' \dontrun{ 18 | #' 19 | #' login() 20 | #' 21 | #' # Get the most recently created data package 22 | #' auditReport <- get_recent_uploads( 23 | #' query = "serviceMethod=createDataPackage&limit=1" 24 | #' ) 25 | #' 26 | #' # Get the resourceId 27 | #' resourceId <- xml2::xml_text( 28 | #' xml2::xml_find_all(auditReport, ".//resourceId") 29 | #' ) 30 | #' resourceId 31 | #' #> [1] "https://pasta.lternet.edu/package/eml/knb-lter-hbr/345/1" 32 | #' 33 | #' # Check read authorization 34 | #' is_authorized(resourceId) 35 | #' #> [1] TRUE 36 | #' 37 | #' logout() 38 | #' } 39 | #' 40 | is_authorized <- function(resourceId, env = "production") { 41 | url <- paste0( 42 | base_url(env), "/package/authz?resourceId=", 43 | resourceId 44 | ) 45 | cookie <- bake_cookie() 46 | resp <- httr::GET(url, set_user_agent(), cookie, handle = httr::handle("")) 47 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 48 | httr::stop_for_status(resp, res) 49 | if (resp$status_code == "200") { 50 | return(TRUE) 51 | } else { 52 | return(FALSE) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /R/list_active_reservations.R: -------------------------------------------------------------------------------- 1 | #' List active reservations 2 | #' 3 | #' @param as (character) Format of the returned object. Can be: "data.frame" 4 | #' or "xml". 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @return (data.frame or xml_document) The set of data package identifiers 9 | #' that users have actively reserved. Note that data package identifiers that 10 | #' have been successfully uploaded are no longer considered active reservations 11 | #' and thus are not included in this list. 12 | #' 13 | #' @family Identifier Reservations 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' # List reservations 21 | #' reservations <- list_active_reservations() 22 | #' } 23 | list_active_reservations <- function(as = "data.frame", env = "production") { 24 | url <- paste0(base_url(env), "/package/reservations/eml") 25 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 26 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 27 | httr::stop_for_status(resp, res) 28 | res <- xml2::read_xml(res) 29 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 30 | } 31 | -------------------------------------------------------------------------------- /R/list_data_descendants.R: -------------------------------------------------------------------------------- 1 | #' List data descendants 2 | #' 3 | #' @description Data descendants are data packages that are known to be 4 | #' derived, in whole or in part, from the specified source data package. 5 | #' 6 | #' @param packageId (character) Data package identifier 7 | #' @param as (character) Format of the returned object. Can be: "data.frame" 8 | #' or "xml". 9 | #' @param env (character) Repository environment. Can be: "production", 10 | #' "staging", or "development". 11 | #' 12 | #' @return (data.frame or xml_document) Descendants of \code{packageId} 13 | #' 14 | #' @family Listing 15 | #' 16 | #' @export 17 | #' 18 | #' @examples 19 | #' \dontrun{ 20 | #' 21 | #' # List descendants 22 | #' dataDescendants <- list_data_descendants("knb-lter-bnz.501.17") 23 | #' } 24 | list_data_descendants <- function(packageId, 25 | as = "data.frame", 26 | env = "production") { 27 | url <- paste0( 28 | base_url(env), "/package/descendants/eml/", 29 | paste(parse_packageId(packageId), collapse = "/") 30 | ) 31 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 32 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 33 | httr::stop_for_status(resp, res) 34 | res <- xml2::read_xml(res) 35 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 36 | } 37 | -------------------------------------------------------------------------------- /R/list_data_entities.R: -------------------------------------------------------------------------------- 1 | #' List data entities 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (character) Identifiers for all data entities in \code{packageId} 8 | #' 9 | #' @family Listing 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' \dontrun{ 15 | #' 16 | #' entityIds <- list_data_entities("knb-lter-and.2732.7") 17 | #' entityIds 18 | #' #> [1] "0464a1d9262fc6e609cb0b24adb7e5ba" 19 | #' #> [2] "cc3ade83d3655edd2ca674721a52ef46" 20 | #' } 21 | list_data_entities <- function(packageId, env = "production") { 22 | url <- paste0( 23 | base_url(env), "/package/data/eml/", 24 | paste(parse_packageId(packageId), collapse = "/") 25 | ) 26 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 27 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 28 | httr::stop_for_status(resp, res) 29 | return(text2char(res)) 30 | } 31 | -------------------------------------------------------------------------------- /R/list_data_package_citations.R: -------------------------------------------------------------------------------- 1 | #' List data package citations 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param list_all (logical) Return all citations within a data package series? 7 | #' @param env (character) Repository environment. Can be: "production", 8 | #' "staging", or "development". 9 | #' 10 | #' @return (data.frame or xml_document) A list of journal citations 11 | #' 12 | #' @family Journal Citations 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' \dontrun{ 18 | #' 19 | #' # List citations 20 | #' journalCitations <- list_data_package_citations("edi.845.1") 21 | #' } 22 | list_data_package_citations <- function(packageId, 23 | as = "data.frame", 24 | list_all = FALSE, 25 | env = "production") { 26 | url <- paste0( 27 | base_url(env), "/package/citations/eml/", 28 | paste(parse_packageId(packageId), collapse = "/") 29 | ) 30 | if (list_all) { 31 | url <- paste0(url, "?all") 32 | } 33 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 34 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 35 | httr::stop_for_status(resp, res) 36 | res <- xml2::read_xml(res) 37 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 38 | } 39 | -------------------------------------------------------------------------------- /R/list_data_package_identifiers.R: -------------------------------------------------------------------------------- 1 | #' List data package identifiers 2 | #' 3 | #' @param scope (character) Scope of data package 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (numeric) Identifiers of data packages within a specified 8 | #' \code{scope} 9 | #' 10 | #' @family Listing 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' # List identifiers 18 | #' identifiers <- list_data_package_identifiers("knb-lter-ble") 19 | #' identifiers 20 | #' #> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 23 21 | #' } 22 | list_data_package_identifiers <- function(scope, env = "production") { 23 | url <- paste0(base_url(env), "/package/eml/", scope) 24 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 25 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 26 | httr::stop_for_status(resp, res) 27 | return(as.numeric(text2char(res))) 28 | } 29 | -------------------------------------------------------------------------------- /R/list_data_package_revisions.R: -------------------------------------------------------------------------------- 1 | #' List data package revisions 2 | #' 3 | #' @param scope (character) Scope of data package 4 | #' @param identifier (numeric) Identifier of data package 5 | #' @param filter (character) Filter results by "newest" or "oldest" 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (numeric) Revisions of a data package within a specified 10 | #' \code{scope} and \code{identifier} 11 | #' 12 | #' @family Listing 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' \dontrun{ 18 | #' 19 | #' # List revisions 20 | #' revisions <- list_data_package_revisions("knb-lter-arc", 20131) 21 | #' revisions 22 | #' #> [1] 1 2 23 | #' } 24 | list_data_package_revisions <- function(scope, 25 | identifier, 26 | filter = NULL, 27 | env = "production") { 28 | url <- paste0( 29 | base_url(env), "/package/eml/", 30 | paste(c(scope, as.character(identifier)), collapse = "/") 31 | ) 32 | if (!is.null(filter)) { 33 | url <- paste0(url, "?filter=", filter) 34 | } 35 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 36 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 37 | httr::stop_for_status(resp, res) 38 | return(as.numeric(text2char(res))) 39 | } 40 | -------------------------------------------------------------------------------- /R/list_data_sources.R: -------------------------------------------------------------------------------- 1 | #' List data sources 2 | #' 3 | #' @description Data sources are data packages, or other online digital 4 | #' objects, that are known to be inputs to the specified derived data package. 5 | #' 6 | #' @param packageId (character) Data package identifier 7 | #' @param as (character) Format of the returned object. Can be: "data.frame" 8 | #' or "xml". 9 | #' @param env (character) Repository environment. Can be: "production", 10 | #' "staging", or "development". 11 | #' 12 | #' @return (data.frame or xml_document) Data sources to \code{packageId} 13 | #' 14 | #' @details Data sources can be either internal or external to the EDI data 15 | #' repository. Internal data sources include a packageId value and a URL to the 16 | #' source metadata. For data sources external to PASTA, the packageId element 17 | #' will be empty and a URL value may or not be documented. 18 | #' 19 | #' @family Listing 20 | #' 21 | #' @export 22 | #' 23 | #' @examples 24 | #' \dontrun{ 25 | #' 26 | #' # List sources 27 | #' dataSources <- list_data_sources("edi.275.4") 28 | #' } 29 | list_data_sources <- function(packageId, 30 | as = "data.frame", 31 | env = "production") { 32 | url <- paste0( 33 | base_url(env), "/package/sources/eml/", 34 | paste(parse_packageId(packageId), collapse = "/") 35 | ) 36 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 37 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 38 | httr::stop_for_status(resp, res) 39 | res <- xml2::read_xml(res) 40 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 41 | } 42 | -------------------------------------------------------------------------------- /R/list_deleted_data_packages.R: -------------------------------------------------------------------------------- 1 | #' List deleted data packages 2 | #' 3 | #' @param env (character) Repository environment. Can be: "production", 4 | #' "staging", or "development". 5 | #' 6 | #' @return (character) All data packages (excluding revision values) that have 7 | #' been deleted from the data package registry. 8 | #' 9 | #' @family Listing 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' \dontrun{ 15 | #' 16 | #' # List deleted data packages 17 | #' deleted <- list_deleted_data_packages() 18 | #' head(deleted) 19 | #' #> [1] "edi.10" "edi.222" "edi.419" "edi.511" "edi.857" "edi.878" 20 | #' } 21 | list_deleted_data_packages <- function(env = "production") { 22 | url <- paste0(base_url(env), "/package/eml/deleted") 23 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 24 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 25 | httr::stop_for_status(resp, res) 26 | return(text2char(res)) 27 | } 28 | -------------------------------------------------------------------------------- /R/list_principal_owner_citations.R: -------------------------------------------------------------------------------- 1 | #' List principal owner citations 2 | #' 3 | #' @param principalOwner (character) Principal owner in the format returned by 4 | #' \code{create_dn()} 5 | #' @param as (character) Format of the returned object. Can be: "data.frame" 6 | #' or "xml". 7 | #' @param env (character) Repository environment. Can be: "production", 8 | #' "staging", or "development". 9 | #' 10 | #' @return (data.frame or xml_document) Journal citations metadata for all 11 | #' entries owned by the specified principal owner 12 | #' 13 | #' @family Journal Citations 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' # List citations 21 | #' dn <- create_dn(userId = "FCE", ou = "EDI") 22 | #' journalCitations <- list_principal_owner_citations(principalOwner = dn) 23 | #' } 24 | list_principal_owner_citations <- function(principalOwner, 25 | as = "data.frame", 26 | env = "production") { 27 | url <- paste0( 28 | base_url(env), "/package/citations/eml/", 29 | principalOwner 30 | ) 31 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 32 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 33 | httr::stop_for_status(resp, res) 34 | res <- xml2::read_xml(res) 35 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 36 | } 37 | -------------------------------------------------------------------------------- /R/list_recent_uploads.R: -------------------------------------------------------------------------------- 1 | #' List recent uploads 2 | #' 3 | #' @param type (character) Upload type. Can be: "insert" or "update". 4 | #' @param limit (numeric) Maximum number of results to return 5 | #' @param as (character) Format of the returned object. Can be: "data.frame" 6 | #' or "xml". 7 | #' @param env (character) Repository environment. Can be: "production", 8 | #' "staging", or "development". 9 | #' 10 | #' @return (data.frame or xml_document) Data package uploads 11 | #' 12 | #' @family Listing 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' \dontrun{ 18 | #' 19 | #' # Get the 3 newest revisions 20 | #' dataPackageUploads <- list_recent_uploads("update", 3) 21 | #' } 22 | list_recent_uploads <- function(type, 23 | limit = 5, 24 | as = "data.frame", 25 | env = "production") { 26 | url <- paste0( 27 | base_url(env), "/package/uploads/eml", 28 | "?type=", type, "&limit=", limit 29 | ) 30 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 31 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 32 | httr::stop_for_status(resp, res) 33 | res <- xml2::read_xml(res) 34 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 35 | } 36 | -------------------------------------------------------------------------------- /R/list_reservation_identifiers.R: -------------------------------------------------------------------------------- 1 | #' List reservation identifiers 2 | #' 3 | #' @param scope (character) Scope of data package 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (numeric) The set of identifiers for the specified \code{scope} that 8 | #' end users have actively reserved for future upload 9 | #' 10 | #' @family Identifier Reservations 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' # List reservations 18 | #' reservations <- list_reservation_identifiers(scope = "edi") 19 | #' reservations 20 | #' #> [1] 11 130 131 132 142 152 154 156 158 159 161 162 171 21 | #' #> [14] 172 173 174 175 177 178 180 182 183 185 196 203 ... 22 | #' } 23 | list_reservation_identifiers <- function(scope, env = "production") { 24 | url <- paste0(base_url(env), "/package/reservations/eml/", scope) 25 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 26 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 27 | httr::stop_for_status(resp, res) 28 | return(as.numeric(text2char(res))) 29 | } 30 | -------------------------------------------------------------------------------- /R/list_user_data_packages.R: -------------------------------------------------------------------------------- 1 | #' List user data packages 2 | #' 3 | #' @description List all data packages (including their revision values) 4 | #' uploaded to the repository by a particular user, specified by a 5 | #' distinguished name. Data packages that were uploaded by the specified user 6 | #' but have since been deleted are excluded from the list. 7 | #' 8 | #' @param dn (character) Distinguished name of user. Create with 9 | #' \code{create_dn()}. 10 | #' @param env (character) Repository environment. Can be: "production", 11 | #' "staging", or "development". 12 | #' 13 | #' @return (character) Data package identifiers belonging to a \code{dn} 14 | #' 15 | #' @family Listing 16 | #' 17 | #' @export 18 | #' 19 | #' @examples 20 | #' \dontrun{ 21 | #' 22 | #' # List user data packages 23 | #' dn <- create_dn(userId = "dbjourneynorth") 24 | #' packageIds <- list_user_data_packages(dn) 25 | #' packageIds 26 | #' #> [1] "edi.948.1" "edi.949.1" 27 | #' } 28 | list_user_data_packages <- function(dn, env = "production") { 29 | url <- paste0(base_url(env), "/package/user/", dn) 30 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 31 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 32 | httr::stop_for_status(resp, res) 33 | return(text2char(res)) 34 | } 35 | -------------------------------------------------------------------------------- /R/list_working_on.R: -------------------------------------------------------------------------------- 1 | #' List working on 2 | #' 3 | #' @param as (character) Format of the returned object. Can be: "data.frame" 4 | #' or "xml". 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @return (data.frame or xml_document) The set of data packages the EDI 9 | #' repository is currently working on inserting or updating. Note that data 10 | #' packages currently being evaluated by the EDI repository are not included in 11 | #' the list. 12 | #' 13 | #' @family System Monitoring 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' list_working_on() 21 | #' } 22 | list_working_on <- function(as = "data.frame", env = "production") { 23 | url <- paste0(base_url(env), "/package/workingon/eml") 24 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 25 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 26 | httr::stop_for_status(resp, res) 27 | res <- xml2::read_xml(res) 28 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 29 | } 30 | -------------------------------------------------------------------------------- /R/logout.R: -------------------------------------------------------------------------------- 1 | #' Logout of the EDI repository 2 | #' 3 | #' @details Removes the temporary authentication token system variable 4 | #' "EDI_TOKEN". 5 | #' 6 | #' @return (NULL) No return value. 7 | #' 8 | #' @family Authentication 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' \dontrun{ 14 | #' logout() 15 | #' } 16 | #' 17 | logout <- function() { 18 | suppressWarnings(Sys.unsetenv("EDI_TOKEN")) 19 | } 20 | -------------------------------------------------------------------------------- /R/read_data_entity_checksum.R: -------------------------------------------------------------------------------- 1 | #' Read data entity checksum 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param entityId (character) Data entity identifier 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @return (character) A 40-character SHA-1 checksum value of \code{entityId} 9 | #' in \code{packageId} 10 | #' 11 | #' @family Accessing 12 | #' 13 | #' @export 14 | #' 15 | #' @examples 16 | #' \dontrun{ 17 | #' 18 | #' # List data entities 19 | #' entityIds <- list_data_entities(packageId = "knb-lter-ble.1.7") 20 | #' entityIds 21 | #' #> [1] "a1723e0e5f3c4881f1a7ede1b036aba6" 22 | #' #> [2] "b698644419ea88ab1072f4fcbef9083c" 23 | #' #> [3] "617415426847fd900b644283d86c1c66" 24 | #' #> [4] "9942544de7e794ce84a62151bd41e6b3" 25 | #' 26 | #' # Read checksum 27 | #' checksum <- read_data_entity_checksum( 28 | #' packageId = "knb-lter-ble.1.7", 29 | #' entityId = entityIds[1] 30 | #' ) 31 | #' checksum 32 | #' #> [1] "22b189095bc9a166c3891e80b67b2a636eae60a4" 33 | 34 | #' } 35 | read_data_entity_checksum <- function(packageId, entityId, env = "production") { 36 | pkg <- parse_packageId(packageId) 37 | url <- paste0( 38 | base_url(env), "/package/data/checksum/eml/", 39 | paste(pkg, collapse = "/"), "/", entityId 40 | ) 41 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 42 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 43 | httr::stop_for_status(resp, res) 44 | return(text2char(res)) 45 | } 46 | -------------------------------------------------------------------------------- /R/read_data_entity_name.R: -------------------------------------------------------------------------------- 1 | #' Read data entity name 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param entityId (character) Data entity identifier 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @return (character) Name of \code{entityId} in \code{packageId} 9 | #' 10 | #' @family Accessing 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' # List entities 18 | #' entityIds <- list_data_entities(packageId = "knb-lter-cap.691.2") 19 | #' entityIds 20 | #' #> [1] "f6e4efd0b04aea3860724824ca05c5dd" 21 | #' #> [2] "d2263480e75cc7888b41928602cda4c6" 22 | #' #> [3] "d5cb83e4556408e48f636157e4dee49e" 23 | #' 24 | #' # Read name 25 | #' entityName <- read_data_entity_name( 26 | #' packageId = "knb-lter-cap.691.2", 27 | #' entityId = entityIds[1] 28 | #' ) 29 | #' entityName 30 | #' #> [1] "691_arthropods_00742cd00ab0d3d02337e28d1c919654.csv" 31 | #' } 32 | read_data_entity_name <- function(packageId, entityId, env = "production") { 33 | url <- paste0( 34 | base_url(env), "/package/name/eml/", 35 | paste(parse_packageId(packageId), collapse = "/"), "/", 36 | entityId 37 | ) 38 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 39 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 40 | httr::stop_for_status(resp, res) 41 | return(text2char(res)) 42 | } 43 | -------------------------------------------------------------------------------- /R/read_data_entity_names.R: -------------------------------------------------------------------------------- 1 | #' Read data entity names 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (data.frame) Names and identifiers of all data entities in 8 | #' \code{packageId} 9 | #' 10 | #' @family Accessing 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' read_data_entity_names("knb-lter-cap.691.2") 18 | #' #> entityId 19 | #' #> 1 f6e4efd0b04aea3860724824ca05c5dd 20 | #' #> 2 d2263480e75cc7888b41928602cda4c6 21 | #' #> 3 d5cb83e4556408e48f636157e4dee49e 22 | #' #> entityName 23 | #' #> 1 691_arthropods_00742cd00ab0d3d02337e28d1c919654.csv 24 | #' #> 2 691_captures_e5f57a98ae0b7941b10d4a600645495a.csv 25 | #' #> 3 691_sampling_events_e8d76d7e76385e4ae84bcafb754d0093.csv 26 | #' } 27 | read_data_entity_names <- function(packageId, env = "production") { 28 | url <- paste0( 29 | base_url(env), "/package/name/eml/", 30 | paste(parse_packageId(packageId), collapse = "/") 31 | ) 32 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 33 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 34 | httr::stop_for_status(resp, res) 35 | 36 | # PASTA uses commas as a field delimiter, which results in parsing issues if 37 | # an entity name contains commas. So fix here until fixed in PASTA. 38 | res <- unlist(strsplit(res, "\\n")) 39 | dlim <- "\\|\\|\\|" 40 | res <- strsplit(sub(",\\s*", dlim, res), dlim) 41 | df <- data.frame(do.call(rbind, res)) 42 | 43 | names(df) <- c("entityId", "entityName") 44 | return(df) 45 | } 46 | -------------------------------------------------------------------------------- /R/read_data_entity_size.R: -------------------------------------------------------------------------------- 1 | #' Read data entity size 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param entityId (character) Data entity identifier 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @return (numeric) Size, in bytes, of \code{entityId} in \code{packageId} 9 | #' 10 | #' @family Accessing 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' # List data entities 18 | #' entityIds <- list_data_entities(packageId = "knb-lter-cdr.711.1") 19 | #' entityIds 20 | #' #> [1] "c61703839eac9a641ea0c3c69dc3345b" 21 | #' 22 | #' # Read size 23 | #' size <- read_data_entity_size( 24 | #' packageId = "knb-lter-cdr.711.1", 25 | #' entityId = entityIds 26 | #' ) 27 | #' size 28 | #' #> [1] 707094 29 | #' } 30 | read_data_entity_size <- function(packageId, entityId, env = "production") { 31 | url <- paste0( 32 | base_url(env), "/package/data/size/eml/", 33 | paste(parse_packageId(packageId), collapse = "/"), "/", 34 | entityId 35 | ) 36 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 37 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 38 | httr::stop_for_status(resp, res) 39 | return(as.numeric(text2char(res))) 40 | } 41 | -------------------------------------------------------------------------------- /R/read_data_entity_sizes.R: -------------------------------------------------------------------------------- 1 | #' Read data entity sizes 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (data.frame) Size (in bytes) and identifiers of data entities in 8 | #' \code{packageId} 9 | #' 10 | #' @family Accessing 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' # Read entity sizes 18 | #' sizes <- read_data_entity_sizes(packageId = "knb-lter-bnz.786.3") 19 | #' sizes 20 | #' #> entityId size 21 | #' #> 1 66bf513405f7799c35f24e4b33f7d835 19513 22 | #' #> 2 33d2d8cedeea9d5dbefc973680d4557e 26429 23 | #' #> 3 197b0d4372ecabd697cfd5ff1157e41b 2295 24 | #' #> 4 bb8cdcf1d6f06f61007620bfa5333f2a 123366 25 | #' #> 5 0916ac12f9896c35a27ea156c653718e 46475 26 | #' } 27 | read_data_entity_sizes <- function(packageId, env = "production") { 28 | url <- paste0( 29 | base_url(env), "/package/data/size/eml/", 30 | paste(parse_packageId(packageId), collapse = "/") 31 | ) 32 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 33 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 34 | httr::stop_for_status(resp, res) 35 | df <- utils::read.csv(text = res, as.is = TRUE, header = FALSE) 36 | names(df) <- c("entityId", "size") 37 | return(df) 38 | } 39 | -------------------------------------------------------------------------------- /R/read_data_package_archive.R: -------------------------------------------------------------------------------- 1 | #' Read data package archive 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param transaction (character) Transaction identifier. This parameter is 5 | #' DEPRECATED. 6 | #' @param path (character) Path of directory in which the result will be written 7 | #' @param env (character) Repository environment. Can be: "production", 8 | #' "staging", or "development". 9 | #' 10 | #' @return (.zip file) The data package archive of \code{packageId} requested 11 | #' by \code{transaction} 12 | #' 13 | #' @family Accessing 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' # Download zip archive 21 | #' read_data_package_archive("knb-lter-sev.31999.1", path = tempdir()) 22 | #' #> |=============================================================| 100% 23 | #' dir(tempdir()) 24 | #' #> [1] "knb-lter-sev.31999.1.zip" 25 | #' } 26 | #' 27 | read_data_package_archive <- function(packageId, 28 | transaction, 29 | path, 30 | env = "production") { 31 | if (!missing(transaction)) { 32 | warning( 33 | "The 'transaction' parameter is deprecated and no longer required. ", 34 | "Please use this function without it.", call. = FALSE 35 | ) 36 | } 37 | url <- paste0( 38 | base_url(env), "/package/download/eml/", 39 | paste(parse_packageId(packageId), collapse = "/") 40 | ) 41 | resp <- httr::GET( 42 | url, 43 | set_user_agent(), 44 | handle = httr::handle(""), 45 | httr::write_disk(paste0(path, "/", packageId, ".zip")), 46 | httr::progress() 47 | ) 48 | } 49 | -------------------------------------------------------------------------------- /R/read_data_package_doi.R: -------------------------------------------------------------------------------- 1 | #' Read data package Digital Object Identifier 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param as_url (logical) Returns the DOI as a URL if TRUE. 5 | #' @param env (character) Repository environment. Can be: "production", 6 | #' "staging", or "development". 7 | #' 8 | #' @return (character) The Digital Object Identifier for \code{packageId} 9 | #' 10 | #' @family Accessing 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' \dontrun{ 16 | #' 17 | #' # Read package DOI 18 | #' doi <- read_data_package_doi("knb-lter-jrn.210548103.15") 19 | #' doi 20 | #' #> [1] "doi:10.6073/pasta/c80c0c03d22791524d4b870d2193c843" 21 | #' 22 | #' # Read package DOI as URL 23 | #' doi <- read_data_package_doi("knb-lter-jrn.210548103.15", as_url = TRUE) 24 | #' doi 25 | #' #> [1] "https://doi.org/10.6073/pasta/c80c0c03d22791524d4b870d2193c843" 26 | #' } 27 | read_data_package_doi <- function(packageId, 28 | as_url = FALSE, 29 | env = "production") { 30 | url <- paste0( 31 | base_url(env), "/package/doi/eml/", 32 | paste(parse_packageId(packageId), collapse = "/") 33 | ) 34 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 35 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 36 | httr::stop_for_status(resp, res) 37 | res <- text2char(res) 38 | if (as_url) { 39 | res <- gsub("doi:", "", res) 40 | return(paste0("https://doi.org/", res)) 41 | } else { 42 | return(res) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /R/read_data_package_error.R: -------------------------------------------------------------------------------- 1 | #' Read data package error 2 | #' 3 | #' @param transaction (character) Transaction identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return An error is returned if an error occurred while processing the 8 | #' request, otherwise \code{NULL} is returned if no error was encountered or if 9 | #' processing is still underway. 10 | #' 11 | #' @note User authentication is required (see \code{login()}) 12 | #' 13 | #' @family Accessing 14 | #' 15 | #' @export 16 | #' 17 | read_data_package_error <- function(transaction, env = "production") { 18 | if (grepl("__", transaction)) { 19 | transaction <- unlist(strsplit(transaction, "__"))[1] 20 | } 21 | url <- paste0(base_url(env), "/package/error/eml/", transaction) 22 | cookie <- bake_cookie() 23 | resp <- httr::GET(url, set_user_agent(), cookie, handle = httr::handle("")) 24 | if (resp$status_code %in% c("200", "400", "401", "405", "500")) { 25 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 26 | stop(res, call. = FALSE) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /R/read_data_package_report_checksum.R: -------------------------------------------------------------------------------- 1 | #' Read data package report checksum 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (character) A 40 character SHA-1 checksum value for the report 8 | #' 9 | #' @family Accessing 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' \dontrun{ 15 | #' 16 | #' # Read report checksum 17 | #' packageId <- "knb-lter-luq.208.1" 18 | #' checksum <- read_data_package_report_checksum(packageId) 19 | #' checksum 20 | #' #> "980dbf3f3cdb7395933b711b005722033bdcd12f" 21 | #' } 22 | read_data_package_report_checksum <- function(packageId, env = "production") { 23 | url <- paste0( 24 | base_url(env), "/package/report/checksum/eml/", 25 | paste(parse_packageId(packageId), collapse = "/") 26 | ) 27 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 28 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 29 | httr::stop_for_status(resp, res) 30 | return(text2char(res)) 31 | } 32 | -------------------------------------------------------------------------------- /R/read_data_package_report_resource_metadata.R: -------------------------------------------------------------------------------- 1 | #' Read data package report resource metadata 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) Report resource metadata 10 | #' 11 | #' @family Accessing 12 | #' 13 | #' @export 14 | #' 15 | #' @examples 16 | #' \dontrun{ 17 | #' 18 | #' # Read resource metadata 19 | #' resourceMetadata <- read_data_package_report_resource_metadata( 20 | #' packageId = "knb-lter-mcm.9129.3" 21 | #' ) 22 | #' } 23 | read_data_package_report_resource_metadata <- function(packageId, 24 | as = "data.frame", 25 | env = "production") { 26 | url <- paste0( 27 | base_url(env), "/package/rmd/eml/", 28 | paste(parse_packageId(packageId), collapse = "/") 29 | ) 30 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 31 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 32 | httr::stop_for_status(resp, res) 33 | res <- xml2::read_xml(res) 34 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 35 | } 36 | -------------------------------------------------------------------------------- /R/read_data_package_resource_metadata.R: -------------------------------------------------------------------------------- 1 | #' Read data package resource metadata 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) Resource metadata of \code{packageId} 10 | #' 11 | #' @family Accessing 12 | #' 13 | #' @export 14 | #' 15 | #' @examples 16 | #' \dontrun{ 17 | #' 18 | #' # Read resource metadata 19 | #' resourceMetadata <- read_data_package_resource_metadata( 20 | #' packageId = "edi.613.1" 21 | #' ) 22 | #' } 23 | read_data_package_resource_metadata <- function(packageId, 24 | as = "data.frame", 25 | env = "production") { 26 | url <- paste0( 27 | base_url(env), "/package/rmd/eml/", 28 | paste(parse_packageId(packageId), collapse = "/") 29 | ) 30 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 31 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 32 | httr::stop_for_status(resp, res) 33 | res <- xml2::read_xml(res) 34 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 35 | } 36 | -------------------------------------------------------------------------------- /R/read_metadata.R: -------------------------------------------------------------------------------- 1 | #' Read metadata 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (xml_document) EML metadata document. 8 | #' 9 | #' See the 10 | #' \href{https://CRAN.R-project.org/package=emld}{emld} library 11 | #' for more on working with EML as a list or JSON-LD. See the 12 | #' \href{https://CRAN.R-project.org/package=xml2}{xml2} library 13 | #' for working with EML as XML. 14 | #' 15 | #' @family Accessing 16 | #' 17 | #' @export 18 | #' 19 | #' @examples 20 | #' \dontrun{ 21 | #' 22 | #' # Read metadata 23 | #' eml <- read_metadata("edi.100.1") 24 | #' eml 25 | #' #> {xml_document} 26 | #' #> <eml packageId="edi.100.1" system="https://pasta.edirepository.org" ... 27 | #' #> [1] <access authSystem="https://pasta.edirepository.org/authenticatio ... 28 | #' #> [2] <dataset>\n <alternateIdentifier system="https://doi.org">doi:10 ... 29 | #' } 30 | read_metadata <- function(packageId, env = "production") { 31 | url <- paste0( 32 | base_url(env), "/package/metadata/eml/", 33 | paste(parse_packageId(packageId), collapse = "/") 34 | ) 35 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 36 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 37 | httr::stop_for_status(resp, res) 38 | return(xml2::read_xml(res)) 39 | } 40 | -------------------------------------------------------------------------------- /R/read_metadata_checksum.R: -------------------------------------------------------------------------------- 1 | #' Read metadata checksum 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (character) A 40 character SHA-1 checksum value 8 | #' 9 | #' @family Accessing 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' \dontrun{ 15 | #' 16 | #' # Read checksum 17 | #' checksum <- read_metadata_checksum("knb-lter-ntl.409.1") 18 | #' checksum 19 | #' #> [1] "c89d0ac740f65ef599c6a90619221441e20b8b6e" 20 | #' } 21 | read_metadata_checksum <- function(packageId, env = "production") { 22 | url <- paste0( 23 | base_url(env), "/package/metadata/checksum/eml/", 24 | paste(parse_packageId(packageId), collapse = "/") 25 | ) 26 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 27 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 28 | httr::stop_for_status(resp, res) 29 | return(text2char(res)) 30 | } 31 | -------------------------------------------------------------------------------- /R/read_metadata_dublin_core.R: -------------------------------------------------------------------------------- 1 | #' Read metadata Dublin Core 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (xml_document) Dublin Core metadata. 8 | #' 9 | #' See the 10 | #' \href{https://CRAN.R-project.org/package=xml2}{xml2} library 11 | #' for more on working with XML. 12 | #' 13 | #' @family Accessing 14 | #' 15 | #' @export 16 | #' 17 | #' @examples 18 | #' \dontrun{ 19 | #' 20 | #' # Read dc metadata 21 | #' dc <- read_metadata_dublin_core("knb-lter-nes.10.1") 22 | #' dc 23 | #' #> {xml_document} 24 | #' #> <dc schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http: ... 25 | #' #> [1] <dc:type/> 26 | #' #> [2] <dc:identifier/> 27 | #' } 28 | read_metadata_dublin_core <- function(packageId, env = "production") { 29 | url <- paste0( 30 | base_url(env), "/package/metadata/dc/", 31 | paste(parse_packageId(packageId), collapse = "/") 32 | ) 33 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 34 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 35 | httr::stop_for_status(resp, res) 36 | return(xml2::read_xml(res)) 37 | } 38 | -------------------------------------------------------------------------------- /R/read_metadata_format.R: -------------------------------------------------------------------------------- 1 | #' Read metadata format 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param env (character) Repository environment. Can be: "production", 5 | #' "staging", or "development". 6 | #' 7 | #' @return (character) Metadata format type 8 | #' 9 | #' @family Accessing 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' \dontrun{ 15 | #' 16 | #' # Read format 17 | #' metadataFormat <- read_metadata_format("knb-lter-nwt.930.1") 18 | #' metadataFormat 19 | #' #> [1] "eml://ecoinformatics.org/eml-2.1.1" 20 | #' } 21 | read_metadata_format <- function(packageId, env = "production") { 22 | url <- paste0( 23 | base_url(env), "/package/metadata/format/eml/", 24 | paste(parse_packageId(packageId), collapse = "/") 25 | ) 26 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 27 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 28 | httr::stop_for_status(resp, res) 29 | return(text2char(res)) 30 | } 31 | -------------------------------------------------------------------------------- /R/read_metadata_resource_metadata.R: -------------------------------------------------------------------------------- 1 | #' Read metadata resource metadata 2 | #' 3 | #' @param packageId (character) Data package identifier 4 | #' @param as (character) Format of the returned object. Can be: "data.frame" 5 | #' or "xml". 6 | #' @param env (character) Repository environment. Can be: "production", 7 | #' "staging", or "development". 8 | #' 9 | #' @return (data.frame or xml_document) Resource metadata for the data package 10 | #' metadata resource 11 | #' 12 | #' @family Accessing 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' \dontrun{ 18 | #' 19 | #' # Read resource metadata 20 | #' resourceMetadata <- read_metadata_resource_metadata( 21 | #' packageId = "knb-lter-pal.309.1" 22 | #' ) 23 | #' } 24 | read_metadata_resource_metadata <- function(packageId, 25 | as = "data.frame", 26 | env = "production") { 27 | url <- paste0( 28 | base_url(env), "/package/metadata/rmd/eml/", 29 | paste(parse_packageId(packageId), collapse = "/") 30 | ) 31 | resp <- httr::GET(url, set_user_agent(), handle = httr::handle("")) 32 | res <- httr::content(resp, as = "text", encoding = "UTF-8") 33 | httr::stop_for_status(resp, res) 34 | res <- xml2::read_xml(res) 35 | ifelse(as == "data.frame", return(xml2df(res)), return(res)) 36 | } 37 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | 404.html 2 | -------------------------------------------------------------------------------- /docs/articles/daily_downloads-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/EDIutils/790f5e270ec973ebe231f623985dbd494dd7e429/docs/articles/daily_downloads-1.png -------------------------------------------------------------------------------- /docs/articles/evaluate_and_upload_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/retrieve_citations_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/retrieve_downloads_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/search_and_access_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/tests_requiring_authentication_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" 4 | viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve"> 5 | <style type="text/css"> 6 | .st0{fill:#75AADB;} 7 | </style> 8 | <path class="st0" d="M4,11.3h1.3v1.3H4c-2,0-4-2.3-4-4.7s2.1-4.7,4-4.7h5.3c1.9,0,4,2.3,4,4.7c0,1.9-1.2,3.6-2.7,4.3v-1.5 9 | C11.4,10.2,12,9.1,12,8c0-1.7-1.4-3.3-2.7-3.3H4C2.7,4.7,1.3,6.3,1.3,8S2.7,11.3,4,11.3z M16,7.3h-1.3v1.3H16c1.3,0,2.7,1.6,2.7,3.3 10 | s-1.4,3.3-2.7,3.3h-5.3C9.4,15.3,8,13.7,8,12c0-1.1,0.6-2.2,1.3-2.8V7.7C7.9,8.4,6.7,10.1,6.7,12c0,2.4,2.1,4.7,4,4.7H16 11 | c1.9,0,4-2.3,4-4.7S18,7.3,16,7.3z"/> 12 | </svg> 13 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.11.4 2 | pkgdown: 2.0.2 3 | pkgdown_sha: ~ 4 | articles: 5 | evaluate_and_upload: evaluate_and_upload.html 6 | retrieve_citations: retrieve_citations.html 7 | retrieve_downloads: retrieve_downloads.html 8 | search_and_access: search_and_access.html 9 | tests_requiring_authentication: tests_requiring_authentication.html 10 | last_built: 2022-04-23T22:14Z 11 | 12 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/EDIutils/790f5e270ec973ebe231f623985dbd494dd7e429/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite EDIutils in publications use:") 2 | 3 | year <- sub("-.*", "", meta$Date) 4 | note <- sprintf("R package version %s", meta$Version) 5 | url <- "https://github.com/ropensci/EDIutils" 6 | 7 | bibentry(bibtype = "Manual", 8 | title = "{EDIutils}: An API Client for the Environmental Data Initiative Repository in R", 9 | author = c(person("Colin", "Smith")), 10 | year = year, 11 | url = url) 12 | 13 | textVersion <- paste0( 14 | "Colin A Smith, (", year, "). EDIutils: An API Client for the Environmental ", 15 | "Data Initiative Repository in R. ", url 16 | ) -------------------------------------------------------------------------------- /inst/extdata/data.txt: -------------------------------------------------------------------------------- 1 | Some test data -------------------------------------------------------------------------------- /man/create_data_package_archive.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/create_data_package_archive.R 3 | \name{create_data_package_archive} 4 | \alias{create_data_package_archive} 5 | \title{Create data package archive (zip)} 6 | \usage{ 7 | create_data_package_archive(packageId, env = "production") 8 | } 9 | \arguments{ 10 | \item{packageId}{(character) Data package identifier} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | transaction (character) Transaction identifier. 17 | } 18 | \description{ 19 | This function is DEPRECATED. 20 | } 21 | \seealso{ 22 | Other Miscellaneous: 23 | \code{\link{create_dn}()}, 24 | \code{\link{is_authorized}()} 25 | } 26 | \concept{Miscellaneous} 27 | -------------------------------------------------------------------------------- /man/create_dn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/create_dn.R 3 | \name{create_dn} 4 | \alias{create_dn} 5 | \title{Create a users distinguished name} 6 | \usage{ 7 | create_dn(userId, ou = "EDI") 8 | } 9 | \arguments{ 10 | \item{userId}{(character) User identifier of an EDI data repository account} 11 | 12 | \item{ou}{(character) Organizational unit in which \code{userId} belongs. 13 | Can be "EDI" or "LTER". All \code{userId} issued after "2020-05-01" have 14 | \code{ou = "EDI"}.} 15 | } 16 | \value{ 17 | (character) Distinguished name 18 | } 19 | \description{ 20 | Create a users distinguished name 21 | } 22 | \examples{ 23 | # For an EDI account 24 | dn <- create_dn(userId = "my_userid", ou = "EDI") 25 | dn 26 | 27 | # For an LTER account 28 | dn <- create_dn(userId = "my_userid", ou = "LTER") 29 | dn 30 | } 31 | \seealso{ 32 | Other Miscellaneous: 33 | \code{\link{create_data_package_archive}()}, 34 | \code{\link{is_authorized}()} 35 | } 36 | \concept{Miscellaneous} 37 | -------------------------------------------------------------------------------- /man/create_reservation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/create_reservation.R 3 | \name{create_reservation} 4 | \alias{create_reservation} 5 | \title{Create reservation} 6 | \usage{ 7 | create_reservation(scope, env = "production") 8 | } 9 | \arguments{ 10 | \item{scope}{(character) Scope of data package} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (numeric) Identifier of reserved data package 17 | } 18 | \description{ 19 | Reserves the next available identifier for the specified scope 20 | } 21 | \note{ 22 | User authentication is required (see \code{login()}) 23 | } 24 | \examples{ 25 | \dontrun{ 26 | 27 | login() 28 | 29 | # Create reservation 30 | identifier <- create_reservation(scope = "edi", env = "staging") 31 | identifier 32 | #> [1] 604 33 | 34 | # Delete reservation 35 | delete_reservation(scope = "edi", identifier = identifier, env = "staging") 36 | #> [1] 604 37 | 38 | logout() 39 | } 40 | 41 | } 42 | \seealso{ 43 | Other Identifier Reservations: 44 | \code{\link{delete_reservation}()}, 45 | \code{\link{list_active_reservations}()}, 46 | \code{\link{list_reservation_identifiers}()} 47 | } 48 | \concept{Identifier Reservations} 49 | -------------------------------------------------------------------------------- /man/delete_journal_citation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/delete_journal_citation.R 3 | \name{delete_journal_citation} 4 | \alias{delete_journal_citation} 5 | \title{Delete journal citation} 6 | \usage{ 7 | delete_journal_citation(journalCitationId, env = "production") 8 | } 9 | \arguments{ 10 | \item{journalCitationId}{(numeric) Journal citation identifier} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (logical) TRUE if deleted 17 | } 18 | \description{ 19 | Delete journal citation 20 | } 21 | \note{ 22 | User authentication is required (see \code{login()}) 23 | } 24 | \examples{ 25 | \dontrun{ 26 | 27 | login() 28 | 29 | # Create journal citation 30 | journalCitationId <- create_journal_citation( 31 | packageId = "edi.17.1", 32 | articleDoi = "https://doi.org/10.1890/11-1026.1", 33 | articleTitle = "Corridors promote fire via connectivity and edge effects", 34 | journalTitle = "Ecological Applications", 35 | relationType = "IsCitedBy", 36 | env = "staging" 37 | ) 38 | journalCitationId 39 | #> [1] 74 40 | 41 | # Delete journal citation 42 | delete_journal_citation(journalCitationId, env = "staging") 43 | #> [1] TRUE 44 | 45 | logout() 46 | } 47 | 48 | } 49 | \seealso{ 50 | Other Journal Citations: 51 | \code{\link{create_journal_citation}()}, 52 | \code{\link{get_journal_citation}()}, 53 | \code{\link{list_data_package_citations}()}, 54 | \code{\link{list_principal_owner_citations}()} 55 | } 56 | \concept{Journal Citations} 57 | -------------------------------------------------------------------------------- /man/delete_reservation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/delete_reservation.R 3 | \name{delete_reservation} 4 | \alias{delete_reservation} 5 | \title{Delete reservation} 6 | \usage{ 7 | delete_reservation(scope, identifier, env = "production") 8 | } 9 | \arguments{ 10 | \item{scope}{(character) Scope of data package} 11 | 12 | \item{identifier}{(numeric) Identifier of data package} 13 | 14 | \item{env}{(character) Repository environment. Can be: "production", 15 | "staging", or "development".} 16 | } 17 | \value{ 18 | (numeric) The deleted reservation identifier value 19 | } 20 | \description{ 21 | Delete reservation 22 | } 23 | \note{ 24 | User authentication is required (see \code{login()}). The same user 25 | who originally authenticated to create the reservation must authenticate to 26 | delete it. 27 | } 28 | \examples{ 29 | \dontrun{ 30 | 31 | login() 32 | 33 | # Create reservation 34 | identifier <- create_reservation(scope = "edi", env = "staging") 35 | identifier 36 | #> [1] 604 37 | 38 | # Delete reservation 39 | delete_reservation(scope = "edi", identifier = identifier, env = "staging") 40 | #> [1] 604 41 | 42 | logout() 43 | } 44 | 45 | } 46 | \seealso{ 47 | Other Identifier Reservations: 48 | \code{\link{create_reservation}()}, 49 | \code{\link{list_active_reservations}()}, 50 | \code{\link{list_reservation_identifiers}()} 51 | } 52 | \concept{Identifier Reservations} 53 | -------------------------------------------------------------------------------- /man/get_audit_record.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_audit_record.R 3 | \name{get_audit_record} 4 | \alias{get_audit_record} 5 | \title{Get audit record} 6 | \usage{ 7 | get_audit_record(oid, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{oid}{(numeric) Audit identifier} 11 | 12 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 13 | or "xml".} 14 | 15 | \item{env}{(character) Repository environment. Can be: "production", 16 | "staging", or "development".} 17 | } 18 | \value{ 19 | (data.frame or xml_document) An audit record 20 | } 21 | \description{ 22 | Get audit record 23 | } 24 | \note{ 25 | User authentication is required (see \code{login()}) 26 | } 27 | \examples{ 28 | \dontrun{ 29 | 30 | login() 31 | 32 | # Get audit report 33 | auditReport <- get_audit_record(oid = "121606334") 34 | 35 | logout() 36 | } 37 | 38 | } 39 | \seealso{ 40 | Other Audit Manager Services: 41 | \code{\link{get_audit_count}()}, 42 | \code{\link{get_audit_report}()}, 43 | \code{\link{get_docid_reads}()}, 44 | \code{\link{get_packageid_reads}()}, 45 | \code{\link{get_recent_uploads}()} 46 | } 47 | \concept{Audit Manager Services} 48 | -------------------------------------------------------------------------------- /man/get_docid_reads.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_docid_reads.R 3 | \name{get_docid_reads} 4 | \alias{get_docid_reads} 5 | \title{Get doc ID reads} 6 | \usage{ 7 | get_docid_reads(scope, identifier, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{scope}{(character) Scope of data package} 11 | 12 | \item{identifier}{(numeric) Identifier of data package} 13 | 14 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 15 | or "xml".} 16 | 17 | \item{env}{(character) Repository environment. Can be: "production", 18 | "staging", or "development".} 19 | } 20 | \value{ 21 | (data.frame or xml_document) Summary of all the successful reads 22 | (total reads and non-robot reads) for all the resources of a given 23 | \code{scope} and \code{identifier}. 24 | } 25 | \description{ 26 | Get doc ID reads 27 | } 28 | \examples{ 29 | \dontrun{ 30 | 31 | # Get all reads 32 | resourceReads <- get_docid_reads(scope = "knb-lter-sgs", identifier = 817) 33 | } 34 | } 35 | \seealso{ 36 | Other Audit Manager Services: 37 | \code{\link{get_audit_count}()}, 38 | \code{\link{get_audit_record}()}, 39 | \code{\link{get_audit_report}()}, 40 | \code{\link{get_packageid_reads}()}, 41 | \code{\link{get_recent_uploads}()} 42 | } 43 | \concept{Audit Manager Services} 44 | -------------------------------------------------------------------------------- /man/get_event_subscription.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_event_subscription.R 3 | \name{get_event_subscription} 4 | \alias{get_event_subscription} 5 | \title{Get event subscription} 6 | \usage{ 7 | get_event_subscription(subscriptionId, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{subscriptionId}{(numeric) Event subscription identifier} 11 | 12 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 13 | or "xml".} 14 | 15 | \item{env}{(character) Repository environment. Can be: "production", 16 | "staging", or "development".} 17 | } 18 | \value{ 19 | (data.frame or xml_document) Subscription metadata 20 | } 21 | \description{ 22 | Get event subscription 23 | } 24 | \note{ 25 | User authentication is required (see \code{login()}) 26 | } 27 | \examples{ 28 | \dontrun{ 29 | 30 | login() 31 | 32 | # Get subscription 33 | subscription <- get_event_subscription( 34 | subscriptionId = 21, 35 | env = "staging" 36 | ) 37 | 38 | logout() 39 | } 40 | 41 | } 42 | \seealso{ 43 | Other Event Notifications: 44 | \code{\link{create_event_subscription}()}, 45 | \code{\link{delete_event_subscription}()}, 46 | \code{\link{execute_event_subscription}()}, 47 | \code{\link{get_event_subscription_schema}()}, 48 | \code{\link{query_event_subscriptions}()} 49 | } 50 | \concept{Event Notifications} 51 | -------------------------------------------------------------------------------- /man/get_event_subscription_schema.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_event_subscription_schema.R 3 | \name{get_event_subscription_schema} 4 | \alias{get_event_subscription_schema} 5 | \title{Get event subscription schema} 6 | \usage{ 7 | get_event_subscription_schema(env = "production") 8 | } 9 | \arguments{ 10 | \item{env}{(character) Repository environment. Can be: "production", 11 | "staging", or "development".} 12 | } 13 | \value{ 14 | (xml_document) Schema for event subscription creation request 15 | entities. 16 | 17 | See the 18 | \href{https://CRAN.R-project.org/package=xml2}{xml2} library 19 | for more on working with XML. 20 | } 21 | \description{ 22 | Get event subscription schema 23 | } 24 | \examples{ 25 | \dontrun{ 26 | 27 | # Get schema 28 | schema <- get_event_subscription_schema() 29 | schema 30 | #> {xml_document} 31 | #> <schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 32 | #> [1] <xs:element name="subscription">\n <xs:complexType>\n <xs: ... 33 | 34 | # Show schema structure 35 | xml2::xml_structure(schema) 36 | #> <schema [xmlns:xs]> 37 | #> <element [name]> 38 | #> <complexType> 39 | #> <all> 40 | #> <element [name, type, minOccurs, maxOccurs]> 41 | #> <element [name, type, minOccurs, maxOccurs]> 42 | #> <attribute [name, type, use, fixed]> 43 | } 44 | } 45 | \seealso{ 46 | Other Event Notifications: 47 | \code{\link{create_event_subscription}()}, 48 | \code{\link{delete_event_subscription}()}, 49 | \code{\link{execute_event_subscription}()}, 50 | \code{\link{get_event_subscription}()}, 51 | \code{\link{query_event_subscriptions}()} 52 | } 53 | \concept{Event Notifications} 54 | -------------------------------------------------------------------------------- /man/get_journal_citation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_journal_citation.R 3 | \name{get_journal_citation} 4 | \alias{get_journal_citation} 5 | \title{Get journal citation} 6 | \usage{ 7 | get_journal_citation(journalCitationId, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{journalCitationId}{(numeric) Journal citation identifier} 11 | 12 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 13 | or "xml".} 14 | 15 | \item{env}{(character) Repository environment. Can be: "production", 16 | "staging", or "development".} 17 | } 18 | \value{ 19 | (data.frame or xml_document) Journal citation 20 | } 21 | \description{ 22 | Get journal citation 23 | } 24 | \examples{ 25 | \dontrun{ 26 | 27 | # Get citation 28 | journalCitation <- get_journal_citation(381) 29 | } 30 | } 31 | \seealso{ 32 | Other Journal Citations: 33 | \code{\link{create_journal_citation}()}, 34 | \code{\link{delete_journal_citation}()}, 35 | \code{\link{list_data_package_citations}()}, 36 | \code{\link{list_principal_owner_citations}()} 37 | } 38 | \concept{Journal Citations} 39 | -------------------------------------------------------------------------------- /man/get_packageid_reads.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_packageid_reads.R 3 | \name{get_packageid_reads} 4 | \alias{get_packageid_reads} 5 | \title{Get package ID reads} 6 | \usage{ 7 | get_packageid_reads(packageId, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{packageId}{(character) Data package identifier} 11 | 12 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 13 | or "xml".} 14 | 15 | \item{env}{(character) Repository environment. Can be: "production", 16 | "staging", or "development".} 17 | } 18 | \value{ 19 | (data.frame or xml_document) Summary of all the successful reads 20 | (total reads and non-robot reads) of \code{packageId} 21 | } 22 | \description{ 23 | Get package ID reads 24 | } 25 | \examples{ 26 | \dontrun{ 27 | 28 | # Get packageId reads 29 | resourceReads <- get_packageid_reads("knb-lter-sgs.817.17") 30 | } 31 | } 32 | \seealso{ 33 | Other Audit Manager Services: 34 | \code{\link{get_audit_count}()}, 35 | \code{\link{get_audit_record}()}, 36 | \code{\link{get_audit_report}()}, 37 | \code{\link{get_docid_reads}()}, 38 | \code{\link{get_recent_uploads}()} 39 | } 40 | \concept{Audit Manager Services} 41 | -------------------------------------------------------------------------------- /man/get_provenance_metadata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_provenance_metadata.R 3 | \name{get_provenance_metadata} 4 | \alias{get_provenance_metadata} 5 | \title{Get provenance metadata} 6 | \usage{ 7 | get_provenance_metadata(packageId, env = "production") 8 | } 9 | \arguments{ 10 | \item{packageId}{(character) Data package identifier} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (xml_document) Provenance metadata of \code{packageId}, representing 17 | a <methodStep> element that can be inserted into the <methods> section of a 18 | dependent data package. 19 | 20 | See the 21 | \href{https://CRAN.R-project.org/package=emld}{emld} library 22 | for more on working with EML as a list or JSON-LD. See the 23 | \href{https://CRAN.R-project.org/package=xml2}{xml2} library 24 | for working with EML as XML. 25 | } 26 | \description{ 27 | Generates the provenance metadata of a source data package 28 | } 29 | \examples{ 30 | \dontrun{ 31 | 32 | methodStep <- get_provenance_metadata("knb-lter-pal.309.1") 33 | methodStep 34 | #> {xml_document} 35 | #> <methodStep> 36 | #> [1] <description>\n <para>This method step describes provenance-based ... 37 | #> [2] <dataSource>\n <title>Stable isotope composition (d18O) of seawat ... 38 | } 39 | } 40 | \concept{Provenance} 41 | -------------------------------------------------------------------------------- /man/is_authorized.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/is_authorized.R 3 | \name{is_authorized} 4 | \alias{is_authorized} 5 | \title{Is authorized to read} 6 | \usage{ 7 | is_authorized(resourceId, env = "production") 8 | } 9 | \arguments{ 10 | \item{resourceId}{(character) Resource identifier} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (logical) TRUE if the authenticated user has permission to read the 17 | specified resource 18 | } 19 | \description{ 20 | Is authorized to read 21 | } 22 | \note{ 23 | User authentication is required (see \code{login()}) 24 | } 25 | \examples{ 26 | \dontrun{ 27 | 28 | login() 29 | 30 | # Get the most recently created data package 31 | auditReport <- get_recent_uploads( 32 | query = "serviceMethod=createDataPackage&limit=1" 33 | ) 34 | 35 | # Get the resourceId 36 | resourceId <- xml2::xml_text( 37 | xml2::xml_find_all(auditReport, ".//resourceId") 38 | ) 39 | resourceId 40 | #> [1] "https://pasta.lternet.edu/package/eml/knb-lter-hbr/345/1" 41 | 42 | # Check read authorization 43 | is_authorized(resourceId) 44 | #> [1] TRUE 45 | 46 | logout() 47 | } 48 | 49 | } 50 | \seealso{ 51 | Other Miscellaneous: 52 | \code{\link{create_data_package_archive}()}, 53 | \code{\link{create_dn}()} 54 | } 55 | \concept{Miscellaneous} 56 | -------------------------------------------------------------------------------- /man/list_active_reservations.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_active_reservations.R 3 | \name{list_active_reservations} 4 | \alias{list_active_reservations} 5 | \title{List active reservations} 6 | \usage{ 7 | list_active_reservations(as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 11 | or "xml".} 12 | 13 | \item{env}{(character) Repository environment. Can be: "production", 14 | "staging", or "development".} 15 | } 16 | \value{ 17 | (data.frame or xml_document) The set of data package identifiers 18 | that users have actively reserved. Note that data package identifiers that 19 | have been successfully uploaded are no longer considered active reservations 20 | and thus are not included in this list. 21 | } 22 | \description{ 23 | List active reservations 24 | } 25 | \examples{ 26 | \dontrun{ 27 | 28 | # List reservations 29 | reservations <- list_active_reservations() 30 | } 31 | } 32 | \seealso{ 33 | Other Identifier Reservations: 34 | \code{\link{create_reservation}()}, 35 | \code{\link{delete_reservation}()}, 36 | \code{\link{list_reservation_identifiers}()} 37 | } 38 | \concept{Identifier Reservations} 39 | -------------------------------------------------------------------------------- /man/list_data_descendants.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_data_descendants.R 3 | \name{list_data_descendants} 4 | \alias{list_data_descendants} 5 | \title{List data descendants} 6 | \usage{ 7 | list_data_descendants(packageId, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{packageId}{(character) Data package identifier} 11 | 12 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 13 | or "xml".} 14 | 15 | \item{env}{(character) Repository environment. Can be: "production", 16 | "staging", or "development".} 17 | } 18 | \value{ 19 | (data.frame or xml_document) Descendants of \code{packageId} 20 | } 21 | \description{ 22 | Data descendants are data packages that are known to be 23 | derived, in whole or in part, from the specified source data package. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | 28 | # List descendants 29 | dataDescendants <- list_data_descendants("knb-lter-bnz.501.17") 30 | } 31 | } 32 | \seealso{ 33 | Other Listing: 34 | \code{\link{list_data_entities}()}, 35 | \code{\link{list_data_package_identifiers}()}, 36 | \code{\link{list_data_package_revisions}()}, 37 | \code{\link{list_data_package_scopes}()}, 38 | \code{\link{list_data_sources}()}, 39 | \code{\link{list_deleted_data_packages}()}, 40 | \code{\link{list_recent_changes}()}, 41 | \code{\link{list_recent_uploads}()}, 42 | \code{\link{list_service_methods}()}, 43 | \code{\link{list_user_data_packages}()} 44 | } 45 | \concept{Listing} 46 | -------------------------------------------------------------------------------- /man/list_data_entities.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_data_entities.R 3 | \name{list_data_entities} 4 | \alias{list_data_entities} 5 | \title{List data entities} 6 | \usage{ 7 | list_data_entities(packageId, env = "production") 8 | } 9 | \arguments{ 10 | \item{packageId}{(character) Data package identifier} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (character) Identifiers for all data entities in \code{packageId} 17 | } 18 | \description{ 19 | List data entities 20 | } 21 | \examples{ 22 | \dontrun{ 23 | 24 | entityIds <- list_data_entities("knb-lter-and.2732.7") 25 | entityIds 26 | #> [1] "0464a1d9262fc6e609cb0b24adb7e5ba" 27 | #> [2] "cc3ade83d3655edd2ca674721a52ef46" 28 | } 29 | } 30 | \seealso{ 31 | Other Listing: 32 | \code{\link{list_data_descendants}()}, 33 | \code{\link{list_data_package_identifiers}()}, 34 | \code{\link{list_data_package_revisions}()}, 35 | \code{\link{list_data_package_scopes}()}, 36 | \code{\link{list_data_sources}()}, 37 | \code{\link{list_deleted_data_packages}()}, 38 | \code{\link{list_recent_changes}()}, 39 | \code{\link{list_recent_uploads}()}, 40 | \code{\link{list_service_methods}()}, 41 | \code{\link{list_user_data_packages}()} 42 | } 43 | \concept{Listing} 44 | -------------------------------------------------------------------------------- /man/list_data_package_citations.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_data_package_citations.R 3 | \name{list_data_package_citations} 4 | \alias{list_data_package_citations} 5 | \title{List data package citations} 6 | \usage{ 7 | list_data_package_citations( 8 | packageId, 9 | as = "data.frame", 10 | list_all = FALSE, 11 | env = "production" 12 | ) 13 | } 14 | \arguments{ 15 | \item{packageId}{(character) Data package identifier} 16 | 17 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 18 | or "xml".} 19 | 20 | \item{list_all}{(logical) Return all citations within a data package series?} 21 | 22 | \item{env}{(character) Repository environment. Can be: "production", 23 | "staging", or "development".} 24 | } 25 | \value{ 26 | (data.frame or xml_document) A list of journal citations 27 | } 28 | \description{ 29 | List data package citations 30 | } 31 | \examples{ 32 | \dontrun{ 33 | 34 | # List citations 35 | journalCitations <- list_data_package_citations("edi.845.1") 36 | } 37 | } 38 | \seealso{ 39 | Other Journal Citations: 40 | \code{\link{create_journal_citation}()}, 41 | \code{\link{delete_journal_citation}()}, 42 | \code{\link{get_journal_citation}()}, 43 | \code{\link{list_principal_owner_citations}()} 44 | } 45 | \concept{Journal Citations} 46 | -------------------------------------------------------------------------------- /man/list_data_package_identifiers.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_data_package_identifiers.R 3 | \name{list_data_package_identifiers} 4 | \alias{list_data_package_identifiers} 5 | \title{List data package identifiers} 6 | \usage{ 7 | list_data_package_identifiers(scope, env = "production") 8 | } 9 | \arguments{ 10 | \item{scope}{(character) Scope of data package} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (numeric) Identifiers of data packages within a specified 17 | \code{scope} 18 | } 19 | \description{ 20 | List data package identifiers 21 | } 22 | \examples{ 23 | \dontrun{ 24 | 25 | # List identifiers 26 | identifiers <- list_data_package_identifiers("knb-lter-ble") 27 | identifiers 28 | #> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 23 29 | } 30 | } 31 | \seealso{ 32 | Other Listing: 33 | \code{\link{list_data_descendants}()}, 34 | \code{\link{list_data_entities}()}, 35 | \code{\link{list_data_package_revisions}()}, 36 | \code{\link{list_data_package_scopes}()}, 37 | \code{\link{list_data_sources}()}, 38 | \code{\link{list_deleted_data_packages}()}, 39 | \code{\link{list_recent_changes}()}, 40 | \code{\link{list_recent_uploads}()}, 41 | \code{\link{list_service_methods}()}, 42 | \code{\link{list_user_data_packages}()} 43 | } 44 | \concept{Listing} 45 | -------------------------------------------------------------------------------- /man/list_data_package_revisions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_data_package_revisions.R 3 | \name{list_data_package_revisions} 4 | \alias{list_data_package_revisions} 5 | \title{List data package revisions} 6 | \usage{ 7 | list_data_package_revisions( 8 | scope, 9 | identifier, 10 | filter = NULL, 11 | env = "production" 12 | ) 13 | } 14 | \arguments{ 15 | \item{scope}{(character) Scope of data package} 16 | 17 | \item{identifier}{(numeric) Identifier of data package} 18 | 19 | \item{filter}{(character) Filter results by "newest" or "oldest"} 20 | 21 | \item{env}{(character) Repository environment. Can be: "production", 22 | "staging", or "development".} 23 | } 24 | \value{ 25 | (numeric) Revisions of a data package within a specified 26 | \code{scope} and \code{identifier} 27 | } 28 | \description{ 29 | List data package revisions 30 | } 31 | \examples{ 32 | \dontrun{ 33 | 34 | # List revisions 35 | revisions <- list_data_package_revisions("knb-lter-arc", 20131) 36 | revisions 37 | #> [1] 1 2 38 | } 39 | } 40 | \seealso{ 41 | Other Listing: 42 | \code{\link{list_data_descendants}()}, 43 | \code{\link{list_data_entities}()}, 44 | \code{\link{list_data_package_identifiers}()}, 45 | \code{\link{list_data_package_scopes}()}, 46 | \code{\link{list_data_sources}()}, 47 | \code{\link{list_deleted_data_packages}()}, 48 | \code{\link{list_recent_changes}()}, 49 | \code{\link{list_recent_uploads}()}, 50 | \code{\link{list_service_methods}()}, 51 | \code{\link{list_user_data_packages}()} 52 | } 53 | \concept{Listing} 54 | -------------------------------------------------------------------------------- /man/list_deleted_data_packages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_deleted_data_packages.R 3 | \name{list_deleted_data_packages} 4 | \alias{list_deleted_data_packages} 5 | \title{List deleted data packages} 6 | \usage{ 7 | list_deleted_data_packages(env = "production") 8 | } 9 | \arguments{ 10 | \item{env}{(character) Repository environment. Can be: "production", 11 | "staging", or "development".} 12 | } 13 | \value{ 14 | (character) All data packages (excluding revision values) that have 15 | been deleted from the data package registry. 16 | } 17 | \description{ 18 | List deleted data packages 19 | } 20 | \examples{ 21 | \dontrun{ 22 | 23 | # List deleted data packages 24 | deleted <- list_deleted_data_packages() 25 | head(deleted) 26 | #> [1] "edi.10" "edi.222" "edi.419" "edi.511" "edi.857" "edi.878" 27 | } 28 | } 29 | \seealso{ 30 | Other Listing: 31 | \code{\link{list_data_descendants}()}, 32 | \code{\link{list_data_entities}()}, 33 | \code{\link{list_data_package_identifiers}()}, 34 | \code{\link{list_data_package_revisions}()}, 35 | \code{\link{list_data_package_scopes}()}, 36 | \code{\link{list_data_sources}()}, 37 | \code{\link{list_recent_changes}()}, 38 | \code{\link{list_recent_uploads}()}, 39 | \code{\link{list_service_methods}()}, 40 | \code{\link{list_user_data_packages}()} 41 | } 42 | \concept{Listing} 43 | -------------------------------------------------------------------------------- /man/list_principal_owner_citations.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_principal_owner_citations.R 3 | \name{list_principal_owner_citations} 4 | \alias{list_principal_owner_citations} 5 | \title{List principal owner citations} 6 | \usage{ 7 | list_principal_owner_citations( 8 | principalOwner, 9 | as = "data.frame", 10 | env = "production" 11 | ) 12 | } 13 | \arguments{ 14 | \item{principalOwner}{(character) Principal owner in the format returned by 15 | \code{create_dn()}} 16 | 17 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 18 | or "xml".} 19 | 20 | \item{env}{(character) Repository environment. Can be: "production", 21 | "staging", or "development".} 22 | } 23 | \value{ 24 | (data.frame or xml_document) Journal citations metadata for all 25 | entries owned by the specified principal owner 26 | } 27 | \description{ 28 | List principal owner citations 29 | } 30 | \examples{ 31 | \dontrun{ 32 | 33 | # List citations 34 | dn <- create_dn(userId = "FCE", ou = "EDI") 35 | journalCitations <- list_principal_owner_citations(principalOwner = dn) 36 | } 37 | } 38 | \seealso{ 39 | Other Journal Citations: 40 | \code{\link{create_journal_citation}()}, 41 | \code{\link{delete_journal_citation}()}, 42 | \code{\link{get_journal_citation}()}, 43 | \code{\link{list_data_package_citations}()} 44 | } 45 | \concept{Journal Citations} 46 | -------------------------------------------------------------------------------- /man/list_recent_uploads.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_recent_uploads.R 3 | \name{list_recent_uploads} 4 | \alias{list_recent_uploads} 5 | \title{List recent uploads} 6 | \usage{ 7 | list_recent_uploads(type, limit = 5, as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{type}{(character) Upload type. Can be: "insert" or "update".} 11 | 12 | \item{limit}{(numeric) Maximum number of results to return} 13 | 14 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 15 | or "xml".} 16 | 17 | \item{env}{(character) Repository environment. Can be: "production", 18 | "staging", or "development".} 19 | } 20 | \value{ 21 | (data.frame or xml_document) Data package uploads 22 | } 23 | \description{ 24 | List recent uploads 25 | } 26 | \examples{ 27 | \dontrun{ 28 | 29 | # Get the 3 newest revisions 30 | dataPackageUploads <- list_recent_uploads("update", 3) 31 | } 32 | } 33 | \seealso{ 34 | Other Listing: 35 | \code{\link{list_data_descendants}()}, 36 | \code{\link{list_data_entities}()}, 37 | \code{\link{list_data_package_identifiers}()}, 38 | \code{\link{list_data_package_revisions}()}, 39 | \code{\link{list_data_package_scopes}()}, 40 | \code{\link{list_data_sources}()}, 41 | \code{\link{list_deleted_data_packages}()}, 42 | \code{\link{list_recent_changes}()}, 43 | \code{\link{list_service_methods}()}, 44 | \code{\link{list_user_data_packages}()} 45 | } 46 | \concept{Listing} 47 | -------------------------------------------------------------------------------- /man/list_reservation_identifiers.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_reservation_identifiers.R 3 | \name{list_reservation_identifiers} 4 | \alias{list_reservation_identifiers} 5 | \title{List reservation identifiers} 6 | \usage{ 7 | list_reservation_identifiers(scope, env = "production") 8 | } 9 | \arguments{ 10 | \item{scope}{(character) Scope of data package} 11 | 12 | \item{env}{(character) Repository environment. Can be: "production", 13 | "staging", or "development".} 14 | } 15 | \value{ 16 | (numeric) The set of identifiers for the specified \code{scope} that 17 | end users have actively reserved for future upload 18 | } 19 | \description{ 20 | List reservation identifiers 21 | } 22 | \examples{ 23 | \dontrun{ 24 | 25 | # List reservations 26 | reservations <- list_reservation_identifiers(scope = "edi") 27 | reservations 28 | #> [1] 11 130 131 132 142 152 154 156 158 159 161 162 171 29 | #> [14] 172 173 174 175 177 178 180 182 183 185 196 203 ... 30 | } 31 | } 32 | \seealso{ 33 | Other Identifier Reservations: 34 | \code{\link{create_reservation}()}, 35 | \code{\link{delete_reservation}()}, 36 | \code{\link{list_active_reservations}()} 37 | } 38 | \concept{Identifier Reservations} 39 | -------------------------------------------------------------------------------- /man/list_user_data_packages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_user_data_packages.R 3 | \name{list_user_data_packages} 4 | \alias{list_user_data_packages} 5 | \title{List user data packages} 6 | \usage{ 7 | list_user_data_packages(dn, env = "production") 8 | } 9 | \arguments{ 10 | \item{dn}{(character) Distinguished name of user. Create with 11 | \code{create_dn()}.} 12 | 13 | \item{env}{(character) Repository environment. Can be: "production", 14 | "staging", or "development".} 15 | } 16 | \value{ 17 | (character) Data package identifiers belonging to a \code{dn} 18 | } 19 | \description{ 20 | List all data packages (including their revision values) 21 | uploaded to the repository by a particular user, specified by a 22 | distinguished name. Data packages that were uploaded by the specified user 23 | but have since been deleted are excluded from the list. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | 28 | # List user data packages 29 | dn <- create_dn(userId = "dbjourneynorth") 30 | packageIds <- list_user_data_packages(dn) 31 | packageIds 32 | #> [1] "edi.948.1" "edi.949.1" 33 | } 34 | } 35 | \seealso{ 36 | Other Listing: 37 | \code{\link{list_data_descendants}()}, 38 | \code{\link{list_data_entities}()}, 39 | \code{\link{list_data_package_identifiers}()}, 40 | \code{\link{list_data_package_revisions}()}, 41 | \code{\link{list_data_package_scopes}()}, 42 | \code{\link{list_data_sources}()}, 43 | \code{\link{list_deleted_data_packages}()}, 44 | \code{\link{list_recent_changes}()}, 45 | \code{\link{list_recent_uploads}()}, 46 | \code{\link{list_service_methods}()} 47 | } 48 | \concept{Listing} 49 | -------------------------------------------------------------------------------- /man/list_working_on.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_working_on.R 3 | \name{list_working_on} 4 | \alias{list_working_on} 5 | \title{List working on} 6 | \usage{ 7 | list_working_on(as = "data.frame", env = "production") 8 | } 9 | \arguments{ 10 | \item{as}{(character) Format of the returned object. Can be: "data.frame" 11 | or "xml".} 12 | 13 | \item{env}{(character) Repository environment. Can be: "production", 14 | "staging", or "development".} 15 | } 16 | \value{ 17 | (data.frame or xml_document) The set of data packages the EDI 18 | repository is currently working on inserting or updating. Note that data 19 | packages currently being evaluated by the EDI repository are not included in 20 | the list. 21 | } 22 | \description{ 23 | List working on 24 | } 25 | \examples{ 26 | \dontrun{ 27 | 28 | list_working_on() 29 | } 30 | } 31 | \concept{System Monitoring} 32 | -------------------------------------------------------------------------------- /man/logout.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/logout.R 3 | \name{logout} 4 | \alias{logout} 5 | \title{Logout of the EDI repository} 6 | \usage{ 7 | logout() 8 | } 9 | \value{ 10 | (NULL) No return value. 11 | } 12 | \description{ 13 | Logout of the EDI repository 14 | } 15 | \details{ 16 | Removes the temporary authentication token system variable 17 | "EDI_TOKEN". 18 | } 19 | \examples{ 20 | \dontrun{ 21 | logout() 22 | } 23 | 24 | } 25 | \seealso{ 26 | Other Authentication: 27 | \code{\link{login}()} 28 | } 29 | \concept{Authentication} 30 | -------------------------------------------------------------------------------- /tests/fixtures/create_data_package_archive.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: post 4 | uri: https://pasta.lternet.edu/package/archive/eml/knb-lter-sev/31999/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 202 14 | category: Success 15 | reason: Accepted 16 | message: 'Success: (202) Accepted' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Tue, 18 Jan 2022 04:17:04 GMT 20 | content-type: text/plain 21 | content-length: '47' 22 | connection: keep-alive 23 | web-service: DataPackageManager-1.0 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: archive_knb-lter-sev.31999.1_164247942484434343 28 | recorded_at: 2022-01-18 04:17:04 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/create_reservation.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: post 4 | uri: https://pasta-s.lternet.edu/package/reservations/eml/edi 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 201 14 | category: Success 15 | reason: Created 16 | message: 'Success: (201) Created' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Wed, 19 Jan 2022 18:43:56 GMT 20 | content-type: application/json 21 | content-length: '3' 22 | connection: keep-alive 23 | web-service: DataPackageManager-1.0 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: '731' 28 | recorded_at: 2022-01-19 18:43:56 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/create_reservation_delete_reservation.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: delete 4 | uri: https://pasta-s.lternet.edu/package/reservations/eml/edi/731 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 200 14 | category: Success 15 | reason: OK 16 | message: 'Success: (200) OK' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Wed, 19 Jan 2022 18:43:56 GMT 20 | content-type: application/json 21 | content-length: '3' 22 | connection: keep-alive 23 | web-service: DataPackageManager-1.0 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: '731' 28 | recorded_at: 2022-01-19 18:43:56 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/delete_event_subscription.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: delete 4 | uri: https://pasta-s.lternet.edu/package/event/eml/270 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 200 14 | category: Success 15 | reason: OK 16 | message: 'Success: (200) OK' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Tue, 18 Jan 2022 02:41:36 GMT 20 | content-length: '0' 21 | connection: keep-alive 22 | body: 23 | encoding: UTF-8 24 | file: no 25 | string: '' 26 | recorded_at: 2022-01-18 02:41:36 GMT 27 | recorded_with: vcr/1.0.2, webmockr/0.8.0 28 | -------------------------------------------------------------------------------- /tests/fixtures/delete_journal_citation.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: delete 4 | uri: https://pasta-s.lternet.edu/package/citation/eml/183 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 200 14 | category: Success 15 | reason: OK 16 | message: 'Success: (200) OK' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Tue, 18 Jan 2022 03:32:59 GMT 20 | content-length: '0' 21 | connection: keep-alive 22 | body: 23 | encoding: UTF-8 24 | file: no 25 | string: '' 26 | recorded_at: 2022-01-18 03:32:59 GMT 27 | recorded_with: vcr/1.0.2, webmockr/0.8.0 28 | -------------------------------------------------------------------------------- /tests/fixtures/delete_reservation.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: delete 4 | uri: https://pasta-s.lternet.edu/package/reservations/eml/edi/721 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 200 14 | category: Success 15 | reason: OK 16 | message: 'Success: (200) OK' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Tue, 18 Jan 2022 04:06:03 GMT 20 | content-type: application/json 21 | content-length: '3' 22 | connection: keep-alive 23 | web-service: DataPackageManager-1.0 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: '721' 28 | recorded_at: 2022-01-18 04:06:03 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/execute_event_subscription.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: post 4 | uri: https://pasta-s.lternet.edu/package/event/eml/270 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | Content-Type: '' 11 | response: 12 | status: 13 | status_code: 200 14 | category: Success 15 | reason: OK 16 | message: 'Success: (200) OK' 17 | headers: 18 | server: nginx/1.14.0 (Ubuntu) 19 | date: Tue, 18 Jan 2022 02:35:52 GMT 20 | content-length: '0' 21 | connection: keep-alive 22 | body: 23 | encoding: UTF-8 24 | file: no 25 | string: '' 26 | recorded_at: 2022-01-18 02:35:52 GMT 27 | recorded_with: vcr/1.0.2, webmockr/0.8.0 28 | -------------------------------------------------------------------------------- /tests/fixtures/get_audit_count.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/audit/count?category=warn&fromTime=2021-12-01&toTime=2021-12-05 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 04:23:02 GMT 19 | content-type: text/plain 20 | content-length: '5' 21 | connection: keep-alive 22 | cache-control: no-cache 23 | web-service: AuditManager-0.1 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: '10022' 28 | recorded_at: 2022-01-18 04:23:02 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/get_event_subscription.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/event/eml/272 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 05:55:55 GMT 19 | content-type: application/xml 20 | content-length: '239' 21 | connection: keep-alive 22 | body: 23 | encoding: UTF-8 24 | file: no 25 | string: | 26 | <subscriptions> 27 | <subscription type="eml"> 28 | <id>272</id> 29 | <creator>uid=ediutils,o=EDI,dc=edirepository,dc=org</creator> 30 | <packageId>edi.2.1</packageId> 31 | <url>https://some.server.94.org</url> 32 | </subscription> 33 | </subscriptions> 34 | recorded_at: 2022-01-18 05:55:56 GMT 35 | recorded_with: vcr/1.0.2, webmockr/0.8.0 36 | -------------------------------------------------------------------------------- /tests/fixtures/get_event_subscription_schema.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/event/eml/schema 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 16:00:07 GMT 19 | content-type: application/xml 20 | content-length: '505' 21 | connection: keep-alive 22 | body: 23 | encoding: UTF-8 24 | file: no 25 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n\n 26 | \ <xs:element name=\"subscription\">\n <xs:complexType>\n <xs:all>\n\n 27 | \ <xs:element name=\"packageId\" type=\"xs:string\" \n minOccurs=\"1\" 28 | maxOccurs=\"1\"/>\n\n <xs:element name=\"url\" type=\"xs:string\" minOccurs=\"1\" 29 | maxOccurs=\"1\"/>\n \n </xs:all>\n <xs:attribute name=\"type\" 30 | type=\"xs:string\" use=\"required\" fixed=\"eml\"/>\n </xs:complexType>\n 31 | \ </xs:element>\n</xs:schema>" 32 | recorded_at: 2022-01-18 16:00:08 GMT 33 | recorded_with: vcr/1.0.2, webmockr/0.8.0 34 | -------------------------------------------------------------------------------- /tests/fixtures/get_journal_citation.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/citation/eml/381 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 16:10:34 GMT 19 | content-type: application/xml 20 | content-length: '661' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | <?xml version="1.0" encoding="UTF-8"?> 28 | <journalCitation> 29 | <journalCitationId>381</journalCitationId> 30 | <packageId>edi.845.1</packageId> 31 | <principalOwner>uid=csmith,o=EDI,dc=edirepository,dc=org</principalOwner> 32 | <dateCreated>2021-05-27T13:23:14.981</dateCreated> 33 | <articleDoi>https://doi.org/10.1016/j.scitotenv.2021.148033</articleDoi> 34 | <articleTitle>Bioturbation frequency alters methane emissions from reservoir sediments</articleTitle> 35 | <articleUrl>https://doi.org/10.1016/j.scitotenv.2021.148033</articleUrl> 36 | <journalTitle>Science of the Total Environment</journalTitle> 37 | <relationType>IsCitedBy</relationType> 38 | </journalCitation> 39 | recorded_at: 2022-01-18 16:10:34 GMT 40 | recorded_with: vcr/1.0.2, webmockr/0.8.0 41 | -------------------------------------------------------------------------------- /tests/fixtures/is_authorized.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/authz?resourceId=https://pasta.lternet.edu/package/report/eml/knb-lter-sbc/6006/3 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 16:44:54 GMT 19 | content-type: text/plain 20 | content-length: '64' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: https://pasta.lternet.edu/package/report/eml/knb-lter-sbc/6006/3 27 | recorded_at: 2022-01-18 16:44:54 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/list_active_reservations.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/reservations/eml 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 16:51:27 GMT 19 | content-type: application/xml 20 | transfer-encoding: chunked 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | <reservations> 28 | <reservation> 29 | <docid>edi.106</docid> 30 | <principal>uid=user10,o=EDI,dc=edirepository,dc=org</principal> 31 | <dateReserved>2017-11-16 12:36:03.024</dateReserved> 32 | </reservation> 33 | </reservations> 34 | recorded_at: 2022-01-18 16:51:27 GMT 35 | recorded_with: vcr/1.0.2, webmockr/0.8.0 36 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_descendants.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/descendants/eml/knb-lter-bnz/501/17 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 16:55:14 GMT 19 | content-type: application/xml 20 | content-length: '3563' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | <?xml version="1.0" encoding="UTF-8"?> 28 | <dataDescendants> 29 | <dataDescendant> 30 | <packageId>edi.275.1</packageId> 31 | <title>&#xa; Eight Mile Lake Research Watershed&#x2c; Carbon in Permafrost Experimental Heating Research &#x28;CiPEHR&#x29;&#x3a; Aboveground plant biomass&#x2c; 2009&#x2d;2017&#x2e; &#x28;Reformatted to ecocomDP Design Pattern&#x29;&#xa; 32 | https://pasta.lternet.edu/package/metadata/eml/edi/275/1 33 | 34 | 35 | recorded_at: 2022-01-18 16:55:14 GMT 36 | recorded_with: vcr/1.0.2, webmockr/0.8.0 37 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_entities.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/data/eml/edi/993/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 21:29:59 GMT 19 | content-type: text/plain 20 | content-length: '32' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: ce801a7c5e1d54f894aa117005a5c283 27 | recorded_at: 2022-01-18 21:29:59 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_package_identifiers.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml/knb-lter-ble 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 17:02:55 GMT 19 | content-type: text/plain 20 | content-length: '50' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | 1 28 | 2 29 | 3 30 | 4 31 | 5 32 | 6 33 | 7 34 | 8 35 | 9 36 | 10 37 | 11 38 | 12 39 | 13 40 | 14 41 | 15 42 | 16 43 | 17 44 | 18 45 | 19 46 | 23 47 | recorded_at: 2022-01-18 17:02:55 GMT 48 | recorded_with: vcr/1.0.2, webmockr/0.8.0 49 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_package_revisions.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml/edi/275 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 18:47:21 GMT 19 | content-type: text/plain 20 | content-length: '11' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | 1 28 | 2 29 | 3 30 | 4 31 | 5 32 | 6 33 | recorded_at: 2022-01-18 18:47:21 GMT 34 | recorded_with: vcr/1.0.2, webmockr/0.8.0 35 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_package_revisions_newest.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml/edi/275?filter=newest 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 18:47:22 GMT 19 | content-type: text/plain 20 | content-length: '1' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: '6' 27 | recorded_at: 2022-01-18 18:47:22 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_package_revisions_oldest.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml/edi/275?filter=oldest 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 18:47:22 GMT 19 | content-type: text/plain 20 | content-length: '1' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: '1' 27 | recorded_at: 2022-01-18 18:47:22 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_package_scopes.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/eml 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 18:50:26 GMT 19 | content-type: text/plain 20 | content-length: '313' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | edi 28 | knb-lter-and 29 | knb-lter-arc 30 | knb-lter-vcr 31 | msb-paleon 32 | recorded_at: 2022-01-18 18:50:26 GMT 33 | recorded_with: vcr/1.0.2, webmockr/0.8.0 34 | -------------------------------------------------------------------------------- /tests/fixtures/list_data_sources.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/sources/eml/edi/275/4 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 19:12:08 GMT 19 | content-type: application/xml 20 | content-length: '537' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | 28 | 29 | 30 | knb-lter-bnz.501.17 31 | Eight Mile Lake Research Watershed&#x2c; Carbon in Permafrost Experimental Heating Research &#x28;CiPEHR&#x29;&#x3a; Aboveground plant biomass&#x2c; 2009&#x2d;2017&#x2e; 32 | https://pasta.lternet.edu/package/metadata/eml/knb-lter-bnz/501/17 33 | 34 | 35 | recorded_at: 2022-01-18 19:12:08 GMT 36 | recorded_with: vcr/1.0.2, webmockr/0.8.0 37 | -------------------------------------------------------------------------------- /tests/fixtures/list_deleted_data_packages.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml/deleted 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 19:27:17 GMT 19 | content-type: text/plain 20 | transfer-encoding: chunked 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | edi.10 28 | edi.222 29 | knb-lter-vcr.203 30 | recorded_at: 2022-01-18 19:27:17 GMT 31 | recorded_with: vcr/1.0.2, webmockr/0.8.0 32 | -------------------------------------------------------------------------------- /tests/fixtures/list_principal_owner_citations.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/citations/eml/uid=csmith,o=EDI,dc=edirepository,dc=org 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 19:55:15 GMT 19 | content-type: application/xml 20 | transfer-encoding: chunked 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: "\n\n\n 27 | \ 46\n edi.17.1\n 28 | \ uid=csmith,o=EDI,dc=edirepository,dc=org\n 29 | \ 2018-09-06T09:36:54.459\n https://doi.org/10.1890/11-1026.1\n 30 | \ Corridors promote fire via connectivity and edge effects\n 31 | \ https://esajournals.onlinelibrary.wiley.com/doi/abs/10.1890/11-1026.1\n 32 | \ Ecological Applications\n IsCitedBy\n\n" 33 | recorded_at: 2022-01-18 19:55:15 GMT 34 | recorded_with: vcr/1.0.2, webmockr/0.8.0 35 | -------------------------------------------------------------------------------- /tests/fixtures/list_recent_uploads.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/uploads/eml?type=update&limit=5 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 20:25:58 GMT 19 | content-type: application/xml 20 | content-length: '1753' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | 28 | 29 | knb-lter-hbr.106.3 30 | knb-lter-hbr 31 | 106 32 | 3 33 | uid=HBR,o=EDI,dc=edirepository,dc=org 34 | 35 | updateDataPackage 36 | 2022-01-17 12:49:00 37 | 38 | 39 | recorded_at: 2022-01-18 20:25:58 GMT 40 | recorded_with: vcr/1.0.2, webmockr/0.8.0 41 | -------------------------------------------------------------------------------- /tests/fixtures/list_reservation_identifiers.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/reservations/eml/edi 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 20:29:44 GMT 19 | content-type: text/plain 20 | content-length: '773' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | 11 28 | 130 29 | 1061 30 | recorded_at: 2022-01-18 20:29:44 GMT 31 | recorded_with: vcr/1.0.2, webmockr/0.8.0 32 | -------------------------------------------------------------------------------- /tests/fixtures/list_service_methods.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/service-methods 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 20:32:35 GMT 19 | content-type: text/plain 20 | content-length: '1310' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | appendProvenance 28 | createDataPackage 29 | recorded_at: 2022-01-18 20:32:36 GMT 30 | recorded_with: vcr/1.0.2, webmockr/0.8.0 31 | -------------------------------------------------------------------------------- /tests/fixtures/list_user_data_packages.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/user/uid=dbjourneynorth,o=EDI,dc=edirepository,dc=org 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 20:41:41 GMT 19 | content-type: text/plain 20 | content-length: '19' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: |- 27 | edi.948.1 28 | edi.949.1 29 | recorded_at: 2022-01-18 20:41:41 GMT 30 | recorded_with: vcr/1.0.2, webmockr/0.8.0 31 | -------------------------------------------------------------------------------- /tests/fixtures/list_working_on.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/workingon/eml 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 20:44:39 GMT 19 | content-type: application/xml 20 | content-length: '25' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | 28 | 29 | recorded_at: 2022-01-18 20:44:39 GMT 30 | recorded_with: vcr/1.0.2, webmockr/0.8.0 31 | -------------------------------------------------------------------------------- /tests/fixtures/login.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 401 13 | category: Client error 14 | reason: Unauthorized 15 | message: 'Client error: (401) Unauthorized' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 20:46:18 GMT 19 | transfer-encoding: chunked 20 | connection: keep-alive 21 | body: 22 | encoding: UTF-8 23 | file: no 24 | string: '' 25 | recorded_at: 2022-01-18 20:46:18 GMT 26 | recorded_with: vcr/1.0.2, webmockr/0.8.0 27 | -------------------------------------------------------------------------------- /tests/fixtures/query_event_subscriptions.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/event/eml?scope=edi 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:11:43 GMT 19 | content-type: application/xml 20 | content-length: '852' 21 | connection: keep-alive 22 | body: 23 | encoding: UTF-8 24 | file: no 25 | string: | 26 | 27 | 28 | 97 29 | uid=ediutils,o=EDI,dc=edirepository,dc=org 30 | edi.3.1 31 | https://some.server.org 32 | 33 | 34 | recorded_at: 2022-01-18 23:11:43 GMT 35 | recorded_with: vcr/1.0.2, webmockr/0.8.0 36 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_entity_checksum.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/data/checksum/eml/knb-lter-ble/1/7/a1723e0e5f3c4881f1a7ede1b036aba6 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 21:48:11 GMT 19 | content-type: text/plain 20 | content-length: '40' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: 22b189095bc9a166c3891e80b67b2a636eae60a4 27 | recorded_at: 2022-01-18 21:48:11 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_entity_name.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/name/eml/knb-lter-cap/691/2/f6e4efd0b04aea3860724824ca05c5dd 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:20:13 GMT 19 | content-type: text/plain 20 | content-length: '51' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: 691_arthropods_00742cd00ab0d3d02337e28d1c919654.csv 27 | recorded_at: 2022-01-18 23:20:13 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_entity_names.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/name/eml/knb-lter-cap/691/2 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:21:26 GMT 19 | content-type: text/csv 20 | content-length: '258' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | f6e4efd0b04aea3860724824ca05c5dd,691_arthropods_00742cd00ab0d3d02337e28d1c919654.csv 28 | d2263480e75cc7888b41928602cda4c6,691_captures_e5f57a98ae0b7941b10d4a600645495a.csv 29 | d5cb83e4556408e48f636157e4dee49e,691_sampling_events_e8d76d7e76385e4ae84bcafb754d0093.csv 30 | recorded_at: 2022-01-18 23:21:26 GMT 31 | recorded_with: vcr/1.0.2, webmockr/0.8.0 32 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_entity_size.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/data/size/eml/knb-lter-cdr/711/1/c61703839eac9a641ea0c3c69dc3345b 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:39:02 GMT 19 | content-type: text/plain 20 | content-length: '6' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: '707094' 27 | recorded_at: 2022-01-18 23:39:02 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_entity_sizes.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/data/size/eml/knb-lter-cdr/711/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:41:54 GMT 19 | content-type: text/csv 20 | content-length: '40' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | c61703839eac9a641ea0c3c69dc3345b,707094 28 | recorded_at: 2022-01-18 23:41:54 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/eml/knb-lter-cwt/5026/13 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 01:40:06 GMT 19 | content-type: text/plain 20 | content-length: '387' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | https://pasta.lternet.edu/package/data/eml/knb-lter-cwt/5026/13/7abb4028c288b4570dcb637f04ddda2b 28 | https://pasta.lternet.edu/package/data/eml/knb-lter-cwt/5026/13/95d85c2a592f8b8113fe4286082fb347 29 | https://pasta.lternet.edu/package/metadata/eml/knb-lter-cwt/5026/13 30 | https://pasta.lternet.edu/package/report/eml/knb-lter-cwt/5026/13 31 | https://pasta.lternet.edu/package/eml/knb-lter-cwt/5026/13 32 | recorded_at: 2022-01-18 01:40:06 GMT 33 | recorded_with: vcr/1.0.2, webmockr/0.8.0 34 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_citation.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://cite.edirepository.org/cite/edi.460.1?env=production&style=ESIP&access 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: text/plain 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Thu, 03 Mar 2022 23:05:59 GMT 19 | content-type: text/plain; charset=utf-8 20 | content-length: '275' 21 | connection: keep-alive 22 | access-control-allow-origin: '*' 23 | access-control-allow-methods: GET, POST, OPTIONS 24 | access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range 25 | access-control-expose-headers: Content-Length,Content-Range 26 | body: 27 | encoding: UTF-8 28 | file: no 29 | string: 'Armitage, A.R., C.A. Weaver, J.S. Kominoski, and S.C. Pennings. 2020. 30 | Hurricane Harvey: Coastal wetland plant responses and recovery in Texas: 2014-2019 31 | ver 1. Environmental Data Initiative. https://doi.org/10.6073/pasta/e288ccaf55afceecc29bdf0a341248d6. 32 | Accessed 2022-03-03.' 33 | recorded_at: 2022-03-03 23:05:59 GMT 34 | recorded_with: vcr/1.0.2, webmockr/0.8.0 35 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_citation_html.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://cite.edirepository.org/cite/edi.460.1?env=production&style=ESIP&access 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: text/html 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Thu, 03 Mar 2022 23:05:59 GMT 19 | content-type: text/html; charset=utf-8 20 | transfer-encoding: chunked 21 | connection: keep-alive 22 | access-control-allow-origin: '*' 23 | access-control-allow-methods: GET, POST, OPTIONS 24 | access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range 25 | access-control-expose-headers: Content-Length,Content-Range 26 | content-encoding: gzip 27 | body: 28 | encoding: UTF-8 29 | file: no 30 | string: 'Armitage, A.R., C.A. Weaver, J.S. Kominoski, and S.C. Pennings. 2020. 31 | Hurricane Harvey: Coastal wetland plant responses and recovery in Texas: 2014-2019 32 | ver 1. Environmental Data Initiative. https://doi.org/10.6073/pasta/e288ccaf55afceecc29bdf0a341248d6. 33 | Accessed 2022-03-03.' 34 | recorded_at: 2022-03-03 23:05:59 GMT 35 | recorded_with: vcr/1.0.2, webmockr/0.8.0 36 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_citation_json.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://cite.edirepository.org/cite/edi.460.1?env=production&style=ESIP&access 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Thu, 03 Mar 2022 23:05:59 GMT 19 | content-type: application/json; charset=utf-8 20 | content-length: '388' 21 | connection: keep-alive 22 | access-control-allow-origin: '*' 23 | access-control-allow-methods: GET, POST, OPTIONS 24 | access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range 25 | access-control-expose-headers: Content-Length,Content-Range 26 | body: 27 | encoding: UTF-8 28 | file: no 29 | string: |- 30 | { 31 | "authors": "Armitage, A.R., C.A. Weaver, J.S. Kominoski, and S.C. Pennings.", 32 | "pub_year": "2020.", 33 | "title": "Hurricane Harvey: Coastal wetland plant responses and recovery in Texas: 2014-2019", 34 | "version": "ver 1.", 35 | "publisher": "Environmental Data Initiative.", 36 | "doi": "https://doi.org/10.6073/pasta/e288ccaf55afceecc29bdf0a341248d6.", 37 | "accessed": "Accessed 2022-03-03." 38 | } 39 | recorded_at: 2022-03-03 23:05:59 GMT 40 | recorded_with: vcr/1.0.2, webmockr/0.8.0 41 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_doi.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/doi/eml/knb-lter-jrn/210548103/15 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:45:32 GMT 19 | content-type: text/plain 20 | content-length: '50' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: doi:10.6073/pasta/c80c0c03d22791524d4b870d2193c843 27 | recorded_at: 2022-01-18 23:45:32 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_error.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/error/eml/archive_knb-lter-sev.31999.1_16396683904724129 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 404 13 | category: Client error 14 | reason: Not Found 15 | message: 'Client error: (404) Not Found' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:49:17 GMT 19 | content-type: text/plain 20 | content-length: '80' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: The error file archive_knb-lter-sev.31999.1_16396683904724129.txt was 27 | not found! 28 | recorded_at: 2022-01-18 23:49:17 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_from_doi.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/doi/doi:10.6073/pasta/b202c11db7c64943f6b4ed9f8c17fb25 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Tue, 18 Jan 2022 23:54:38 GMT 19 | content-type: text/plain 20 | content-length: '286' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | https://pasta.lternet.edu/package/data/eml/knb-lter-fce/1233/2/5342832a83006433d64c323d12cc08ae 28 | https://pasta.lternet.edu/package/metadata/eml/knb-lter-fce/1233/2 29 | https://pasta.lternet.edu/package/report/eml/knb-lter-fce/1233/2 30 | https://pasta.lternet.edu/package/eml/knb-lter-fce/1233/2 31 | recorded_at: 2022-01-18 23:54:38 GMT 32 | recorded_with: vcr/1.0.2, webmockr/0.8.0 33 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_report_checksum.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/report/checksum/eml/knb-lter-luq/208/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:17:34 GMT 19 | content-type: text/plain 20 | content-length: '40' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: 980dbf3f3cdb7395933b711b005722033bdcd12f 27 | recorded_at: 2022-01-19 00:17:34 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_report_html.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/report/eml/knb-lter-knz/260/4 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: text/html 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:11:28 GMT 19 | content-type: text/html 20 | transfer-encoding: chunked 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | content-encoding: gzip 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: "\n\ntext\n
\n" 28 | recorded_at: 2022-01-19 00:11:28 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_report_resource_metadata.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/rmd/eml/knb-lter-mcm/9129/3 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:20:23 GMT 19 | content-type: application/xml 20 | content-length: '640' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | 28 | 29 | 2021-04-27 17:50:46.084 30 | doi:10.6073/pasta/26cc82b742eb99a667fae2c367032724 31 | null 32 | null 33 | null 34 | 9129 35 | knb-lter-mcm.9129.3 36 | uid=MCM,o=EDI,dc=edirepository,dc=org 37 | https://pasta.lternet.edu/package/eml/knb-lter-mcm/9129/3 38 | dataPackage 39 | 3 40 | knb-lter-mcm 41 | 42 | recorded_at: 2022-01-19 00:20:23 GMT 43 | recorded_with: vcr/1.0.2, webmockr/0.8.0 44 | -------------------------------------------------------------------------------- /tests/fixtures/read_data_package_resource_metadata.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/rmd/eml/edi/613/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:38:24 GMT 19 | content-type: application/xml 20 | content-length: '610' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | 28 | 29 | 2021-06-08 18:02:43.361 30 | doi:10.6073/pasta/47d7cb6d374b6662cce98e42122169f8 31 | null 32 | null 33 | null 34 | 613 35 | edi.613.1 36 | uid=EDI,o=EDI,dc=edirepository,dc=org 37 | https://pasta.lternet.edu/package/eml/edi/613/1 38 | dataPackage 39 | 1 40 | edi 41 | 42 | recorded_at: 2022-01-19 00:38:24 GMT 43 | recorded_with: vcr/1.0.2, webmockr/0.8.0 44 | -------------------------------------------------------------------------------- /tests/fixtures/read_evaluate_report.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/evaluate/report/eml/evaluate_163966785813042760 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:45:14 GMT 19 | content-type: application/xml 20 | content-length: '21892' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: "\n\n 2021-12-16T08:17:40\n\n" 30 | recorded_at: 2022-01-19 00:45:14 GMT 31 | recorded_with: vcr/1.0.2, webmockr/0.8.0 32 | -------------------------------------------------------------------------------- /tests/fixtures/read_evaluate_report_char.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/evaluate/report/eml/evaluate_163966785813042760 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:45:15 GMT 19 | content-type: application/xml 20 | content-length: '21892' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: "\n\n 2021-12-16T08:17:40\n\n" 30 | recorded_at: 2022-01-19 00:45:15 GMT 31 | recorded_with: vcr/1.0.2, webmockr/0.8.0 32 | -------------------------------------------------------------------------------- /tests/fixtures/read_evaluate_report_html.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/evaluate/report/eml/evaluate_163966785813042760 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: text/html 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:45:14 GMT 19 | content-type: text/html 20 | transfer-encoding: chunked 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | content-encoding: gzip 24 | body: 25 | encoding: UTF-8 26 | file: no 27 | string: "\n\n\n
\n" 28 | recorded_at: 2022-01-19 00:45:14 GMT 29 | recorded_with: vcr/1.0.2, webmockr/0.8.0 30 | -------------------------------------------------------------------------------- /tests/fixtures/read_evaluate_report_summary.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta-s.lternet.edu/package/evaluate/report/eml/evaluate_163966785813042760 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 00:54:54 GMT 19 | content-type: application/xml 20 | content-length: '21892' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: "\n\n 2021-12-16T08:17:40\n edi.602.2\n 30 | \ lter\n knb\n 31 | \ \n \n \n\n\n" 32 | recorded_at: 2022-01-19 00:54:54 GMT 33 | recorded_with: vcr/1.0.2, webmockr/0.8.0 34 | -------------------------------------------------------------------------------- /tests/fixtures/read_metadata_checksum.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/metadata/checksum/eml/knb-lter-ntl/409/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 01:05:17 GMT 19 | content-type: text/plain 20 | content-length: '40' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: c89d0ac740f65ef599c6a90619221441e20b8b6e 27 | recorded_at: 2022-01-19 01:05:17 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/fixtures/read_metadata_dublin_core.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/metadata/dc/knb-lter-nes/10/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 01:14:28 GMT 19 | content-type: application/xml 20 | content-length: '546' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: | 27 | 28 | 29 | 30 | 31 | recorded_at: 2022-01-19 01:14:28 GMT 32 | recorded_with: vcr/1.0.2, webmockr/0.8.0 33 | -------------------------------------------------------------------------------- /tests/fixtures/read_metadata_format.yml: -------------------------------------------------------------------------------- 1 | http_interactions: 2 | - request: 3 | method: get 4 | uri: https://pasta.lternet.edu/package/metadata/format/eml/knb-lter-nwt/930/1 5 | body: 6 | encoding: '' 7 | string: '' 8 | headers: 9 | Accept: application/json, text/xml, application/xml, */* 10 | response: 11 | status: 12 | status_code: 200 13 | category: Success 14 | reason: OK 15 | message: 'Success: (200) OK' 16 | headers: 17 | server: nginx/1.14.0 (Ubuntu) 18 | date: Wed, 19 Jan 2022 01:23:53 GMT 19 | content-type: text/plain 20 | content-length: '34' 21 | connection: keep-alive 22 | web-service: DataPackageManager-1.0 23 | body: 24 | encoding: UTF-8 25 | file: no 26 | string: eml://ecoinformatics.org/eml-2.1.1 27 | recorded_at: 2022-01-19 01:23:53 GMT 28 | recorded_with: vcr/1.0.2, webmockr/0.8.0 29 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(EDIutils) 3 | 4 | test_check("EDIutils") 5 | -------------------------------------------------------------------------------- /tests/testthat/setup-EDIutils.R: -------------------------------------------------------------------------------- 1 | # Occasionally we want to test with real HTTP calls to the API 2 | if (Sys.getenv("EDI_USER") != "" & Sys.getenv("EDI_PASS") != "") { 3 | login(userId = Sys.getenv("EDI_USER"), userPass = Sys.getenv("EDI_PASS")) 4 | } 5 | 6 | # Most of the time we run mock tests 7 | library("vcr") 8 | vcr_dir <- vcr::vcr_test_path("fixtures") 9 | if (!nzchar(Sys.getenv("EDI_TOKEN"))) { 10 | if (dir.exists(vcr_dir)) { 11 | # Fake API token to fool our package 12 | Sys.setenv("EDI_TOKEN" = "foobar") 13 | } else { 14 | # If there's no mock files nor API token, impossible to run tests 15 | stop("No API key nor cassettes, tests cannot be run.", 16 | call. = FALSE 17 | ) 18 | } 19 | } 20 | invisible(vcr::vcr_configure( 21 | dir = vcr::vcr_test_path("fixtures"), 22 | filter_sensitive_data = list("<>" = Sys.getenv('GITHUB_TOKEN')), 23 | filter_request_headers = list(`auth-token` = "<<>>"), 24 | filter_response_headers = list(`auth-token` = "<<>>") 25 | )) 26 | vcr::check_cassette_names() 27 | -------------------------------------------------------------------------------- /tests/testthat/test_check_status_create.R: -------------------------------------------------------------------------------- 1 | context("Check status create") 2 | 3 | testthat::test_that("check_status_create() works", { 4 | vcr::skip_if_vcr_off() 5 | transaction <- "create_163966765080210573__edi.595.1" 6 | # Wait 7 | vcr::use_cassette("check_status_create_wait", { 8 | res <- check_status_create(transaction, wait = TRUE, env = "staging") 9 | }) 10 | expect_true(res) 11 | # Don't wait 12 | vcr::use_cassette("check_status_create", { 13 | res <- check_status_create(transaction, wait = FALSE, env = "staging") 14 | }) 15 | expect_true(res) 16 | }) 17 | 18 | testthat::test_that("check_status_create() works", { 19 | skip_if_logged_out() 20 | transaction <- "create_163966765080210573__edi.595.1" 21 | # Wait 22 | res <- check_status_create(transaction, wait = TRUE, env = "staging") 23 | expect_true(res) 24 | # Don't wait 25 | res <- check_status_create(transaction, wait = FALSE, env = "staging") 26 | expect_true(res) 27 | }) 28 | -------------------------------------------------------------------------------- /tests/testthat/test_check_status_evaluate.R: -------------------------------------------------------------------------------- 1 | context("Check status evaluate") 2 | 3 | testthat::test_that("check_status_evaluate() works", { 4 | transaction <- "evaluate_163966785813042760" 5 | vcr::use_cassette("check_status_evaluate", { 6 | res <- check_status_evaluate(transaction, wait = FALSE, env = "staging") 7 | }) 8 | expect_true(res) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_check_status_update.R: -------------------------------------------------------------------------------- 1 | context("Check status update") 2 | 3 | testthat::test_that("check_status_update() works", { 4 | vcr::skip_if_vcr_off() 5 | transaction <- "create_163966765080210573__edi.595.1" 6 | vcr::use_cassette("check_status_update", { 7 | res <- check_status_update(transaction, wait = FALSE, env = "staging") 8 | }) 9 | expect_true(res) 10 | vcr::use_cassette("check_status_update_wait", { 11 | res <- check_status_update(transaction, wait = TRUE, env = "staging") 12 | }) 13 | expect_true(res) 14 | }) 15 | -------------------------------------------------------------------------------- /tests/testthat/test_create_data_package.R: -------------------------------------------------------------------------------- 1 | context("Create data package") 2 | 3 | testthat::test_that("Test attributes of returned object", { 4 | skip_if_logged_out() 5 | skip_if_missing_eml_config() 6 | # Create data package 7 | identifier <- create_reservation(scope = "edi", env = "staging") 8 | packageId <- paste0("edi.", identifier, ".1") 9 | eml <- create_test_eml(path = tempdir(), packageId = packageId) 10 | on.exit(file.remove(eml), add = TRUE, after = FALSE) 11 | transaction <- create_data_package(eml, env = "staging") 12 | # Check creation status 13 | res <- check_status_create(transaction, env = "staging") 14 | expect_true(res) 15 | # Check for EML 16 | res <- read_metadata(packageId, env = "staging") 17 | expect_true("xml_document" %in% class(res)) 18 | }) 19 | -------------------------------------------------------------------------------- /tests/testthat/test_create_data_package_archive.R: -------------------------------------------------------------------------------- 1 | context("Create data package archive") 2 | 3 | testthat::test_that("create_data_package_archive() works (mock test)", { 4 | vcr::skip_if_vcr_off() 5 | vcr::use_cassette("create_data_package_archive", { 6 | packageId <- "knb-lter-sev.31999.1" 7 | transaction <- suppressWarnings( 8 | create_data_package_archive(packageId) 9 | ) 10 | }) 11 | expect_true(class(transaction) == "character") 12 | }) 13 | 14 | testthat::test_that("create_data_package_archive() issues warning", { 15 | # Test that the create_data_package_archive() function issues a deprecation 16 | # warning when called. 17 | skip_if_logged_out() 18 | testthat::expect_warning( 19 | object = create_data_package_archive("knb-lter-sev.31999.1"), 20 | regexp = "The 'create_data_package_archive' function is deprecated." 21 | ) 22 | }) 23 | -------------------------------------------------------------------------------- /tests/testthat/test_create_dn.R: -------------------------------------------------------------------------------- 1 | context("Create distinguished name") 2 | 3 | testthat::test_that("Test attributes of returned object", { 4 | # Create distinguished name within EDI organizational unit 5 | userId <- "my_userid" 6 | ou <- "EDI" 7 | dn <- create_dn(userId, ou) 8 | expect_true(grepl("edirepository", dn)) 9 | # Create distinguished name within LTER organizational unit 10 | userId <- "my_userid" 11 | ou <- "LTER" 12 | dn <- create_dn(userId, ou) 13 | expect_true(grepl("ecoinformatics", dn)) 14 | }) 15 | -------------------------------------------------------------------------------- /tests/testthat/test_create_event_subscription.R: -------------------------------------------------------------------------------- 1 | context("Create event subscription") 2 | 3 | testthat::test_that("create_event_subscription() works", { 4 | # Tested in test_execute_event_subscription.R 5 | }) 6 | -------------------------------------------------------------------------------- /tests/testthat/test_create_journal_citation.R: -------------------------------------------------------------------------------- 1 | context("Create journal citation") 2 | 3 | testthat::test_that("create_journal_citation() works", { 4 | skip_if_logged_out() 5 | journalCitationId <- create_journal_citation( 6 | packageId = get_test_package(), 7 | articleDoi = "10.1890/11-1026.1", 8 | articleUrl = "https://doi.org/10.1890/11-1026.1", 9 | articleTitle = "Corridors promote fire via connectivity and edge effects", 10 | journalTitle = "Ecological Applications", 11 | relationType = "IsCitedBy", 12 | env = "staging") 13 | expect_type(journalCitationId, "double") 14 | res <- delete_journal_citation(journalCitationId, env = "staging") 15 | expect_true(res) 16 | }) 17 | -------------------------------------------------------------------------------- /tests/testthat/test_create_reservation.R: -------------------------------------------------------------------------------- 1 | context("Create reservation") 2 | 3 | testthat::test_that("create_reservation() works", { 4 | vcr::use_cassette("create_reservation", { 5 | identifier <- create_reservation("edi", "staging") 6 | }) 7 | expect_type(identifier, "double") 8 | vcr::use_cassette("create_reservation_delete_reservation", { 9 | res <- delete_reservation("edi", identifier, env = "staging") 10 | }) 11 | expect_type(res, "double") 12 | }) 13 | -------------------------------------------------------------------------------- /tests/testthat/test_delete_event_subscription.R: -------------------------------------------------------------------------------- 1 | context("Delete event subscription") 2 | 3 | testthat::test_that("delete_event_subscription() works", { 4 | # The real test is in test_execute_event_subscription.R 5 | vcr::skip_if_vcr_off() 6 | subscriptionId <- 270 7 | vcr::use_cassette("delete_event_subscription", { 8 | res <- delete_event_subscription(subscriptionId, env = "staging") 9 | }) 10 | expect_true(res) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_delete_journal_citation.R: -------------------------------------------------------------------------------- 1 | context("Delete journal citation") 2 | 3 | testthat::test_that("delete_journal_citation() works", { 4 | # Also tested in test_create_journal_citation.R 5 | vcr::skip_if_vcr_off() 6 | journalCitationId <- 183 7 | vcr::use_cassette("delete_journal_citation", { 8 | res <- delete_journal_citation(journalCitationId, env = "staging") 9 | }) 10 | expect_true(res) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_delete_reservation.R: -------------------------------------------------------------------------------- 1 | context("Delete reservation") 2 | 3 | testthat::test_that("Test attributes of returned object", { 4 | # Also tested in test_create_reservation.R 5 | vcr::skip_if_vcr_off() 6 | identifier <- 721 7 | vcr::use_cassette("delete_reservation", { 8 | res <- delete_reservation("edi", identifier, env = "staging") 9 | }) 10 | expect_type(res, "double") 11 | }) 12 | 13 | -------------------------------------------------------------------------------- /tests/testthat/test_evaluate_data_package.R: -------------------------------------------------------------------------------- 1 | context("Evaluate data package") 2 | 3 | testthat::test_that("Test attributes of returned object", { 4 | skip_if_logged_out() 5 | skip_if_missing_eml_config() 6 | # Create data package for evaluation 7 | identifier <- create_reservation(scope = "edi", env = "staging") 8 | packageId <- paste0("edi.", identifier, ".1") 9 | eml <- create_test_eml(path = tempdir(), packageId = packageId) 10 | on.exit(file.remove(eml), add = TRUE, after = FALSE) 11 | # Evaluate 12 | transaction <- evaluate_data_package(eml, env = "staging") 13 | res <- check_status_evaluate(transaction, env = "staging") 14 | expect_true(res) 15 | # Read evaluation report 16 | report <- read_evaluate_report(transaction, env = "staging") 17 | expect_true("xml_document" %in% class(report)) 18 | deleted <- delete_reservation("edi", identifier, env = "staging") 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test_evaluate_report_summary.R: -------------------------------------------------------------------------------- 1 | context("Summarize evaluate report") 2 | 3 | testthat::test_that("evaluate_report_summary() works", { 4 | transaction <- "evaluate_163966785813042760" 5 | vcr::use_cassette("read_evaluate_report_summary", { 6 | expect_message( 7 | read_evaluate_report_summary(transaction, env = "staging")) 8 | }) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_execute_event_subscription.R: -------------------------------------------------------------------------------- 1 | context("Execute event subscription") 2 | 3 | testthat::test_that("execute_event_subscription() works (mock test)", { 4 | vcr::skip_if_vcr_off() 5 | subscriptionId <- 270 6 | vcr::use_cassette("execute_event_subscription", { 7 | res <- execute_event_subscription(subscriptionId, env = "staging") 8 | }) 9 | expect_true(res) 10 | }) 11 | 12 | testthat::test_that("execute_event_subscription() works", { 13 | skip_if_logged_out() 14 | # Create subscription 15 | packageId <- get_test_package() 16 | url <- paste0("https://some.server.", sample(1:100, 1), ".org") 17 | subscriptionId <- create_event_subscription(packageId, url, env = "staging") 18 | expect_type(subscriptionId, "double") 19 | # Execute subscription 20 | res <- execute_event_subscription(subscriptionId, env = "staging") 21 | expect_true(res) 22 | # Delete subscription 23 | res <- delete_event_subscription(subscriptionId, env = "staging") 24 | expect_true(res) 25 | }) 26 | -------------------------------------------------------------------------------- /tests/testthat/test_get_audit_count.R: -------------------------------------------------------------------------------- 1 | context("Get audit count") 2 | 3 | testthat::test_that("get_audit_count() works", { 4 | vcr::use_cassette("get_audit_count", { 5 | res <- get_audit_count( 6 | query = "category=warn&fromTime=2021-12-01&toTime=2021-12-05") 7 | }) 8 | expect_type(res, "double") 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_get_audit_record.R: -------------------------------------------------------------------------------- 1 | context("Get audit record") 2 | 3 | testthat::test_that("get_audit_record() works (real call)", { 4 | skip_if_logged_out() 5 | uploads <- get_recent_uploads(query = "serviceMethod=createDataPackage&limit=1") 6 | oid <- uploads$oid 7 | auditReport <- get_audit_record(oid, as = "xml") 8 | res <- xml2::xml_find_first(auditReport, ".//auditRecord") 9 | children_found <- xml2::xml_name(xml2::xml_children(res)) 10 | children_expected <- c("oid", "entryTime", "category", "service", 11 | "serviceMethod", "responseStatus", "resourceId", 12 | "user", "userAgent", "groups", "authSystem", 13 | "entryText") 14 | expect_true(all(children_found %in% children_expected)) 15 | }) 16 | -------------------------------------------------------------------------------- /tests/testthat/test_get_audit_report.R: -------------------------------------------------------------------------------- 1 | context("Get audit report") 2 | 3 | testthat::test_that("get_audit_report() works", { 4 | query <- "serviceMethod=readDataEntity&limit=1" 5 | vcr::use_cassette("get_audit_report", { 6 | auditReport <- get_audit_report(query, as = "xml") 7 | }) 8 | expect_true("xml_document" %in% class(auditReport)) 9 | expect_true("auditRecord" %in% 10 | xml2::xml_name(xml2::xml_children(auditReport))) 11 | # Get first audit record 12 | auditRecord <- xml2::xml_find_first(auditReport, ".//auditRecord") 13 | children_found <- xml2::xml_name(xml2::xml_children(auditRecord)) 14 | children_expected <- c("oid", "entryTime", "category", "service", 15 | "serviceMethod", "responseStatus", "resourceId", 16 | "user", "userAgent", "groups", "authSystem", 17 | "entryText") 18 | expect_true(all(children_found %in% children_expected)) 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test_get_docid_reads.R: -------------------------------------------------------------------------------- 1 | context("Get doc ID reads") 2 | 3 | testthat::test_that("get_docid_reads() works", { 4 | vcr::use_cassette("get_docid_reads", { 5 | res <- get_docid_reads("knb-lter-sgs", "817", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("resource" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("resourceId", "resourceType", "scope", "identifier", 12 | "revision", "totalReads", "nonRobotReads") 13 | expect_true(all(children_found %in% children_expected)) 14 | }) 15 | -------------------------------------------------------------------------------- /tests/testthat/test_get_event_subscription.R: -------------------------------------------------------------------------------- 1 | context("Get event subscription") 2 | 3 | testthat::test_that("get_event_subscription() works (mock test)", { 4 | vcr::skip_if_vcr_off() 5 | subscriptionId <- 272 6 | vcr::use_cassette("get_event_subscription", { 7 | res <- get_event_subscription(subscriptionId, as = "xml", env = "staging") 8 | }) 9 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 10 | expect_true("subscription" %in% xml2::xml_name(xml2::xml_children(res))) 11 | children_found <- xml2::xml_name( 12 | xml2::xml_children(xml2::xml_children(res)[1])) 13 | children_expected <- c("id", "creator", "packageId", "url") 14 | expect_true(all(children_found %in% children_expected)) 15 | }) 16 | 17 | testthat::test_that("get_event_subscription() works", { 18 | skip_if_logged_out() 19 | packageId <- get_test_package() 20 | url <- "https://some.server.org" 21 | subscriptionId <- create_event_subscription(packageId, url, env = "staging") 22 | on.exit(delete_event_subscription(subscriptionId, env = "staging")) 23 | res <- get_event_subscription(subscriptionId, as = "xml", env = "staging") 24 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 25 | expect_true("subscription" %in% xml2::xml_name(xml2::xml_children(res))) 26 | children_found <- xml2::xml_name( 27 | xml2::xml_children(xml2::xml_children(res)[1])) 28 | children_expected <- c("id", "creator", "packageId", "url") 29 | expect_true(all(children_found %in% children_expected)) 30 | }) 31 | -------------------------------------------------------------------------------- /tests/testthat/test_get_event_subscription_schema.R: -------------------------------------------------------------------------------- 1 | context("Get event subscription schema") 2 | 3 | testthat::test_that("get_event_subscription_schema() works", { 4 | vcr::use_cassette("get_event_subscription_schema", { 5 | res <- get_event_subscription_schema() 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("element" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("complexType") 12 | expect_true(all(children_found %in% children_expected)) 13 | }) 14 | -------------------------------------------------------------------------------- /tests/testthat/test_get_journal_citation.R: -------------------------------------------------------------------------------- 1 | context("Get journal citation") 2 | 3 | testthat::test_that("get_journal_citation() works ", { 4 | vcr::use_cassette("list_data_package_citations", { 5 | journalCitations <- list_data_package_citations( 6 | packageId = "edi.845.1", 7 | as = "xml" 8 | ) 9 | }) 10 | journalCitationId <- xml2::xml_text( 11 | xml2::xml_find_first(journalCitations, ".//journalCitationId")) 12 | vcr::use_cassette("get_journal_citation", { 13 | res <- get_journal_citation(journalCitationId, as = "xml") 14 | }) 15 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 16 | children_found <- xml2::xml_name(xml2::xml_children(res)) 17 | children_expected <- c("journalCitationId", "packageId", "principalOwner", 18 | "dateCreated", "articleDoi", "articleTitle", 19 | "articleUrl", "journalTitle", "relationType") 20 | expect_true(all(children_found %in% children_expected)) 21 | }) 22 | -------------------------------------------------------------------------------- /tests/testthat/test_get_packageid_reads.R: -------------------------------------------------------------------------------- 1 | context("Get packageId reads") 2 | 3 | testthat::test_that("get_packageid_reads() works", { 4 | vcr::use_cassette("get_packageid_reads", { 5 | res <- get_packageid_reads("knb-lter-sgs.817.17", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("resource" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("resourceId", "resourceType", "scope", "identifier", 12 | "revision", "totalReads", "nonRobotReads") 13 | expect_true(all(children_found %in% children_expected)) 14 | }) 15 | -------------------------------------------------------------------------------- /tests/testthat/test_get_provenance_metadata.R: -------------------------------------------------------------------------------- 1 | context("Get provenance metadata") 2 | 3 | testthat::test_that("get_provenance_metadata() works (mocked test)", { 4 | vcr::use_cassette("get_provenance_metadata", { 5 | res <- get_provenance_metadata("knb-lter-pal.309.1") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | children_found <- xml2::xml_name(xml2::xml_children(res)) 9 | children_expected <- c("description", "dataSource") 10 | expect_true(all(children_found %in% children_expected)) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_get_recent_uploads.R: -------------------------------------------------------------------------------- 1 | context("Get recent uploads") 2 | 3 | testthat::test_that("get_recent_uploads() works", { 4 | skip_if_logged_out() 5 | query <- "serviceMethod=createDataPackage&limit=2" 6 | res <- get_recent_uploads(query, env = "staging", as = "xml") 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("auditRecord" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("oid", "entryTime", "category", "service", 12 | "serviceMethod", "responseStatus", "resourceId", 13 | "user", "userAgent", "groups", "authSystem", 14 | "entryText") 15 | expect_true(all(children_found %in% children_expected)) 16 | }) 17 | -------------------------------------------------------------------------------- /tests/testthat/test_is_authorized.R: -------------------------------------------------------------------------------- 1 | context("Is authorized") 2 | 3 | testthat::test_that("is_authorized() works", { 4 | url <- "https://pasta.lternet.edu/package/report/eml/knb-lter-sbc/6006/3" 5 | vcr::use_cassette("is_authorized", { 6 | res <- is_authorized(url) 7 | }) 8 | expect_true(class(res) %in% "logical") 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_active_reservations.R: -------------------------------------------------------------------------------- 1 | context("List active reservations") 2 | 3 | testthat::test_that("list_active_reservations() works", { 4 | vcr::use_cassette("list_active_reservations", { 5 | res <- list_active_reservations("staging", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("reservation" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("docid", "principal", "dateReserved") 12 | expect_true(all(children_found %in% children_expected)) 13 | }) 14 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_descendants.R: -------------------------------------------------------------------------------- 1 | context("List data descendants") 2 | 3 | testthat::test_that("list_data_descendants() works", { 4 | vcr::use_cassette("list_data_descendants", { 5 | res <- list_data_descendants("knb-lter-bnz.501.17", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("dataDescendant" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("packageId", "title", "url") 12 | expect_true(all(children_found %in% children_expected)) 13 | }) 14 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_entities.R: -------------------------------------------------------------------------------- 1 | context("List data entities") 2 | 3 | # testthat::test_that("list_data_entities() works", { 4 | # pkg <- "edi.993.1" 5 | # vcr::use_cassette("list_data_entities", { 6 | # res <- list_data_entities(pkg) 7 | # }) 8 | # expect_equal(class(res), "character") 9 | # expect_true(length(res) > 0) 10 | # }) 11 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_package_citations.R: -------------------------------------------------------------------------------- 1 | context("List data package citations") 2 | 3 | testthat::test_that("list_data_package_citations() works", { 4 | vcr::use_cassette("list_data_package_citations", { 5 | res <- list_data_package_citations("edi.845.1", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("journalCitation" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("journalCitationId", "packageId", "principalOwner", 12 | "dateCreated", "articleDoi", "articleTitle", 13 | "articleUrl", "journalTitle", "relationType") 14 | expect_true(all(children_found %in% children_expected)) 15 | }) 16 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_package_identifiers.R: -------------------------------------------------------------------------------- 1 | context("List data package identifiers") 2 | 3 | testthat::test_that("list_data_package_identifiers() works", { 4 | vcr::use_cassette("list_data_package_identifiers", { 5 | res <- list_data_package_identifiers("knb-lter-ble") 6 | }) 7 | expect_equal(class(res), "numeric") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_package_revisions.R: -------------------------------------------------------------------------------- 1 | context("List data package revisions") 2 | 3 | testthat::test_that("list_data_package_revisions() works", { 4 | # All revisions 5 | vcr::use_cassette("list_data_package_revisions", { 6 | res <- list_data_package_revisions("edi", "275") 7 | }) 8 | expect_equal(class(res), "numeric") 9 | expect_true(length(res) > 0) 10 | # Newest revision 11 | vcr::use_cassette("list_data_package_revisions_newest", { 12 | res <- list_data_package_revisions("edi", "275", filter = "newest") 13 | }) 14 | expect_equal(class(res), "numeric") 15 | expect_true(as.numeric(res) > 1) 16 | # Oldest revision 17 | vcr::use_cassette("list_data_package_revisions_oldest", { 18 | res <- list_data_package_revisions("edi", "275", filter = "oldest") 19 | }) 20 | expect_equal(class(res), "numeric") 21 | expect_true(as.numeric(res) == 1) 22 | }) 23 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_package_scopes.R: -------------------------------------------------------------------------------- 1 | context("List data package scopes") 2 | 3 | testthat::test_that("list_data_package_scopes() works", { 4 | vcr::use_cassette("list_data_package_scopes", { 5 | res <- list_data_package_scopes("staging") 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_data_sources.R: -------------------------------------------------------------------------------- 1 | context("List data sources") 2 | 3 | testthat::test_that("list_data_sources() works", { 4 | vcr::use_cassette("list_data_sources", { 5 | res <- list_data_sources("edi.275.4", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("dataSource" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("packageId", "title", "url") 12 | expect_true(all(children_found %in% children_expected)) 13 | }) 14 | -------------------------------------------------------------------------------- /tests/testthat/test_list_deleted_data_packages.R: -------------------------------------------------------------------------------- 1 | context("List deleted data packages") 2 | 3 | testthat::test_that("list_deleted_data_packages() works", { 4 | vcr::use_cassette("list_deleted_data_packages", { 5 | res <- list_deleted_data_packages() 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_principal_owner_citations.R: -------------------------------------------------------------------------------- 1 | context("List principal owner citations") 2 | 3 | testthat::test_that("list_principal_owner_citations() works", { 4 | vcr::use_cassette("list_principal_owner_citations", { 5 | principalOwner <- create_dn("csmith") 6 | res <- list_principal_owner_citations(principalOwner, as = "xml") 7 | }) 8 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 9 | expect_true("journalCitation" %in% xml2::xml_name(xml2::xml_children(res))) 10 | children_found <- xml2::xml_name( 11 | xml2::xml_children(xml2::xml_children(res)[1])) 12 | children_expected <- c("journalCitationId", "packageId", "principalOwner", 13 | "dateCreated", "articleDoi", "articleTitle", 14 | "articleUrl", "journalTitle", "relationType") 15 | expect_true(all(children_found %in% children_expected)) 16 | }) 17 | -------------------------------------------------------------------------------- /tests/testthat/test_list_recent_changes.R: -------------------------------------------------------------------------------- 1 | context("List recent changes") 2 | 3 | testthat::test_that("list_recent_changes() works", { 4 | skip_if_logged_out() 5 | res <- res <- list_recent_changes( 6 | fromDate = "2021-01-01T00:00:00", 7 | toDate = "2021-02-01T00:00:00", 8 | scope = "knb-lter-hbr", 9 | as = "xml") 10 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 11 | expect_true("dataPackage" %in% xml2::xml_name(xml2::xml_children(res))) 12 | children_found <- xml2::xml_name( 13 | xml2::xml_children(xml2::xml_children(res)[1])) 14 | children_expected <- c("packageId", "scope", "identifier", "revision", 15 | "principal", "doi", "serviceMethod", "date") 16 | expect_true(all(children_found %in% children_expected)) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test_list_recent_uploads.R: -------------------------------------------------------------------------------- 1 | context("List recent uploads") 2 | 3 | testthat::test_that("list_recent_uploads() works", { 4 | vcr::use_cassette("list_recent_uploads", { 5 | res <- list_recent_uploads(type = "update", limit = 5, as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("dataPackage" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("packageId", "scope", "identifier", "revision", 12 | "principal", "doi", "serviceMethod", "date") 13 | expect_true(all(children_found %in% children_expected)) 14 | }) 15 | -------------------------------------------------------------------------------- /tests/testthat/test_list_reservation_identifiers.R: -------------------------------------------------------------------------------- 1 | context("List reservation identifiers") 2 | 3 | testthat::test_that("list_reservation_identifiers() works", { 4 | vcr::use_cassette("list_reservation_identifiers", { 5 | res <- list_reservation_identifiers("edi") 6 | }) 7 | expect_equal(class(res), "numeric") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_service_methods.R: -------------------------------------------------------------------------------- 1 | context("List service methods") 2 | 3 | testthat::test_that("list_service_methods() works", { 4 | vcr::use_cassette("list_service_methods", { 5 | res <- list_service_methods() 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_user_data_packages.R: -------------------------------------------------------------------------------- 1 | context("List user data packages") 2 | 3 | testthat::test_that("list_user_data_packages() works", { 4 | vcr::use_cassette("list_user_data_packages", { 5 | res <- list_user_data_packages(create_dn("dbjourneynorth", "EDI")) 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_list_working_on.R: -------------------------------------------------------------------------------- 1 | context("List data packages the EDI repository is working on") 2 | 3 | testthat::test_that("list_working_on() works", { 4 | vcr::use_cassette("list_working_on", { 5 | res <- list_working_on(as = "xml", "staging") 6 | }) 7 | children <- xml2::xml_name(xml2::xml_children(res)) 8 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 9 | if (length(children) != 0) { 10 | expect_true("dataPackage" %in% children) 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /tests/testthat/test_login.R: -------------------------------------------------------------------------------- 1 | context("Login") 2 | 3 | testthat::test_that("login() works", { 4 | vcr::use_cassette("login", { 5 | expect_error(login("test", "test")) 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /tests/testthat/test_logout.R: -------------------------------------------------------------------------------- 1 | context("Logout") 2 | 3 | testthat::test_that("logout() works", { 4 | # Dev test 5 | }) 6 | -------------------------------------------------------------------------------- /tests/testthat/test_query_event_subscriptions.R: -------------------------------------------------------------------------------- 1 | context("Query event subscriptions") 2 | 3 | testthat::test_that("query_event_subscriptions() works", { 4 | vcr::use_cassette("query_event_subscriptions", { 5 | res <- query_event_subscriptions("scope=edi", as = "xml", env = "staging") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true("subscription" %in% xml2::xml_name(xml2::xml_children(res))) 9 | children_found <- xml2::xml_name( 10 | xml2::xml_children(xml2::xml_children(res)[1])) 11 | children_expected <- c("id", "creator", "packageId", "url") 12 | expect_true(all(children_found %in% children_expected)) 13 | }) 14 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity.R: -------------------------------------------------------------------------------- 1 | context("Read data entity") 2 | 3 | testthat::test_that("read_data_entity() works", { 4 | packageId <- "edi.1047.1" 5 | entityId <- "58b9000439a5671ea7fe13212e889ba5" 6 | vcr::use_cassette("read_data_entity", { 7 | resp <- read_data_entity(packageId, entityId) 8 | }) 9 | expect_type(resp, "raw") 10 | }) 11 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity_checksum.R: -------------------------------------------------------------------------------- 1 | context("Read data entity checksum") 2 | 3 | # testthat::test_that("read_data_entity_checksum() works", { 4 | # packageId <- "knb-lter-ble.1.7" 5 | # entityId <- "a1723e0e5f3c4881f1a7ede1b036aba6" 6 | # vcr::use_cassette("read_data_entity_checksum", { 7 | # res <- read_data_entity_checksum(packageId, entityId) 8 | # }) 9 | # expect_equal(class(res), "character") 10 | # expect_true(length(res) > 0) 11 | # }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity_name.R: -------------------------------------------------------------------------------- 1 | context("Read data entity name") 2 | 3 | testthat::test_that("read_data_entity_name() works", { 4 | packageId <- "knb-lter-cap.691.2" 5 | entityId <- "f6e4efd0b04aea3860724824ca05c5dd" 6 | vcr::use_cassette("read_data_entity_name", { 7 | res <- read_data_entity_name(packageId, entityId) 8 | }) 9 | expect_equal(class(res), "character") 10 | expect_true(length(res) > 0) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity_names.R: -------------------------------------------------------------------------------- 1 | context("Read data entity names") 2 | 3 | testthat::test_that("read_data_entity_names() works", { 4 | packageId <- "knb-lter-cap.691.2" 5 | vcr::use_cassette("read_data_entity_names", { 6 | res <- read_data_entity_names(packageId) 7 | }) 8 | expect_equal(class(res), "data.frame") 9 | expect_true(all(names(res) %in% c("entityId", "entityName"))) 10 | expect_true(nrow(res) > 1) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity_resource_metadata.R: -------------------------------------------------------------------------------- 1 | context("Read data entity resource metadata") 2 | 3 | testthat::test_that("read_data_entity_resource_metadata() works", { 4 | packageId <- "knb-lter-cce.310.1" 5 | entityId <- "4aaaff61e0d316130be0b445d3013877" 6 | vcr::use_cassette("read_data_entity_resource_metadata", { 7 | res <- read_data_entity_resource_metadata(packageId, entityId, as = "xml") 8 | }) 9 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 10 | children_found <- xml2::xml_name(xml2::xml_children(res)) 11 | children_expected <- c("dataFormat", "dateCreated", "entityId", "entityName", 12 | "fileName", "identifier", "md5Checksum", "packageId", 13 | "principalOwner", "resourceId", "resourceLocation", 14 | "resourceSize", "resourceType", "revision", "scope", 15 | "sha1Checksum") 16 | expect_true(all(children_found %in% children_expected)) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity_size.R: -------------------------------------------------------------------------------- 1 | context("Read data entity size") 2 | 3 | testthat::test_that("read_data_entity_size() works", { 4 | packageId <- "knb-lter-cdr.711.1" 5 | entityId <- "c61703839eac9a641ea0c3c69dc3345b" 6 | vcr::use_cassette("read_data_entity_size", { 7 | res <- read_data_entity_size(packageId, entityId) 8 | }) 9 | expect_equal(class(res), "numeric") 10 | expect_true(length(res) > 0) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_entity_sizes.R: -------------------------------------------------------------------------------- 1 | context("Read data entity sizes") 2 | 3 | testthat::test_that("read_data_entity_sizes() works", { 4 | packageId <- "knb-lter-cdr.711.1" 5 | vcr::use_cassette("read_data_entity_sizes", { 6 | res <- read_data_entity_sizes(packageId) 7 | }) 8 | expect_equal(class(res), "data.frame") 9 | expect_true(all(names(res) %in% c("entityId", "size"))) 10 | expect_true(nrow(res) > 0) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package.R: -------------------------------------------------------------------------------- 1 | context("Read data package") 2 | 3 | testthat::test_that("read_data_package() works", { 4 | vcr::use_cassette("read_data_package", { 5 | res <- read_data_package("knb-lter-cwt.5026.13") 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | 11 | testthat::test_that("read_data_package(..., ore = TRUE) works", { 12 | vcr::use_cassette("read_data_package_ore", { 13 | res <- read_data_package("knb-lter-cwt.5026.13", ore = TRUE) 14 | }) 15 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 16 | expect_true("Description" %in% xml2::xml_name(xml2::xml_children(res))) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_citation.R: -------------------------------------------------------------------------------- 1 | context("Read data package citation") 2 | 3 | testthat::test_that("read_data_package_citation() works", { 4 | packageId <- "edi.460.1" 5 | # As char 6 | vcr::use_cassette("read_data_package_citation", { 7 | res <- read_data_package_citation(packageId) 8 | }) 9 | expect_equal(class(res), "character") 10 | # As html 11 | vcr::use_cassette("read_data_package_citation_html", { 12 | res <- read_data_package_citation(packageId, as = "html") 13 | }) 14 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 15 | # As json 16 | vcr::use_cassette("read_data_package_citation_json", { 17 | res <- read_data_package_citation(packageId, as = "json") 18 | }) 19 | expect_equal(class(res), "json") 20 | }) 21 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_doi.R: -------------------------------------------------------------------------------- 1 | context("Read data package DOI") 2 | 3 | testthat::test_that("read_data_package_doi() works", { 4 | vcr::use_cassette("read_data_package_doi", { 5 | res <- read_data_package_doi("knb-lter-jrn.210548103.15") 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_error.R: -------------------------------------------------------------------------------- 1 | context("Read data package error") 2 | 3 | testthat::test_that("read_data_package_error() works", { 4 | transaction <- "archive_knb-lter-sev.31999.1_16396683904724129" 5 | vcr::use_cassette("read_data_package_error", { 6 | res <- read_data_package_error(transaction) 7 | }) 8 | expect_null(res) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_from_doi.R: -------------------------------------------------------------------------------- 1 | context("Read data package from DOI") 2 | 3 | testthat::test_that("read_data_package_from_doi() works", { 4 | vcr::skip_if_vcr_off() 5 | # Standard output 6 | vcr::use_cassette("read_data_package_from_doi", { 7 | res <- read_data_package_from_doi( 8 | doi = "doi:10.6073/pasta/b202c11db7c64943f6b4ed9f8c17fb25") 9 | }) 10 | expect_equal(class(res), "character") 11 | expect_true(length(res) > 0) 12 | # # ORE output (vcr issues) 13 | # vcr::use_cassette("read_data_package_from_doi_ore", { 14 | # res <- read_data_package_from_doi( 15 | # doi = "doi:10.6073/pasta/b202c11db7c64943f6b4ed9f8c17fb25", ore = TRUE) 16 | # }) 17 | # expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 18 | # expect_true("Description" %in% xml2::xml_name(xml2::xml_children(res))) 19 | }) 20 | 21 | testthat::test_that("read_data_package_from_doi() works", { 22 | skip_if_logged_out() 23 | # Standard output 24 | res <- read_data_package_from_doi( 25 | doi = "doi:10.6073/pasta/b202c11db7c64943f6b4ed9f8c17fb25") 26 | expect_equal(class(res), "character") 27 | expect_true(length(res) > 0) 28 | # ORE output 29 | res <- read_data_package_from_doi( 30 | doi = "doi:10.6073/pasta/b202c11db7c64943f6b4ed9f8c17fb25", ore = TRUE) 31 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 32 | expect_true("Description" %in% xml2::xml_name(xml2::xml_children(res))) 33 | }) 34 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_report.R: -------------------------------------------------------------------------------- 1 | context("Read data package report") 2 | 3 | testthat::test_that("read_data_package_report() works", { 4 | # As xml 5 | vcr::use_cassette("read_data_package_report", { 6 | res <- read_data_package_report("knb-lter-knz.260.4") 7 | }) 8 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 9 | found_children <- unique(xml2::xml_name(xml2::xml_children(res))) 10 | expected_children <- c("creationDate", "packageId", "includeSystem", 11 | "datasetReport", "entityReport") 12 | expect_true(all(found_children %in% expected_children)) 13 | # As html 14 | vcr::use_cassette("read_data_package_report_html", { 15 | res <- read_data_package_report("knb-lter-knz.260.4", as = "html") 16 | }) 17 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 18 | expect_true("body" %in% xml2::xml_name(xml2::xml_children(res))) 19 | # Read char 20 | vcr::use_cassette("read_data_package_report_char", { 21 | qualityReport <- read_data_package_report( 22 | packageId = "knb-lter-knz.260.4", 23 | as = "char") 24 | }) 25 | expect_type(qualityReport, "character") 26 | }) 27 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_report_checksum.R: -------------------------------------------------------------------------------- 1 | context("Read data package report checksum") 2 | 3 | # testthat::test_that("read_data_package_report_checksum() works", { 4 | # vcr::use_cassette("read_data_package_report_checksum", { 5 | # res <- read_data_package_report_checksum("knb-lter-luq.208.1") 6 | # }) 7 | # expect_equal(class(res), "character") 8 | # expect_true(length(res) > 0) 9 | # }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_report_resource_metadata.R: -------------------------------------------------------------------------------- 1 | context("Read data package report resource metadata") 2 | 3 | testthat::test_that("read_data_package_report_resource_metadata() works", { 4 | vcr::use_cassette("read_data_package_report_resource_metadata", { 5 | res <- read_data_package_report_resource_metadata( 6 | packageId = "knb-lter-mcm.9129.3", 7 | as = "xml" 8 | ) 9 | }) 10 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 11 | found_children <- xml2::xml_name(xml2::xml_children(res)) 12 | expected_children <- c("dateCreated", "doi", "entityId", "entityName", 13 | "fileName", "identifier", "packageId", 14 | "principalOwner", "resourceId", "resourceType", 15 | "revision", "scope" ) 16 | expect_true(all(found_children %in% expected_children)) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_report_summary.R: -------------------------------------------------------------------------------- 1 | context("Summarize evaluate report") 2 | 3 | testthat::test_that("read_data_package_report_summary() works", { 4 | vcr::skip_if_vcr_off() 5 | vcr::use_cassette("read_data_package_report_summary", { 6 | expect_message( 7 | read_data_package_report_summary( 8 | packageId = "knb-lter-knz.260.4", 9 | with_exceptions = FALSE)) 10 | }) 11 | vcr::use_cassette("read_data_package_report_summary_with_exceptions", { 12 | expect_warning( 13 | read_data_package_report_summary( 14 | packageId = "knb-lter-knz.260.4", 15 | with_exceptions = TRUE)) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test_read_data_package_resource_metadata.R: -------------------------------------------------------------------------------- 1 | context("Read data package resource metadata") 2 | 3 | testthat::test_that("read_data_package_resource_metadata() works", { 4 | packageId <- "edi.613.1" 5 | vcr::use_cassette("read_data_package_resource_metadata", { 6 | res <- read_data_package_resource_metadata(packageId, as = "xml") 7 | }) 8 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 9 | children_found <- xml2::xml_name(xml2::xml_children(res)) 10 | children_expected <- c("dateCreated", "doi", "entityId", "entityName", 11 | "fileName", "identifier", "packageId", 12 | "principalOwner", "resourceId", "resourceType", 13 | "revision", "scope") 14 | expect_true(all(children_found %in% children_expected)) 15 | }) 16 | -------------------------------------------------------------------------------- /tests/testthat/test_read_evaluate_report.R: -------------------------------------------------------------------------------- 1 | context("Read evaluate report") 2 | 3 | testthat::test_that("read_evaluate_report() works", { 4 | transaction <- "evaluate_163966785813042760" 5 | # Read XML 6 | vcr::use_cassette("read_evaluate_report", { 7 | qualityReport <- read_evaluate_report(transaction, env = "staging") 8 | }) 9 | expect_true("xml_document" %in% class(qualityReport)) 10 | # Read HTML 11 | vcr::use_cassette("read_evaluate_report_html", { 12 | qualityReport <- read_evaluate_report( 13 | transaction, 14 | as = "html", 15 | env = "staging" 16 | ) 17 | }) 18 | expect_true("xml_document" %in% class(qualityReport)) 19 | # Read char 20 | vcr::use_cassette("read_evaluate_report_char", { 21 | qualityReport <- read_evaluate_report( 22 | transaction, 23 | as = "char", 24 | env = "staging" 25 | ) 26 | }) 27 | expect_type(qualityReport, "character") 28 | }) 29 | -------------------------------------------------------------------------------- /tests/testthat/test_read_metadata.R: -------------------------------------------------------------------------------- 1 | context("Read metadata") 2 | 3 | testthat::test_that("read_metadata() works", { 4 | vcr::use_cassette("read_metadata", { 5 | res <- read_metadata("edi.100.1") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | expect_true(all(c("access", "dataset") %in% 9 | xml2::xml_name(xml2::xml_children(res)))) 10 | }) 11 | -------------------------------------------------------------------------------- /tests/testthat/test_read_metadata_checksum.R: -------------------------------------------------------------------------------- 1 | context("Read metadata checksum") 2 | 3 | # testthat::test_that("read_metadata_checksum() works", { 4 | # vcr::use_cassette("read_metadata_checksum", { 5 | # res <- read_metadata_checksum("knb-lter-ntl.409.1") 6 | # }) 7 | # expect_equal(class(res), "character") 8 | # expect_true(length(res) > 0) 9 | # }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_read_metadata_entity.R: -------------------------------------------------------------------------------- 1 | context("Read metadata entity") 2 | 3 | testthat::test_that("read_metadata_entity() works", { 4 | packageId <- "knb-lter-cap.691.2" 5 | entityId <- "f6e4efd0b04aea3860724824ca05c5dd" 6 | vcr::use_cassette("read_metadata_entity", { 7 | res <- read_metadata_entity(packageId, entityId) 8 | }) 9 | expect_true("xml_nodeset" %in% class(res)) 10 | expect_true(all("dataTable" %in% xml2::xml_name(res))) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_read_metadata_format.R: -------------------------------------------------------------------------------- 1 | context("Read metadata format") 2 | 3 | testthat::test_that("read_metadata_format() works", { 4 | vcr::use_cassette("read_metadata_format", { 5 | res <- read_metadata_format("knb-lter-nwt.930.1") 6 | }) 7 | expect_equal(class(res), "character") 8 | expect_true(length(res) > 0) 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test_read_metadata_resource_metadata.R: -------------------------------------------------------------------------------- 1 | context("Read metadata resource metadata") 2 | 3 | testthat::test_that("read_metadata_resource_metadata() works", { 4 | vcr::use_cassette("read_metadata_resource_metadata", { 5 | res <- read_metadata_resource_metadata("knb-lter-pal.309.1", as = "xml") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | children_expected <- c("dateCreated", "entityId", "entityName", "fileName", 9 | "formatType", "identifier", "md5Checksum", 10 | "packageId", "principalOwner", "resourceId", 11 | "resourceType", "revision", "scope", "sha1Checksum") 12 | children_found <- xml2::xml_name(xml2::xml_children(res)) 13 | expect_true(all(children_found %in% children_expected)) 14 | }) 15 | -------------------------------------------------------------------------------- /tests/testthat/test_read_metdata_dublin_core.R: -------------------------------------------------------------------------------- 1 | context("Read metadata Dublin Core") 2 | 3 | testthat::test_that("read_metadata_dublin_core() works", { 4 | vcr::use_cassette("read_metadata_dublin_core", { 5 | res <- read_metadata_dublin_core("knb-lter-nes.10.1") 6 | }) 7 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 8 | children_found <- xml2::xml_name(xml2::xml_children(res)) 9 | children_expected <- c("type", "identifier") 10 | expect_true(all(children_found %in% children_expected)) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_search_data_packages.R: -------------------------------------------------------------------------------- 1 | context("Search data packages") 2 | 3 | testthat::test_that("search_data_packages() works", { 4 | query <- 'q="air+temperature"&fl=*' 5 | vcr::use_cassette("search_data_packages", { 6 | res <- search_data_packages(query, as = "xml") 7 | }) 8 | expect_true(all(class(res) %in% c("xml_document", "xml_node"))) 9 | expect_true("document" %in% xml2::xml_name(xml2::xml_children(res))) 10 | children_found <- xml2::xml_name( 11 | xml2::xml_children(xml2::xml_children(res)[1])) 12 | children_expected <- c("abstract", "begindate", "doi", "enddate", "funding", 13 | "geographicdescription", "id", "methods", "packageid", 14 | "pubdate", "responsibleParties", "scope", "site", 15 | "taxonomic", "title", "authors", "spatialCoverage", 16 | "sources", "keywords", "organizations", "singledates", 17 | "timescales") 18 | expect_true(all(children_found %in% children_expected)) 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test_update_data_package.R: -------------------------------------------------------------------------------- 1 | context("Update data package") 2 | 3 | testthat::test_that("Test attributes of returned object", { 4 | skip_if_logged_out() 5 | skip_if_missing_eml_config() 6 | # Create new data packaging 7 | identifier <- create_reservation(scope = "edi", env = "staging") 8 | packageId <- paste0("edi.", identifier, ".1") 9 | eml <- create_test_eml(path = tempdir(), packageId = packageId) 10 | on.exit(file.remove(eml), add = TRUE, after = FALSE) 11 | transaction <- create_data_package(eml, env = "staging") 12 | res <- check_status_create(transaction, env = "staging") 13 | # Update data package 14 | packageId <- paste0("edi.", identifier, ".2") 15 | eml <- create_test_eml(path = tempdir(), packageId = packageId) 16 | transaction <- update_data_package(eml, env = "staging") 17 | res <- check_status_update(transaction, env = "staging") 18 | expect_true(res) 19 | # Check for EML 20 | res <- read_metadata(packageId, env = "staging") 21 | expect_true("xml_document" %in% class(res)) 22 | }) 23 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/downloads_by_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/EDIutils/790f5e270ec973ebe231f623985dbd494dd7e429/vignettes/downloads_by_date.png -------------------------------------------------------------------------------- /vignettes/downloads_by_identifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/EDIutils/790f5e270ec973ebe231f623985dbd494dd7e429/vignettes/downloads_by_identifier.png --------------------------------------------------------------------------------