Skip to content

Commit

Permalink
fix ropensci#97 add key param to package_show
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott authored and Johannes Langer committed Mar 28, 2018
1 parent 1d2a139 commit 0f1e297
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions R/package_show.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
#' @param use_default_schema (logical) Use default package schema instead of a
#' custom schema defined with an IDatasetForm plugin. Default: FALSE
#' @template args
#' @template key
#' @details By default the help and success slots are dropped, and only the
#' result slot is returned. You can request raw json with \code{as = 'json'}
#' then parse yourself to get the help slot.
#' @examples \dontrun{
#' # Setup
#' ckanr_setup(url = "http://demo.ckan.org/", key = getOption("ckan_demo_key"))
#' ckanr_setup(url = "https://demo.ckan.org/", key = getOption("ckan_demo_key"))
#'
#' # create a package
#' (res <- package_create("purposeful55"))
Expand All @@ -30,9 +31,12 @@
#' package_show(res$id, TRUE)
#' }
package_show <- function(id, use_default_schema = FALSE,
url = get_default_url(), as = 'list', ...) {
url = get_default_url(), key = get_default_key(),
as = 'list', ...) {

id <- as.ckan_package(id, url = url)
args <- cc(list(id = id$id, use_default_schema = use_default_schema))
res <- ckan_GET(url, 'package_show', args, key = NULL, ...)
switch(as, json = res, list = as_ck(jsl(res), "ckan_package"), table = jsd(res))
res <- ckan_GET(url, 'package_show', args, key = key, ...)
switch(as, json = res, list = as_ck(jsl(res), "ckan_package"),
table = jsd(res))
}
6 changes: 4 additions & 2 deletions man/package_show.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0f1e297

Please sign in to comment.