From 37556e27f9d5fb9d5fe2d7bfc6b1e2f5d2940d86 Mon Sep 17 00:00:00 2001 From: abelcastilloavant Date: Mon, 6 Jun 2016 16:59:47 -0500 Subject: [PATCH 1/5] switch to readr --- DESCRIPTION | 4 +++- R/response_handlers.R | 3 ++- circle_installations.R | 9 +++++---- tests/testthat/test-response_handlers.R | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7a16d19..ada50c0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,12 +15,14 @@ Imports: httr, jsonlite, cacher, + readr, checkr (>= 0.0.4.9007) Suggests: testthat, withr Remotes: peterhurford/checkr@0.0.4.9008, - kirillseva/cacher@0.1.0 + kirillseva/cacher@0.1.0, + hadley/readr Roxygen: list(wrap = FALSE) RoxygenNote: 5.0.0 diff --git a/R/response_handlers.R b/R/response_handlers.R index 9f74318..0d660d6 100644 --- a/R/response_handlers.R +++ b/R/response_handlers.R @@ -41,6 +41,7 @@ handle_logout_response <- function(logout_response) { extract_query_result <- function(query_response) { validate_response(query_response) data_from_query <- httr::content(query_response) - utils::read.csv(text = data_from_query) + browser() + readr::read_csv(data_from_query) } diff --git a/circle_installations.R b/circle_installations.R index 8d542c7..a0ecf20 100644 --- a/circle_installations.R +++ b/circle_installations.R @@ -1,6 +1,7 @@ -devtools::install_github("hadley/devtools"); -devtools::install_github("hadley/testthat@v0.10.0"); -devtools::install_github("klutometis/roxygen@v5.0.0"); -devtools::install_github("peterhurford/checkr@0.1.2"); +devtools::install_github("hadley/devtools") +devtools::install_github("hadley/testthat@v0.10.0") +devtools::install_github("klutometis/roxygen@v5.0.0") +devtools::install_github("peterhurford/checkr@0.1.2") +devtools::install_github("hadley/readr") devtools::install_github("jimhester/covr") diff --git a/tests/testthat/test-response_handlers.R b/tests/testthat/test-response_handlers.R index c701fe4..0a0b1fd 100644 --- a/tests/testthat/test-response_handlers.R +++ b/tests/testthat/test-response_handlers.R @@ -38,8 +38,9 @@ describe("processing successful responses", { expect_true(handle_logout_response(fake_logout_response)) }) test_that("extract_query_result returns a data frame", { - expect_equal(extract_query_result(fake_query_response), - data.frame(ID = 1, VALUE = 2)) + result <- extract_query_result(fake_query_response) + class(result) <- "data.frame" + expect_equal(result, data.frame(ID = 1, VALUE = 2)) }) }) }) From aae663f9b527577a70e963bcccfed50954256eae Mon Sep 17 00:00:00 2001 From: abelcastilloavant Date: Mon, 6 Jun 2016 17:03:05 -0500 Subject: [PATCH 2/5] remove browser --- R/response_handlers.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/response_handlers.R b/R/response_handlers.R index 0d660d6..dcca43e 100644 --- a/R/response_handlers.R +++ b/R/response_handlers.R @@ -41,7 +41,6 @@ handle_logout_response <- function(logout_response) { extract_query_result <- function(query_response) { validate_response(query_response) data_from_query <- httr::content(query_response) - browser() readr::read_csv(data_from_query) } From 62d51cd066df5b5f1f601774ed5a6fcbab2f7eea Mon Sep 17 00:00:00 2001 From: abelcastilloavant Date: Mon, 6 Jun 2016 17:04:27 -0500 Subject: [PATCH 3/5] explain the change in tests --- tests/testthat/test-response_handlers.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testthat/test-response_handlers.R b/tests/testthat/test-response_handlers.R index 0a0b1fd..51cb0cc 100644 --- a/tests/testthat/test-response_handlers.R +++ b/tests/testthat/test-response_handlers.R @@ -39,6 +39,8 @@ describe("processing successful responses", { }) test_that("extract_query_result returns a data frame", { result <- extract_query_result(fake_query_response) + # readr::read_csv adds extra class types, + # so let's remove them before making our comparison class(result) <- "data.frame" expect_equal(result, data.frame(ID = 1, VALUE = 2)) }) From d85d9e3e805cc3c29972fca279b50e452dfd55ce Mon Sep 17 00:00:00 2001 From: abelcastilloavant Date: Mon, 6 Jun 2016 17:24:14 -0500 Subject: [PATCH 4/5] versioning --- DESCRIPTION | 2 +- NEWS.md | 3 +++ tests/testthat/test-response_handlers.R | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ada50c0..4846136 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: looker3 Type: Package Title: looker3 (http://github.com/abelcastilloavant/avant-looker3) Description: Pull data from Looker using the fancy new 3.0 API. -Version: 0.1.6 +Version: 0.1.7 Author: Abel Castillo Maintainer: Abel Castillo Authors@R: c(person("Abel", "Castillo", diff --git a/NEWS.md b/NEWS.md index 423bacf..f9aaea7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# Version 0.1.6 +- `extract_query_result` now uses `readr::read_csv` instead of `utils::read.csv` under the hood. + # Version 0.1.6 - removed `logout_api_call`, using `cacher` to cache tokens instead. diff --git a/tests/testthat/test-response_handlers.R b/tests/testthat/test-response_handlers.R index 51cb0cc..7347e7c 100644 --- a/tests/testthat/test-response_handlers.R +++ b/tests/testthat/test-response_handlers.R @@ -39,7 +39,7 @@ describe("processing successful responses", { }) test_that("extract_query_result returns a data frame", { result <- extract_query_result(fake_query_response) - # readr::read_csv adds extra class types, + # readr::read_csv adds extra classes, # so let's remove them before making our comparison class(result) <- "data.frame" expect_equal(result, data.frame(ID = 1, VALUE = 2)) From 9e01ead9c6d202837c76c88e8987db7049a25f88 Mon Sep 17 00:00:00 2001 From: abelcastilloavant Date: Mon, 6 Jun 2016 18:04:49 -0500 Subject: [PATCH 5/5] I'll take the CRAN version --- DESCRIPTION | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4846136..9acb381 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,6 @@ Suggests: withr Remotes: peterhurford/checkr@0.0.4.9008, - kirillseva/cacher@0.1.0, - hadley/readr + kirillseva/cacher@0.1.0 Roxygen: list(wrap = FALSE) RoxygenNote: 5.0.0