Skip to content

Commit

Permalink
better API version
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed Nov 16, 2017
1 parent 97d1ff0 commit fa01e2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/natural-language.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ gl_nlp <- function(string,
language <- match.arg(language)
encodingType <- match.arg(encodingType)
# global env set in version.R
version <- .glr$version
version <- get_version()

api_results <- map(string, gl_nlp_single,
nlp_type = nlp_type,
Expand Down
10 changes: 8 additions & 2 deletions R/version.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# used to specify the API endpoint - on GitHub beta, on CRAN, stable
.glr <- new.env(parent = emptyenv())
.glr$version <- "v1"
get_version <- function(){
if(grepl("\\.9...$", packageVersion("googleLanguageR"))){
version <- "v1beta2"
} else {
version <- "v1"
}

version
}

0 comments on commit fa01e2c

Please sign in to comment.