Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceda956
commit 6be58d3
Showing
15 changed files
with
174 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
Package: rtypeform | ||
Type: Package | ||
Title: Interface to 'typeform' Results | ||
Version: 0.1.1 | ||
Date: 2016-03-31 | ||
Version: 0.2.0 | ||
Authors@R: person(given="Colin", family="Gillespie", | ||
email="csgillespie@gmail.com", role = c("aut", "cre")) | ||
Maintainer: Colin Gillespie <csgillespie@gmail.com> | ||
URL: https://github.com/csgillespie/rtypeform | ||
BugReports: https://github.com/csgillespie/rtypeform/issues | ||
Description: An R interface to the 'typeform' (https://typeform.com) application program interface. | ||
Description: An R interface to the 'typeform' <https://typeform.com> application program interface. | ||
Also provides functions for downloading your results. | ||
License: GPL-2 | GPL-3 | ||
LazyData: TRUE | ||
Imports: jsonlite | ||
Imports: jsonlite, httr | ||
Suggests: testthat, curl | ||
RoxygenNote: 5.0.1 | ||
NeedsCompilation: no | ||
Packaged: 2016-03-31 15:55:40 UTC; ncsg3 | ||
Packaged: 2016-12-02 10:56:54 UTC; ncsg3 | ||
Author: Colin Gillespie [aut, cre] | ||
Repository: CRAN | ||
Date/Publication: 2016-03-31 18:47:59 | ||
Date/Publication: 2016-12-02 22:58:14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
cc2ba845bd73fdca690299994b49ee72 *DESCRIPTION | ||
c4e46b96e22fb8be3831a513018b9c24 *NAMESPACE | ||
4f05e1680d3a6a8f4735be3c6a63b168 *NEWS.md | ||
b80a8bbf5aef0e34d6d3632f01785fdb *R/get_all_typeforms.R | ||
b72aadda9d4f6b480f559b62fa0c6d34 *R/get_api.R | ||
0ab5a91a83e043bd3b9100b27362f072 *R/get_results.R | ||
6a89bb4d38d44f5f669e1e15ffa542ec *README.md | ||
acb9dfa390e67e3b98a8c73d4115d190 *man/get_all_typeforms.Rd | ||
8b7e2fe9e9ae256e4dcd4a1191014e28 *man/get_results.Rd | ||
9ff4897f952966d24ba6777b21f5f32d *DESCRIPTION | ||
bb60b191f125f7aa492c9af9a2e443fc *NAMESPACE | ||
3171597ec652db90a31f77afa39b5571 *NEWS.md | ||
9552be8f9fd8523388defe07d9b145db *R/check_api_response.R | ||
88620aa48eb2508be344e2b5fdf92e1c *R/get_all_typeforms.R | ||
434b2a2e3ce3aba877ac1c1163eeec0f *R/get_api.R | ||
d11bd13ef9ee5822fb1ecaa2441ff34f *R/get_results.R | ||
c5cff99fb27d183d319afca0307bf3a3 *README.md | ||
befc087425a6f523e1919ab858cdeb05 *man/get_all_typeforms.Rd | ||
2ff748b1861859a7c925c54ce89a9764 *man/get_api.Rd | ||
522f6ef35dee256fdfef1efdd8a089d4 *man/get_results.Rd | ||
fdd4d6b2f737f7cb02bf00b0bb2af68b *tests/testthat.R | ||
cae894e4e6ac407d503fed6a0b3fb3f0 *tests/testthat/test_get_all_typeforms.R | ||
b73e105dbda820de57fb7eec20a95933 *tests/testthat/test_get_results.R | ||
5457a05a5e3cc8e34c78c75e7364f7c9 *tests/testthat/test_get_all_typeforms.R | ||
5fdd66d530dd268dcda6eeeea8f10b8b *tests/testthat/test_get_linux_time.R | ||
89af0afa90d2b0493d7630858d0670a5 *tests/testthat/test_get_results.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(get_all_typeforms) | ||
export(get_api) | ||
export(get_results) | ||
importFrom(httr,GET) | ||
importFrom(httr,content) | ||
importFrom(httr,status_code) | ||
importFrom(httr,user_agent) | ||
importFrom(jsonlite,fromJSON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
check_api_response = function(resp, cont) { | ||
if (httr::status_code(resp) != 200) { | ||
stop( | ||
sprintf( | ||
"rtypeform API request failed [%s]\n", | ||
status_code(resp) | ||
), | ||
call. = FALSE | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
get_api = function(api){ | ||
#' Retrieve API key from Renviron | ||
#' | ||
#' If the entry \code{typeform_api} exists in your | ||
#' \code{.Renviron} return that value. Otherwise, raise an error. | ||
#' @inheritParams get_all_typeforms | ||
#' @export | ||
get_api = function(api=NULL){ | ||
if(is.null(api)) | ||
api = Sys.getenv("typeform_api") | ||
if(nchar(api) == 0) | ||
stop("Invalid api key.") | ||
api | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
test_that("Testing get_all_typeforms", { | ||
skip_on_cran() | ||
typeforms = get_all_typeforms() | ||
expect_equal(ncol(typeforms), 2) | ||
expect_equal(ncol(typeforms$content), 2) | ||
} | ||
) | ||
) | ||
|
||
test_that("Testing error handling", { | ||
skip_on_cran() | ||
testthat::expect_error(get_all_typeforms(api="XXXX")) | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
test_that("Testing get_linux_time", { | ||
skip_on_cran() | ||
x = as.Date("1970-03-01") | ||
expect_equal(rtypeform:::get_linux_time(x), 5097600) | ||
} | ||
) |
Oops, something went wrong.