Skip to content

Commit

Permalink
Merge pull request #2 from thongsav-usgs/master
Browse files Browse the repository at this point in the history
update extremes signatures to take prefetched token
  • Loading branch information
Jordan S Read committed Mar 17, 2015
2 parents 1d322eb + f056a8c commit d0ddbe2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions R/extremes.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ setMethod("extremes", signature = c("list", "character"),
}
)


#'@importFrom httr GET
setMethod("extremes", signature = c("character", "character"),
definition = function(data, output,...) {
cat('this function authenticates, goes out and gets data, and then calls the other one\n')
token <- paste0('Bearer ', authenticateUser(...))
ts_list <- getJSON(url = data, auth = token)
setMethod("extremes", signature = c("character", "character", "character"),
definition = function(data, output, token) {
cat('this function uses the token to get data, and then calls the other one\n')

authHeader <- paste0("Bearer " , token)
ts_list <- getJSON(url = data, auth = authHeader)
extremes(ts_list,output)
}
)
)






2 changes: 1 addition & 1 deletion man/extremes.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\alias{extremes}
\title{extremes report}
\usage{
extremes(data, output, ...)
extremes(data, output, token)
}
\arguments{
\item{data}{local data (as list) or URL}
Expand Down

0 comments on commit d0ddbe2

Please sign in to comment.