Skip to content

Commit

Permalink
fixes #257
Browse files Browse the repository at this point in the history
  • Loading branch information
dblodgett-usgs committed Apr 20, 2020
1 parent 29bb6ee commit b6b53d4
Show file tree
Hide file tree
Showing 25 changed files with 131 additions and 59 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: sbtools
Title: USGS ScienceBase Tools
Maintainer: David Blodgett <dblodgett@usgs.gov>
Version: 1.1.10
Version: 1.1.11
Authors@R: c(person("David", "Blodgett", role=c("cre"),
email = "dblodgett@usgs.gov"),
person("Tim", "Kern", role=c("aut"),
Expand Down Expand Up @@ -32,5 +32,5 @@ Suggests:
License: CC0
URL: https://github.com/USGS-R/sbtools
BugReports: https://github.com/USGS-R/sbtools/issues
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
Encoding: UTF-8
7 changes: 6 additions & 1 deletion R/REST_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ sbtools_POST <- function(url, body, ..., session){
#' @keywords internal
sbtools_GET <- function(url, ..., session) {
supported_types <- c('text/plain','text/csv','text/tab-separated-values','application/json','application/x-gzip', 'application/pdf')
r = GET(url = url, ..., httrUserAgent(), handle = session)
tryCatch({
r = GET(url = url, ..., httrUserAgent(), handle = session)
}, error = function(e) stop(paste("Error when calling ScienceBase,",
"internet or server down? Original",
"error was:\n", e))
)
handle_errors(r, url, "GET", supported_types)
session_age_reset()
return(r)
Expand Down
4 changes: 2 additions & 2 deletions R/item_get_fields.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#' @import httr
#' @export
#' @examples
#' \donttest{
#' # Get certain fields from an item
#' item_get_fields("4f4e4b24e4b07f02db6aea14", c('title', 'citation', 'contacts'))
#'
#' \dontrun{
#' # If only 1 field selection, do or don't drop list format
#' #' # If only 1 field selection, do or don't drop list format
#' item_get_fields("4f4e4b24e4b07f02db6aea14", 'title')
#' item_get_fields("4f4e4b24e4b07f02db6aea14", 'title', drop = FALSE)
#' }
Expand Down
8 changes: 5 additions & 3 deletions R/item_list_children.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
#'
#' @examples \dontrun{
#' item_list_children(user_id())
#'
#' as.sbitem('5060b03ae4b00fc20c4f3c8b') %>% item_list_children
#' item_get('5060b03ae4b00fc20c4f3c8b') %>% item_list_children
#' }
#'
#' \donttest{
#' item_list_children(as.sbitem('5060b03ae4b00fc20c4f3c8b'))
#' item_list_children(item_get('5060b03ae4b00fc20c4f3c8b'))
#' }
#' @export
item_list_children = function(sb_id, fields=c('id', 'title'), ..., session=current_session(), limit=20){
Expand Down
6 changes: 4 additions & 2 deletions R/item_list_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
#' files attached to an item and all children items.
#'
#' @export
#' @examples \dontrun{
#' @examples
#' \donttest{
#' item_list_files("4f4e4b24e4b07f02db6aea14")
#'
#' }
#' \dontrun{
#' # list files recursively
#' ## create item
#' id <- item_create(user_id(), title="some title")
Expand Down
6 changes: 3 additions & 3 deletions R/set_endpoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#'
#'@examples
#'
#'\dontrun{
#'\donttest{
#'set_endpoint('prod')
#'
#'# getting item from production SB servers
#'item_get('54b94448e4b0ed73b67550ea')
#'item_get('5060b03ae4b00fc20c4f3c8b')
#'
#'set_endpoint('dev')
#'# getting item from beta SB servers
#'item_get('54b94448e4b0ed73b67550ea')
#'item_get('521e4686e4b051c878dc35d0')
#'
#'}
#'
Expand Down
3 changes: 1 addition & 2 deletions man/folder_create.Rd

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

9 changes: 7 additions & 2 deletions man/item_create.Rd

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

11 changes: 9 additions & 2 deletions man/item_file_download.Rd

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

7 changes: 3 additions & 4 deletions man/item_get_fields.Rd

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

15 changes: 11 additions & 4 deletions man/item_list_children.Rd

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

8 changes: 4 additions & 4 deletions man/item_list_files.Rd

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

3 changes: 1 addition & 2 deletions man/item_rename_files.Rd

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

3 changes: 1 addition & 2 deletions man/item_replace_files.Rd

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

9 changes: 7 additions & 2 deletions man/item_rm.Rd

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

10 changes: 8 additions & 2 deletions man/item_update_identifier.Rd

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

9 changes: 7 additions & 2 deletions man/item_upsert.Rd

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

9 changes: 7 additions & 2 deletions man/items_create.Rd

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

9 changes: 7 additions & 2 deletions man/items_upsert.Rd

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

10 changes: 8 additions & 2 deletions man/query_item_identifier.Rd

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

9 changes: 7 additions & 2 deletions man/query_item_in_folder.Rd

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

3 changes: 1 addition & 2 deletions man/query_sb_datatype.Rd

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

11 changes: 8 additions & 3 deletions man/query_sb_date.Rd

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

11 changes: 9 additions & 2 deletions man/query_sb_spatial.Rd

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

Loading

0 comments on commit b6b53d4

Please sign in to comment.