Skip to content

Commit

Permalink
#96 as.character() for sys.time call in resource_update, bump dev ver
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Sep 14, 2017
1 parent 0cea699 commit 382b48f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Title: Client for the Comprehensive Knowledge Archive Network ('CKAN') 'API'
Description: Client for 'CKAN' 'API' (http://ckan.org/). Includes interface
to 'CKAN' 'APIs' for search, list, show for packages, organizations, and
resources. In addition, provides an interface to the 'datastore' 'API'.
Version: 0.1.2.9844
Version: 0.1.2.9846
Authors@R: c(
person("Scott", "Chamberlain", email="myrmecocystus@gmail.com", role = c("aut", "cre")),
person("Imanuel", "Costigan", email="i.costigan@me.com", role = "ctb"),
Expand Down
12 changes: 8 additions & 4 deletions R/resource_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' path <- system.file("examples", "actinidiaceae.csv", package = "ckanr")
#'
#' # Create package, then a resource within that package
#' (res <- package_create("newpackage9"))
#' (res <- package_create("newpackage10"))
#' (xx <- resource_create(package_id = res$id,
#' description = "my resource",
#' name = "bears",
Expand Down Expand Up @@ -97,14 +97,18 @@
#' browseURL(xxx$url)
#' }
resource_update <- function(id, path, key = get_default_key(),
url = get_default_url(), as = 'list', ...) {
url = get_default_url(),
as = 'list', ...) {

id <- as.ckan_resource(id, url = url)
path <- path.expand(path)
up <- upload_file(path)
format <- pick_type(up$type)
body <- list(id = id$id, format = format, upload = up, last_modified = Sys.time(), url = "update")
body <- list(id = id$id, format = format, upload = up,
last_modified = as.character(Sys.time()), url = "update")
res <- ckan_POST(url, 'resource_update', body = body, key = key, ...)
switch(as, json = res, list = as_ck(jsl(res), "ckan_resource"), table = jsd(res))
switch(as, json = res, list = as_ck(jsl(res), "ckan_resource"),
table = jsd(res))
}

pick_type <- function(x) {
Expand Down
2 changes: 1 addition & 1 deletion man/resource_update.Rd

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

0 comments on commit 382b48f

Please sign in to comment.