Skip to content

Commit

Permalink
Fix Imports function loading
Browse files Browse the repository at this point in the history
  • Loading branch information
phillc73 committed Jan 27, 2016
1 parent fa8c9a0 commit 86fe06b
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 39 deletions.
6 changes: 3 additions & 3 deletions R/b2CreateBucket.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ b2CreateBucket <- function(bucketName, bucketType) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_create_bucket", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2DeleteBucket.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ b2DeleteBucket <- function(bucketId) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_delete_bucket", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2DeleteFileVersion.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ b2DeleteFileVersion <- function(fileName, fileId) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_delete_file_version", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2DownloadFileById.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ b2DownloadFileById <- function(fileId, overwrite = FALSE) {
paste(
accountAuthorization$downloadUrl,"/b2api/v1/b2_download_file_by_id", sep =
""
), body = jsonlite::toJSON(unbox(fileId), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(fileId), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
), write_disk("tmp", overwrite = overwrite)
), httr::write_disk("tmp", overwrite = overwrite)
)

# Alternative GET call
# b2Return <- httr::GET(url = paste(accountAuthorization$downloadUrl,"/b2api/v1/b2_download_file_by_id?fileId=", fileId, sep=""), add_headers('Authorization' = as.character(accountAuthorization$authorizationToken)), write_disk("tmp", overwrite))

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
Expand Down
6 changes: 3 additions & 3 deletions R/b2DownloadFileByName.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ b2DownloadFileByName <-
url = paste(
accountAuthorization$downloadUrl,"/file/", bucketName, "/", fileName, sep =
""
), add_headers(
), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
), write_disk("tmp", overwrite = overwrite)
), httr::write_disk("tmp", overwrite = overwrite)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
Expand Down
6 changes: 3 additions & 3 deletions R/b2GetFileInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ b2GetFileInfo <- function(fileId) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_get_file_info", sep = ""
), body = jsonlite::toJSON(unbox(fileId), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(fileId), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))

}
}
6 changes: 3 additions & 3 deletions R/b2GetUploadUrl.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ b2GetUploadUrl <- function(bucketId) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_get_upload_url", sep = ""
), body = jsonlite::toJSON(unbox(bucketId), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(bucketId), pretty = TRUE), httr::httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2HideFile.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ b2HideFile <- function(bucketId, fileName) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_hide_file", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2ListBuckets.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ b2ListBuckets <- function() {
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_list_buckets?accountId=",accountAuthorization$accountId,sep =
""
), add_headers(
), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
b2Return <- jsonlite::fromJSON(content(b2Return, type = "text"))
b2Return <- jsonlite::fromJSON(httr::content(b2Return, type = "text"))
b2Return[[1]]
}
}
6 changes: 3 additions & 3 deletions R/b2ListFileNames.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ b2ListFileNames <-
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_list_file_names", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))

}
}
6 changes: 3 additions & 3 deletions R/b2ListFileVersions.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ b2ListFileVersions <-
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_list_file_versions", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2UpdateBucket.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ b2UpdateBucket <- function(bucketId, bucketType) {
httr::POST(
paste(
accountAuthorization$apiUrl,"/b2api/v1/b2_update_bucket", sep = ""
), body = jsonlite::toJSON(unbox(vars), pretty = TRUE), add_headers(
), body = jsonlite::toJSON(jsonlite::unbox(vars), pretty = TRUE), httr::add_headers(
'Authorization' = as.character(accountAuthorization$authorizationToken)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}
6 changes: 3 additions & 3 deletions R/b2UploadFile.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ b2UploadFile <- function(authToken, uploadUrl, fileName) {
# API call
b2Return <-
httr::POST(
uploadUrl, body = upload_file(fileName), add_headers(
uploadUrl, body = httr::upload_file(fileName), httr::add_headers(
'Authorization' = as.character(authToken), 'X-Bz-File-Name' = as.character(fileNameEncoded), 'Content-Type' = as.character(b2ContentType), 'Content-Length' = as.character(fileSize), 'X-Bz-Content-Sha1' = as.character(sha1Hash)
)
)

# Check for bad authorisation and sent message
if (httr::status_code(b2Return) != "200") {
badReturn <- jsonlite::fromJSON(content(b2Return,type = "text"))
badReturn <- jsonlite::fromJSON(httr::content(b2Return,type = "text"))
stop(
"\nSomething went wrong. Please check the function options to ensure valid values. \n",
"\nStatus Code: ", badReturn$code, "\nMessage: ", badReturn$message
)

} else {
# Output as dataframe
jsonlite::fromJSON(content(b2Return, type = "text"))
jsonlite::fromJSON(httr::content(b2Return, type = "text"))
}
}

0 comments on commit 86fe06b

Please sign in to comment.