Skip to content

Commit

Permalink
Merge pull request #20 from avantcredit/switch_to_readr
Browse files Browse the repository at this point in the history
switch to readr
  • Loading branch information
abelcastilloavant committed Jun 6, 2016
2 parents bc02186 + 9e01ead commit 24d0fc6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Maintainer: Abel Castillo <[email protected]>
Authors@R: c(person("Abel", "Castillo",
Expand All @@ -15,6 +15,7 @@ Imports:
httr,
jsonlite,
cacher,
readr,
checkr (>= 0.0.4.9007)
Suggests:
testthat,
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion R/response_handlers.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +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)
utils::read.csv(text = data_from_query)
readr::read_csv(data_from_query)
}

9 changes: 5 additions & 4 deletions circle_installations.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
devtools::install_github("hadley/devtools");
devtools::install_github("hadley/[email protected]");
devtools::install_github("klutometis/[email protected]");
devtools::install_github("peterhurford/[email protected]");
devtools::install_github("hadley/devtools")
devtools::install_github("hadley/[email protected]")
devtools::install_github("klutometis/[email protected]")
devtools::install_github("peterhurford/[email protected]")
devtools::install_github("hadley/readr")
devtools::install_github("jimhester/covr")

7 changes: 5 additions & 2 deletions tests/testthat/test-response_handlers.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ 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)
# 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))
})
})
})
Expand Down

0 comments on commit 24d0fc6

Please sign in to comment.