77# # The roxygen comments for these functions are mostly generated from data
88# # in this list and template text maintained in gargle.
99gargle_lookup_table <- list (
10- PACKAGE = " googledrive" ,
11- YOUR_STUFF = " your Drive files" ,
12- PRODUCT = " Google Drive" ,
13- API = " Drive API" ,
14- PREFIX = " drive"
10+ PACKAGE = " googledrive" ,
11+ YOUR_STUFF = " your Drive files" ,
12+ PRODUCT = " Google Drive" ,
13+ API = " Drive API" ,
14+ PREFIX = " drive"
1515)
1616
1717# ' Authorize googledrive
@@ -59,12 +59,15 @@ gargle_lookup_table <- list(
5959# '
6060# ' # use a service account token
6161# ' drive_auth(path = "foofy-83ee9e7c9c48.json")
62- drive_auth <- function (email = gargle :: gargle_oauth_email(),
63- path = NULL , subject = NULL ,
64- scopes = " drive" ,
65- cache = gargle :: gargle_oauth_cache(),
66- use_oob = gargle :: gargle_oob_default(),
67- token = NULL ) {
62+ drive_auth <- function (
63+ email = gargle :: gargle_oauth_email(),
64+ path = NULL ,
65+ subject = NULL ,
66+ scopes = " drive" ,
67+ cache = gargle :: gargle_oauth_cache(),
68+ use_oob = gargle :: gargle_oob_default(),
69+ token = NULL
70+ ) {
6871 gargle :: check_is_service_account(path , hint = " drive_auth_configure" )
6972 scopes <- drive_scopes(scopes )
7073 env_unbind(.googledrive , " root_folder" )
@@ -205,15 +208,21 @@ drive_auth_configure <- function(client, path, api_key, app = deprecated()) {
205208 }
206209
207210 if (! missing(client ) && ! missing(path )) {
208- drive_abort(" Must supply exactly one of {.arg client} or {.arg path}, not both" )
211+ drive_abort(
212+ " Must supply exactly one of {.arg client} or {.arg path}, not both"
213+ )
209214 }
210215 stopifnot(missing(api_key ) || is.null(api_key ) || is_string(api_key ))
211216
212217 if (! missing(path )) {
213218 stopifnot(is_string(path ))
214219 client <- gargle :: gargle_oauth_client_from_json(path )
215220 }
216- stopifnot(missing(client ) || is.null(client ) || inherits(client , " gargle_oauth_client" ))
221+ stopifnot(
222+ missing(client ) ||
223+ is.null(client ) ||
224+ inherits(client , " gargle_oauth_client" )
225+ )
217226
218227 if (! missing(client ) || ! missing(path )) {
219228 .auth $ set_client(client )
@@ -283,8 +292,7 @@ resolve_scopes <- function(user_scopes, package_scopes) {
283292}
284293
285294# unexported helpers that are nice for internal use ----
286- drive_auth_internal <- function (account = c(" docs" , " testing" ),
287- scopes = NULL ) {
295+ drive_auth_internal <- function (account = c(" docs" , " testing" ), scopes = NULL ) {
288296 account <- match.arg(account )
289297 can_decrypt <- gargle :: secret_has_key(" GOOGLEDRIVE_KEY" )
290298 online <- ! is.null(curl :: nslookup(" drive.googleapis.com" , error = FALSE ))
@@ -296,15 +304,20 @@ drive_auth_internal <- function(account = c("docs", "testing"),
296304 c(" x" = " Can't decrypt the {.field {account}} service account token." )
297305 },
298306 if (! online ) {
299- c(" x" = " We don't appear to be online. Or maybe the Drive API is down?" )
307+ c(
308+ " x" = " We don't appear to be online. Or maybe the Drive API is down?"
309+ )
300310 }
301311 ),
302312 class = " googledrive_auth_internal_error" ,
303- can_decrypt = can_decrypt , online = online
313+ can_decrypt = can_decrypt ,
314+ online = online
304315 )
305316 }
306317
307- if (! is_interactive()) local_drive_quiet()
318+ if (! is_interactive()) {
319+ local_drive_quiet()
320+ }
308321 filename <- glue(" googledrive-{account}.json" )
309322 # TODO: revisit when I do PKG_scopes()
310323 # https://github.com/r-lib/gargle/issues/103
0 commit comments