[med-svn] [r-cran-rredlist] 09/11: New upstream version 0.3.0

Andreas Tille tille at debian.org
Mon Oct 2 10:52:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-rredlist.

commit a14c6c0b904e972b8e4467e097fa10ce1a010559
Author: Andreas Tille <tille at debian.org>
Date:   Mon Oct 2 12:49:23 2017 +0200

    New upstream version 0.3.0
---
 DESCRIPTION                           |  21 ++++
 LICENSE                               |   2 +
 MD5                                   |  58 +++++++++++
 NAMESPACE                             |  37 +++++++
 NEWS.md                               |  55 ++++++++++
 R/rl_citation.R                       |  12 +++
 R/rl_common_names.R                   |  23 +++++
 R/rl_countries.R                      |  20 ++++
 R/rl_habitats.R                       |  29 ++++++
 R/rl_history.R                        |  29 ++++++
 R/rl_measures.R                       |  29 ++++++
 R/rl_narrative.R                      |  29 ++++++
 R/rl_occ_country.R                    |  30 ++++++
 R/rl_regions.R                        |  21 ++++
 R/rl_search.R                         |  30 ++++++
 R/rl_sp.R                             |  21 ++++
 R/rl_sp_category.R                    |  25 +++++
 R/rl_sp_citation.R                    |  29 ++++++
 R/rl_sp_count.R                       |  20 ++++
 R/rl_sp_country.R                     |  31 ++++++
 R/rl_synonyms.R                       |  24 +++++
 R/rl_threats.R                        |  29 ++++++
 R/rl_version.R                        |  11 ++
 R/rredlist-package.R                  |  46 +++++++++
 R/zzz.R                               |  93 +++++++++++++++++
 README.md                             | 188 ++++++++++++++++++++++++++++++++++
 debian/README.test                    |   9 --
 debian/changelog                      |  23 -----
 debian/compat                         |   1 -
 debian/control                        |  32 ------
 debian/copyright                      |  32 ------
 debian/docs                           |   3 -
 debian/rules                          |   8 --
 debian/source/format                  |   1 -
 debian/tests/control                  |   3 -
 debian/tests/run-unit-test            |  12 ---
 debian/watch                          |   3 -
 man/rl_citation.Rd                    |  23 +++++
 man/rl_common_names.Rd                |  39 +++++++
 man/rl_countries.Rd                   |  37 +++++++
 man/rl_habitats.Rd                    |  52 ++++++++++
 man/rl_history.Rd                     |  46 +++++++++
 man/rl_measures.Rd                    |  49 +++++++++
 man/rl_narrative.Rd                   |  49 +++++++++
 man/rl_occ_country.Rd                 |  47 +++++++++
 man/rl_regions.Rd                     |  38 +++++++
 man/rl_search.Rd                      |  53 ++++++++++
 man/rl_sp.Rd                          |  30 ++++++
 man/rl_sp_category.Rd                 |  34 ++++++
 man/rl_sp_citation.Rd                 |  49 +++++++++
 man/rl_sp_count.Rd                    |  37 +++++++
 man/rl_sp_country.Rd                  |  47 +++++++++
 man/rl_synonyms.Rd                    |  40 ++++++++
 man/rl_threats.Rd                     |  49 +++++++++
 man/rl_version.Rd                     |  23 +++++
 man/rredlist-package.Rd               |  61 +++++++++++
 tests/test-all.R                      |   2 +
 tests/testthat/test-fail-well.R       |  38 +++++++
 tests/testthat/test-rl_citation.R     |  17 +++
 tests/testthat/test-rl_common_names.R |  62 +++++++++++
 tests/testthat/test-rl_countries.R    |  45 ++++++++
 tests/testthat/test-rl_habitat.R      |  73 +++++++++++++
 tests/testthat/test-rl_history.R      |  95 +++++++++++++++++
 tests/testthat/test-rl_measures.R     |  73 +++++++++++++
 tests/testthat/test-rl_narrative.R    |  73 +++++++++++++
 tests/testthat/test-rl_search.R       |  73 +++++++++++++
 tests/testthat/test-rl_sp_category.R  |  71 +++++++++++++
 tests/testthat/test-rl_synonyms.R     |  70 +++++++++++++
 tests/testthat/test-rl_threats.R      |  74 +++++++++++++
 tests/testthat/test-rl_version.R      |  16 +++
 70 files changed, 2527 insertions(+), 127 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..000535d
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,21 @@
+Package: rredlist
+Type: Package
+Title: 'IUCN' Red List Client
+Description: 'IUCN' Red List (<http://apiv3.iucnredlist.org/api/v3/docs>) client.
+    The 'IUCN' Red List is a global list of threatened and endangered species.
+    Functions cover all of the Red List 'API' routes. An 'API' key is required.
+Version: 0.3.0
+Authors at R: c(person("Scott", "Chamberlain", role = c("aut", "cre"),
+    email = "myrmecocystus at gmail.com"))
+License: MIT + file LICENSE
+URL: https://github.com/ropensci/rredlist
+BugReports: https://github.com/ropensci/rredlist/issues
+Imports: crul (>= 0.2.0), jsonlite (>= 1.1)
+Suggests: roxygen2 (>= 5.0.1), testthat, covr
+RoxygenNote: 5.0.1
+NeedsCompilation: no
+Packaged: 2017-01-11 23:51:12 UTC; sacmac
+Author: Scott Chamberlain [aut, cre]
+Maintainer: Scott Chamberlain <myrmecocystus at gmail.com>
+Repository: CRAN
+Date/Publication: 2017-01-12 00:56:40
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..37ee2c7
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,2 @@
+YEAR: 2017
+COPYRIGHT HOLDER: Scott Chamberlain
diff --git a/MD5 b/MD5
new file mode 100644
index 0000000..747e31f
--- /dev/null
+++ b/MD5
@@ -0,0 +1,58 @@
+cb1e39f6b3044eed690788c8e7d3cd60 *DESCRIPTION
+c5af52351472a750055a760a8924ce71 *LICENSE
+ff723542b5c3070258f677b2f725713c *NAMESPACE
+2fd3a8e5d6f33f7abce7cc7603b876dd *NEWS.md
+ce32725fe606af64fe6052cbb0d1ecc1 *R/rl_citation.R
+4d03043dbdfb18f7df49d7b66fb012c2 *R/rl_common_names.R
+3e9ee7bbf9c366ef2eba84e3f43f490e *R/rl_countries.R
+385cccf373842340f4a06c221f8f6d9e *R/rl_habitats.R
+bca4e44fdaeb609d55c9344090bc0f79 *R/rl_history.R
+78329f449a6d8ce5df2650dbaac603fc *R/rl_measures.R
+f03a75e3c552984146142c51294de1f1 *R/rl_narrative.R
+04df21e1d25bfeae38e15d9a490d66c0 *R/rl_occ_country.R
+c92f5de0c1e924576b0d5e9dc5aadf1f *R/rl_regions.R
+5204716f15da7732fd8ee2081ab561f7 *R/rl_search.R
+f0f3d026aef0af0acc8fc7e250ca1919 *R/rl_sp.R
+dbf3fff38117305b4b2f45a5f90a26ad *R/rl_sp_category.R
+5aeefc7b42f3f3696af5a0844aace09a *R/rl_sp_citation.R
+8931335e5885da2336a9dd7d29af6a05 *R/rl_sp_count.R
+f5f82ad24a26dfbfb647d6a5af6358db *R/rl_sp_country.R
+9e5f3741f4acb5037d5244e5b0a1993c *R/rl_synonyms.R
+663ea092a2172aec93f0b3bb9d37f872 *R/rl_threats.R
+a4d29a3516c6929f111d1c36983fad9f *R/rl_version.R
+ef02c86911621110451ea27fc26fda12 *R/rredlist-package.R
+a0f098fb4d50eb2c8cf03456ad788ea8 *R/zzz.R
+0750e57e4470a4c3ffd799d82bb16a15 *README.md
+ede7821f1a8a457d414ea79654c90a8f *man/rl_citation.Rd
+6986e6cf34fadb9c374045cb2c2d0bf8 *man/rl_common_names.Rd
+22b2b24a2bbd9e5822bba442f2cb8e9d *man/rl_countries.Rd
+c79d6c1d19d71f653193d4da0b39617a *man/rl_habitats.Rd
+9a3a3b3156bf0efbdfca7b5c02853c3d *man/rl_history.Rd
+5a26ed325904e2f62cb85d0bd157672f *man/rl_measures.Rd
+a45c4eb3b852b7ca022d6eb7b5ca6ec0 *man/rl_narrative.Rd
+a1a3b7289bd808cc69486fe093aff6e0 *man/rl_occ_country.Rd
+b6a8944bb1cf6a584a6f631516e7276b *man/rl_regions.Rd
+5bb413b5e04f3f685c8dc1f8482423b3 *man/rl_search.Rd
+1bcdc04856545ff56f080245a9aa409e *man/rl_sp.Rd
+f3aba94d22bbd71771a833b3608135fd *man/rl_sp_category.Rd
+5c1cf39fe7a1ac4c9e857d77b28e006b *man/rl_sp_citation.Rd
+bac3a67f68bc627c6f122747e21e60cb *man/rl_sp_count.Rd
+bf2f67f965c52919e95ca02d700f2061 *man/rl_sp_country.Rd
+1a4dd8be89d363b2e4fb1a5a7690e5bb *man/rl_synonyms.Rd
+58c9e2f9babe9693aebc12aa0b64fb40 *man/rl_threats.Rd
+bdada92086ec57156b210a8d43371286 *man/rl_version.Rd
+ac481a4b0ea113e8ed2c7a12eabc2291 *man/rredlist-package.Rd
+d5da941c797771d510f5e8d756e73c76 *tests/test-all.R
+4deb56bf7c6d214fd61a249f690bc6bd *tests/testthat/test-fail-well.R
+74f99661ed270bc8be62cb31640d3233 *tests/testthat/test-rl_citation.R
+073723ef23fd7b9da35d5debc99c47bf *tests/testthat/test-rl_common_names.R
+2f5902b110cb8d7bad1e5ac8ade393e1 *tests/testthat/test-rl_countries.R
+e725c2925af46e5957b209983fae6c13 *tests/testthat/test-rl_habitat.R
+e0f8497d8988f0ef158cd7ab03c659f9 *tests/testthat/test-rl_history.R
+40233433d18aa2e53b3ebeb58e50d08c *tests/testthat/test-rl_measures.R
+82c49d673b55d8911f25da7b633e0c9b *tests/testthat/test-rl_narrative.R
+4a0a83aad1b4469fcd759c2c2b7d1789 *tests/testthat/test-rl_search.R
+8b5229bd070fe858d50e977fc169db18 *tests/testthat/test-rl_sp_category.R
+08a3a9058c003424f438c0e748a10840 *tests/testthat/test-rl_synonyms.R
+ebff0bbc04c482f36d03412954605e16 *tests/testthat/test-rl_threats.R
+7ac666ffbdd356dfee2e3c3d1b72b34d *tests/testthat/test-rl_version.R
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..e56e1a3
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,37 @@
+# Generated by roxygen2: do not edit by hand
+
+export(rl_citation)
+export(rl_common_names)
+export(rl_common_names_)
+export(rl_countries)
+export(rl_countries_)
+export(rl_habitats)
+export(rl_habitats_)
+export(rl_history)
+export(rl_history_)
+export(rl_measures)
+export(rl_measures_)
+export(rl_narrative)
+export(rl_narrative_)
+export(rl_occ_country)
+export(rl_occ_country_)
+export(rl_regions)
+export(rl_regions_)
+export(rl_search)
+export(rl_search_)
+export(rl_sp)
+export(rl_sp_)
+export(rl_sp_category)
+export(rl_sp_category_)
+export(rl_sp_citation)
+export(rl_sp_citation_)
+export(rl_sp_count)
+export(rl_sp_count_)
+export(rl_sp_country)
+export(rl_sp_country_)
+export(rl_synonyms)
+export(rl_synonyms_)
+export(rl_threats)
+export(rl_threats_)
+export(rl_version)
+importFrom(jsonlite,fromJSON)
diff --git a/NEWS.md b/NEWS.md
new file mode 100644
index 0000000..324b75f
--- /dev/null
+++ b/NEWS.md
@@ -0,0 +1,55 @@
+rredlist 0.3.0
+==============
+
+### NEW FEATURES
+
+* New functions `rl_occ_country` and `rl_occ_country_` for 
+getting country occurrences by species name or ID (#13)
+* Replaced `httr` with `crul`. Please note this only affects use 
+of curl options. See `crul` docs for how to use curl options (#14)
+
+### MINOR IMPROVEMENTS
+
+* User agent string like `r-curl/2.3 crul/0.2.0 rOpenSci(rredlist/0.3.0)` 
+sent in all requests now to help IUCN API maintainers know 
+how often requests come from R and this package (#19)
+* Taxon names are now given back in `rl_threats` - we didn't do 
+anything in the package - the API now gives the names back and 
+adds them in a column (#10)
+* Type checking all parameter inputs now both in terms of class
+and length - with helpful error messages on fail (#17)
+* Simplify package codebase by having single internal function for a 
+suite of half a dozen or so functions that have similar pattern (#18)
+* Removed `key` parameter from `rl_version()` and `rl_citation()` as
+API key not required for those methods
+* More thorough test suite
+
+
+rredlist 0.2.0
+==============
+
+### NEW FEATURES
+
+* New methods added to get historical assessments: `rl_history()`
+and `rl_history_()` (#8)
+
+### MINOR IMPROVEMENTS
+
+* Fixed description of what `rl_common_names` does. In addition, 
+clarified descriptino of what other functions do as well, whenever
+it was unclear (#12)
+
+### BUG FIXES
+
+* Some API tokens were being blocked, fixed now (#7)
+* On some operating systems (at least some versions of Windows), queries 
+that included taxonomic names weren't being processed correctly. It 
+is fixed now (#11)
+
+
+rredlist 0.1.0
+==============
+
+### NEW FEATURES
+
+* Released to CRAN.
diff --git a/R/rl_citation.R b/R/rl_citation.R
new file mode 100644
index 0000000..405342e
--- /dev/null
+++ b/R/rl_citation.R
@@ -0,0 +1,12 @@
+#' Get the citation Red List API version
+#'
+#' @export
+#' @param ... Curl options passed to \code{\link[crul]{HttpClient}}
+#' @return API citation as character string
+#' @examples \dontrun{
+#' rl_citation()
+#' }
+rl_citation <- function(...) {
+  sprintf('IUCN 2015. IUCN Red List of Threatened Species. Version %s <www.iucnredlist.org>',
+          rl_version(...))
+}
diff --git a/R/rl_common_names.R b/R/rl_common_names.R
new file mode 100644
index 0000000..ba213ba
--- /dev/null
+++ b/R/rl_common_names.R
@@ -0,0 +1,23 @@
+#' Get common names for a given taxonomic name
+#'
+#' @export
+#' @param name (character) Binomial taxonomic name
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_common_names('Loxodonta africana')
+#' rl_common_names_('Loxodonta africana')
+#' }
+rl_common_names <- function(name = NULL, key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_common_names_(name, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_common_names
+rl_common_names_ <- function(name = NULL, key = NULL, ...) {
+  assert_is(key, 'character')
+  assert_is(name, 'character')
+  assert_n(name, 1)
+  rr_GET(file.path("species/common_names", space(name)), key, ...)
+}
diff --git a/R/rl_countries.R b/R/rl_countries.R
new file mode 100644
index 0000000..fd04b35
--- /dev/null
+++ b/R/rl_countries.R
@@ -0,0 +1,20 @@
+#' Get countries
+#'
+#' @export
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_countries()
+#' rl_countries_()
+#' }
+rl_countries <- function(key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_countries_(key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_countries
+rl_countries_ <- function(key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET("country/list", key, ...)
+}
diff --git a/R/rl_habitats.R b/R/rl_habitats.R
new file mode 100644
index 0000000..a4fb5be
--- /dev/null
+++ b/R/rl_habitats.R
@@ -0,0 +1,29 @@
+#' Get species habitats by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_habitats('Fratercula arctica')
+#' rl_habitats('Fratercula arctica', region = 'europe')
+#' rl_habitats(id = 12392)
+#' rl_habitats(id = 22694927, region = 'europe')
+#'
+#' rl_habitats_('Fratercula arctica')
+#' rl_habitats_(id = 12392)
+#' }
+rl_habitats <- function(name = NULL, id = NULL, region = NULL, key = NULL,
+                        parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_habitats_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_habitats
+rl_habitats_ <- function(name = NULL, id = NULL, region = NULL,
+                         key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("habitats/species/name", "habitats/species/id",
+         name, id, region), key, ...)
+}
diff --git a/R/rl_history.R b/R/rl_history.R
new file mode 100644
index 0000000..1f8e0d6
--- /dev/null
+++ b/R/rl_history.R
@@ -0,0 +1,29 @@
+#' Get historical assessments by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_history('Loxodonta africana')
+#' rl_history('Ursus maritimus', region = 'europe')
+#' rl_history(id = 12392)
+#' rl_history(id = 22823, region = 'europe')
+#'
+#' rl_history_('Loxodonta africana')
+#' rl_history_(id = 12392)
+#' }
+rl_history <- function(name = NULL, id = NULL, region = NULL,
+                       key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_history_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_habitats
+rl_history_ <- function(name = NULL, id = NULL, region = NULL,
+                        key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("species/history/name", "species/history/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_measures.R b/R/rl_measures.R
new file mode 100644
index 0000000..04726db
--- /dev/null
+++ b/R/rl_measures.R
@@ -0,0 +1,29 @@
+#' Get species conservation measures by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_measures('Fratercula arctica')
+#' rl_measures('Fratercula arctica', region = 'europe')
+#' rl_measures(id = 12392)
+#' rl_measures(id = 22694927, region = 'europe')
+#'
+#' rl_measures_('Fratercula arctica')
+#' rl_measures_(id = 22694927, region = 'europe')
+#' }
+rl_measures <- function(name = NULL, id = NULL, region = NULL,
+                        key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_measures_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_measures
+rl_measures_ <- function(name = NULL, id = NULL, region = NULL,
+                         key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("measures/species/name", "measures/species/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_narrative.R b/R/rl_narrative.R
new file mode 100644
index 0000000..565b404
--- /dev/null
+++ b/R/rl_narrative.R
@@ -0,0 +1,29 @@
+#' Get species narrative information by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_narrative('Fratercula arctica')
+#' rl_narrative('Fratercula arctica', region = 'europe')
+#' rl_narrative(id = 12392)
+#' rl_narrative(id = 22694927, region = 'europe')
+#'
+#' rl_narrative_('Fratercula arctica')
+#' rl_narrative_('Fratercula arctica', region = 'europe')
+#' }
+rl_narrative <- function(name = NULL, id = NULL, region = NULL,
+                         key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_narrative_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_narrative
+rl_narrative_ <- function(name = NULL, id = NULL, region = NULL,
+                          key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("species/narrative", "species/narrative/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_occ_country.R b/R/rl_occ_country.R
new file mode 100644
index 0000000..28f1296
--- /dev/null
+++ b/R/rl_occ_country.R
@@ -0,0 +1,30 @@
+#' Get country occurrence by species name or ID
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_occ_country('Loxodonta africana')
+#' rl_occ_country('Fratercula arctica', region = 'europe')
+#' rl_occ_country(id = 12392)
+#' rl_occ_country(id = 22694927, region = 'europe')
+#'
+#' rl_occ_country('Fratercula arctica', parse = FALSE)
+#' rl_occ_country_('Fratercula arctica')
+#' rl_occ_country_('Fratercula arctica', region = 'europe')
+#' }
+rl_occ_country <- function(name = NULL, id = NULL, region = NULL,
+                           key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_occ_country_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_search
+rl_occ_country_ <- function(name = NULL, id = NULL, region = NULL,
+                            key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("species/countries/name", "species/countries/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_regions.R b/R/rl_regions.R
new file mode 100644
index 0000000..a696503
--- /dev/null
+++ b/R/rl_regions.R
@@ -0,0 +1,21 @@
+#' Get regions
+#'
+#' @export
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_regions()
+#' rl_regions(parse = FALSE)
+#' rl_regions_()
+#' }
+rl_regions <- function(key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_regions_(key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_regions
+rl_regions_ <- function(key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET("region/list", key, ...)
+}
diff --git a/R/rl_search.R b/R/rl_search.R
new file mode 100644
index 0000000..b55a5b3
--- /dev/null
+++ b/R/rl_search.R
@@ -0,0 +1,30 @@
+#' Search by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_search('Fratercula arctica')
+#' rl_search('Fratercula arctica', region = 'europe')
+#' rl_search(id = 12392)
+#' rl_search(id = 22694927, region = 'europe')
+#'
+#' rl_search('Fratercula arctica', parse = FALSE)
+#' rl_search_('Fratercula arctica')
+#' rl_search_('Fratercula arctica', region = 'europe')
+#' }
+rl_search <- function(name = NULL, id = NULL, region = NULL,
+                      key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_search_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_search
+rl_search_ <- function(name = NULL, id = NULL, region = NULL,
+                       key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("species", "species/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_sp.R b/R/rl_sp.R
new file mode 100644
index 0000000..8f26d24
--- /dev/null
+++ b/R/rl_sp.R
@@ -0,0 +1,21 @@
+#' Get species
+#'
+#' @export
+#' @param page (integer/numeric) Page to get. Default: 1
+#' @template all
+#' @examples \dontrun{
+#' rl_sp(page = 3)
+#' }
+rl_sp <- function(page, key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_sp_(page, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_sp
+rl_sp_ <- function(page, key = NULL, ...) {
+  assert_is(key, 'character')
+  assert_is(page, c('integer', 'numeric'))
+  assert_n(page, 1)
+  rr_GET(file.path("species/page", page), key, ...)
+}
diff --git a/R/rl_sp_category.R b/R/rl_sp_category.R
new file mode 100644
index 0000000..5239635
--- /dev/null
+++ b/R/rl_sp_category.R
@@ -0,0 +1,25 @@
+#' Get species by category
+#'
+#' @export
+#' @param category (character) 2 letter category code
+#' @template all
+#' @examples \dontrun{
+#' rl_sp_category('VU')
+#' rl_sp_category('EN')
+#' rl_sp_category('EX')
+#' rl_sp_category('EX', parse = FALSE)
+#' rl_sp_category_('EX')
+#' }
+rl_sp_category <- function(category, key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_sp_category_(category, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_sp_category
+rl_sp_category_ <- function(category, key = NULL, parse = TRUE, ...) {
+  assert_is(key, 'character')
+  assert_is(category, 'character')
+  assert_n(category, 1)
+  rr_GET(file.path("species/category", category), key, ...)
+}
diff --git a/R/rl_sp_citation.R b/R/rl_sp_citation.R
new file mode 100644
index 0000000..02983bc
--- /dev/null
+++ b/R/rl_sp_citation.R
@@ -0,0 +1,29 @@
+#' Get citations by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_sp_citation('Balaena mysticetus')
+#' rl_sp_citation('Balaena mysticetus', region = 'europe')
+#' rl_sp_citation(id = 12392)
+#'
+#' rl_sp_citation(id = 2467, region = 'europe')
+#' rl_sp_citation(id = 2467, region = 'europe', parse = FALSE)
+#' rl_sp_citation_(id = 2467, region = 'europe')
+#' }
+rl_sp_citation <- function(name = NULL, id = NULL, region = NULL,
+                           key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_sp_citation_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_sp_citation
+rl_sp_citation_ <- function(name = NULL, id = NULL, region = NULL,
+                            key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("species/citation", "species/citation/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_sp_count.R b/R/rl_sp_count.R
new file mode 100644
index 0000000..5438c46
--- /dev/null
+++ b/R/rl_sp_count.R
@@ -0,0 +1,20 @@
+#' Get total species count of taxa in the Red List
+#'
+#' @export
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_sp_count()
+#' rl_sp_count_()
+#' }
+rl_sp_count <- function(key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_sp_count_(key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_sp_count
+rl_sp_count_ <- function(key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET("speciescount", key, ...)
+}
diff --git a/R/rl_sp_country.R b/R/rl_sp_country.R
new file mode 100644
index 0000000..0ac18e5
--- /dev/null
+++ b/R/rl_sp_country.R
@@ -0,0 +1,31 @@
+#' Get species by country
+#'
+#' @export
+#' @param country (character) Country 2 letter character code
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_sp_country('AZ')
+#' rl_sp_country('NZ')
+#'
+#' # don't parse to data.frame, gives list
+#' rl_sp_country('NZ', parse = FALSE)
+#' # don't parse at all, get json back
+#' rl_sp_country_('NZ')
+#'
+#' # curl options
+#' res <- rl_sp_country('NZ', verbose = TRUE)
+#' }
+rl_sp_country <- function(country, key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_sp_country_(country, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_sp_country
+rl_sp_country_ <- function(country, key = NULL, ...) {
+  assert_is(key, 'character')
+  assert_is(country, 'character')
+  assert_n(country, 1)
+  rr_GET(file.path("country/getspecies", country), key, ...)
+}
diff --git a/R/rl_synonyms.R b/R/rl_synonyms.R
new file mode 100644
index 0000000..3309beb
--- /dev/null
+++ b/R/rl_synonyms.R
@@ -0,0 +1,24 @@
+#' Get species synonym information by taxonomic name
+#'
+#' @export
+#' @param name (character) Binomial taxonomic name
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_synonyms('Loxodonta africana')
+#' rl_synonyms('Loxodonta africana', parse = FALSE)
+#' rl_synonyms_('Loxodonta africana')
+#' }
+rl_synonyms <- function(name = NULL, key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_synonyms_(name, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_synonyms
+rl_synonyms_ <- function(name = NULL, key = NULL, ...) {
+  assert_is(key, 'character')
+  assert_is(name, 'character')
+  assert_n(name, 1)
+  rr_GET(file.path("species/synonym", space(name)), key, ...)
+}
diff --git a/R/rl_threats.R b/R/rl_threats.R
new file mode 100644
index 0000000..ba2fe96
--- /dev/null
+++ b/R/rl_threats.R
@@ -0,0 +1,29 @@
+#' Get species threats by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_threats('Fratercula arctica')
+#' rl_threats('Fratercula arctica', region = 'europe')
+#' rl_threats(id = 12392)
+#' rl_threats(id = 22694927, region = 'europe')
+#' rl_threats_('Fratercula arctica')
+#'
+#' rl_threats(id = 62290750)
+#' }
+rl_threats <- function(name = NULL, id = NULL, region = NULL, key = NULL,
+                       parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_threats_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_threats
+rl_threats_ <- function(name = NULL, id = NULL, region = NULL,
+                        key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("threats/species/name", "threats/species/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_version.R b/R/rl_version.R
new file mode 100644
index 0000000..d9c7ea7
--- /dev/null
+++ b/R/rl_version.R
@@ -0,0 +1,11 @@
+#' Get the Red List API version
+#'
+#' @export
+#' @param ... Curl options passed to \code{\link[crul]{HttpClient}}
+#' @return API version as character string
+#' @examples \dontrun{
+#' rl_version()
+#' }
+rl_version <- function(...) {
+  rl_parse(rr_GET("version", NULL, ...), TRUE)$version
+}
diff --git a/R/rredlist-package.R b/R/rredlist-package.R
new file mode 100644
index 0000000..7acd9e4
--- /dev/null
+++ b/R/rredlist-package.R
@@ -0,0 +1,46 @@
+#' rredlist - IUCN Red List Client
+#'
+#' @section Authentication:
+#' IUCN requires you to get your own API key, an alphanumeric string that you
+#' need to send in every request. Get it at
+#' \url{http://apiv3.iucnredlist.org/api/v3/token}.
+#' Keep this key private. You can pass the key in to each function via the
+#' \code{key} parameter, but it's better to store the key either as a
+#' environment variable (\code{IUCN_REDLIST_KEY}) or an R option
+#' (\code{iucn_redlist_key}) - we suggest using the former option.
+#'
+#' @section High vs. Low level package APIs:
+#' \strong{High level API}
+#' High level functions do the HTTP request and parse data to a data.frame for
+#' ease of downstream use. The high level functions have no underscore on
+#' the end of the function name, e.g., \code{\link{rl_search}}
+#'
+#' \strong{Low level API}
+#' The parsing to data.frame in the high level API does take extra time.
+#' The low level API only does the HTTP request, and gives back JSON without
+#' doing any more parsing. The low level functions DO have an underscore on
+#' the end of the function name, e.g., \code{\link{rl_search_}}
+#'
+#' @section No Spatial:
+#' This package does not include support for the spatial API, described at
+#' \url{http://apiv3.iucnredlist.org/spatial}
+#'
+#' @section Citing the Red List API:
+#' The citation is
+#' \code{IUCN 2015. IUCN Red List of Threatened Species. Version 2015-4 <www.iucnredlist.org>}.
+#' You can get this programatically via \code{\link{rl_citation}}
+#'
+#' @section Rate limiting:
+#' From the IUCN folks: Too many frequent calls, or too many calls per day
+#' might get your access blocked temporarily. If you're a heavy API user, the
+#' Red List Unit asked that you contact them, as there might be better options.
+#' They suggest a 2-second delay between your calls if you plan to make a
+#' lot of calls.
+#'
+#' @importFrom jsonlite fromJSON
+#' @name rredlist-package
+#' @aliases rredlist
+#' @docType package
+#' @author Scott Chamberlain \email{myrmecocystus@@gmail.com}
+#' @keywords package
+NULL
diff --git a/R/zzz.R b/R/zzz.R
new file mode 100644
index 0000000..235f586
--- /dev/null
+++ b/R/zzz.R
@@ -0,0 +1,93 @@
+ct <- function(l) Filter(Negate(is.null), l)
+
+rredlist_ua <- function() {
+  versions <- c(
+    paste0("r-curl/", utils::packageVersion("curl")),
+    paste0("crul/", utils::packageVersion("crul")),
+    sprintf("rOpenSci(rredlist/%s)", utils::packageVersion("rredlist"))
+  )
+  paste0(versions, collapse = " ")
+}
+
+rr_GET <- function(path, key, ...){
+  cli <- crul::HttpClient$new(
+    url = file.path(rr_base(), path),
+    opts = list(useragent = rredlist_ua())
+  )
+  temp <- cli$get(query = list(token = check_key(key)), ...)
+  temp$raise_for_status()
+  x <- temp$parse("UTF-8")
+  err_catcher(x)
+  return(x)
+}
+
+err_catcher <- function(x) {
+  xx <- jsonlite::fromJSON(x)
+  if (any(vapply(c("message", "error"), function(z) z %in% names(xx),
+                 logical(1)))) {
+    stop(xx[[1]], call. = FALSE)
+  }
+}
+
+rl_parse <- function(x, parse) {
+  jsonlite::fromJSON(x, parse)
+}
+
+check_key <- function(x){
+  tmp <- if (is.null(x)) Sys.getenv("IUCN_REDLIST_KEY", "") else x
+  if (tmp == "") {
+    getOption("iucn_redlist_key", stop("need an API key for Red List data",
+                                       call. = FALSE))
+  } else {
+    tmp
+  }
+}
+
+rr_base <- function() "http://apiv3.iucnredlist.org/api/v3"
+
+space <- function(x) gsub("\\s", "%20", x)
+
+assert_is <- function(x, y) {
+  if (!is.null(x)) {
+    if (!class(x) %in% y) {
+      stop(deparse(substitute(x)), " must be of class ",
+           paste0(y, collapse = ", "), call. = FALSE)
+    }
+  }
+}
+
+assert_n <- function(x, n) {
+  if (!is.null(x)) {
+    if (!length(x) == n) {
+      stop(deparse(substitute(x)), " must be length ", n, call. = FALSE)
+    }
+  }
+}
+
+nir <- function(path_name, path_id, name = NULL, id = NULL, region = NULL) {
+
+  # only one of name OR id
+  stopifnot(xor(!is.null(name), !is.null(id)))
+
+  # check types
+  assert_is(name, 'character')
+  assert_is(id, c('integer', 'numeric'))
+  assert_is(region, 'character')
+
+  # check lengths - only length 1 allowed for all
+  assert_n(name, 1)
+  assert_n(id, 1)
+  assert_n(region, 1)
+
+  # construct path
+  path <- if (!is.null(name)) {
+    file.path(path_name, space(name))
+  } else {
+    file.path(path_id, id)
+  }
+  if (!is.null(region)) {
+    path <- file.path(path, "region", space(region))
+  }
+
+  return(path)
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7e34e04
--- /dev/null
+++ b/README.md
@@ -0,0 +1,188 @@
+rredlist
+========
+
+
+
+[![Build Status](https://travis-ci.org/ropensci/rredlist.svg?branch=master)](https://travis-ci.org/ropensci/rredlist)
+[![codecov.io](https://codecov.io/github/ropensci/rredlist/coverage.svg?branch=master)](https://codecov.io/github/ropensci/rredlist?branch=master)
+[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/rredlist)](https://github.com/metacran/cranlogs.app)
+[![cran version](http://www.r-pkg.org/badges/version/rredlist)](https://cran.r-project.org/package=rredlist)
+
+[IUCN Red List docs][docs]
+
+## Authentication
+
+IUCN requires you to get your own API key, an alphanumeric string that you
+need to send in every request. Get it at <http://apiv3.iucnredlist.org/api/v3/token>.
+Keep this key private. You can pass the key in to each function via the
+`key` parameter, but it's better to store the key either as a environment
+variable (`IUCN_REDLIST_KEY`) or an R option (`iucn_redlist_key`) - we
+suggest using the former option.
+
+## High vs. Low level package APIs
+
+__High level API__
+
+High level functions do the HTTP request and parse data to a data.frame for
+ease of downstream use. The high level functions have no underscore on the end
+of the function name, e.g., `rl_search`
+
+__Low level API__
+
+The parsing to data.frame in the high level API does take extra time. The low
+level API only does the HTTP request, and gives back JSON without doing any
+more parsing. The low level functions DO have an underscore on the end
+of the function name, e.g., `rl_search_`
+
+## No Spatial
+
+This package does not include support for the spatial API, described at
+[http://apiv3.iucnredlist.org/spatial][spatial].
+
+## Citing IUCN API
+
+use the function `rl_citation()`
+
+
+```r
+rl_citation()
+#> [1] "IUCN 2015. IUCN Red List of Threatened Species. Version 2016-3 <www.iucnredlist.org>"
+```
+
+
+## Install
+
+CRAN
+
+
+```r
+install.packages("rredlist")
+```
+
+Development version
+
+
+```r
+devtools::install_github("ropensci/rredlist")
+```
+
+
+```r
+library("rredlist")
+```
+
+## High level API
+
+High level functions do the HTTP request and parse to data to a data.frame for ease
+of downstream use.
+
+
+```r
+rl_search('Fratercula arctica')
+#> $name
+#> [1] "Fratercula arctica"
+#> 
+#> $result
+#>    taxonid    scientific_name  kingdom   phylum class           order
+#> 1 22694927 Fratercula arctica ANIMALIA CHORDATA  AVES CHARADRIIFORMES
+#>    family      genus main_common_name        authority published_year
+#> 1 ALCIDAE Fratercula  Atlantic Puffin (Linnaeus, 1758)           2016
+#>   category criteria marine_system freshwater_system terrestrial_system
+#> 1       VU  A4abcde          TRUE             FALSE               TRUE
+#>                 assessor                 reviewer aoo_km2  eoo_km2
+#> 1 BirdLife International Butchart, S. & Symes, A.      NA 20800000
+#>   errata_flag errata_reason
+#> 1       FALSE            NA
+```
+
+Likely a bit faster is to parse to a list only, and not take the extra data.frame parsing time
+
+
+```r
+rl_search('Fratercula arctica', parse = FALSE)
+#> $name
+#> [1] "Fratercula arctica"
+#> 
+#> $result
+#> $result[[1]]
+#> $result[[1]]$taxonid
+#> [1] 22694927
+#> 
+#> $result[[1]]$scientific_name
+#> [1] "Fratercula arctica"
+...
+```
+
+## Low level API
+
+The parsing to data.frame in the high level API does take extra time. The low level API
+only does the HTTP request, and gives back JSON without doing any more parsing
+
+
+```r
+rl_search_('Fratercula arctica')
+#> [1] "{\"name\":\"Fratercula arctica\",\"result\":[{\"taxonid\":22694927,\"scientific_name\":\"Fratercula arctica\",\"kingdom\":\"ANIMALIA\",\"phylum\":\"CHORDATA\",\"class\":\"AVES\",\"order\":\"CHARADRIIFORMES\",\"family\":\"ALCIDAE\",\"genus\":\"Fratercula\",\"main_common_name\":\"Atlantic Puffin\",\"authority\":\"(Linnaeus, 1758)\",\"published_year\":2016,\"category\":\"VU\",\"criteria\":\"A4abcde\",\"marine_system\":true,\"freshwater_system\":false,\"terrestrial_system\":true,\"as [...]
+```
+
+To consume this JSON, you can use `jsonlite`
+
+
+```r
+library("jsonlite")
+jsonlite::fromJSON(rl_search_('Fratercula arctica'))
+#> $name
+#> [1] "Fratercula arctica"
+#> 
+#> $result
+#>    taxonid    scientific_name  kingdom   phylum class           order
+#> 1 22694927 Fratercula arctica ANIMALIA CHORDATA  AVES CHARADRIIFORMES
+#>    family      genus main_common_name        authority published_year
+#> 1 ALCIDAE Fratercula  Atlantic Puffin (Linnaeus, 1758)           2016
+#>   category criteria marine_system freshwater_system terrestrial_system
+#> 1       VU  A4abcde          TRUE             FALSE               TRUE
+#>                 assessor                 reviewer aoo_km2  eoo_km2
+#> 1 BirdLife International Butchart, S. & Symes, A.      NA 20800000
+#>   errata_flag errata_reason
+#> 1       FALSE            NA
+```
+
+Or other tools, e.g., `jq` via the `jqr` R client
+
+
+```r
+# devtools::install_github("ropensci/jqr")
+library("jqr")
+rl_search_('Fratercula arctica') %>% dot()
+#> {
+#>     "name": "Fratercula arctica",
+#>     "result": [
+#>         {
+#>             "taxonid": 22694927,
+#>             "scientific_name": "Fratercula arctica",
+#>             "kingdom": "ANIMALIA",
+#>             "phylum": "CHORDATA",
+#>             "class": "AVES",
+#>             "order": "CHARADRIIFORMES",
+#>             "family": "ALCIDAE",
+#>             "genus": "Fratercula",
+#>             "main_common_name": "Atlantic Puffin",
+#>             "authority": "(Linnaeus, 1758)",
+#>             "published_year": 2016,
+#>             "category": "VU",
+#>             "criteria": "A4abcde",
+#>             "marine_system": true,
+#>             "freshwater_system": false,
+#>             "terrestrial_system": true,
+...
+```
+
+## Meta
+
+* Please [report any issues or bugs](https://github.com/ropensci/rredlist/issues).
+* License: MIT
+* Get citation information for `rredlist` in R doing `citation(package = 'rredlist')`
+* Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
+
+[docs]: http://apiv3.iucnredlist.org/api/v3/docs
+[token]: http://apiv3.iucnredlist.org/api/v3/token
+[spatial]: http://apiv3.iucnredlist.org/spatial
diff --git a/debian/README.test b/debian/README.test
deleted file mode 100644
index 4fe93f7..0000000
--- a/debian/README.test
+++ /dev/null
@@ -1,9 +0,0 @@
-Notes on how this package can be tested.
-────────────────────────────────────────
-
-This package can be tested by running the provided test:
-
-cd tests
-LC_ALL=C R --no-save < test-all.R
-
-in order to confirm its integrity.
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index c9315ee..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,23 +0,0 @@
-r-cran-rredlist (0.3.0-1) unstable; urgency=medium
-
-  * New upstream version
-  * debhelper 10
-  * New Build-Depends: r-cran-crul
-
- -- Andreas Tille <tille at debian.org>  Sun, 25 Jun 2017 07:12:36 +0200
-
-r-cran-rredlist (0.2.0-1) unstable; urgency=medium
-
-  * New upstream version
-  * Convert to dh-r
-  * Canonical homepage for CRAN
-  * d/watch: version=4
-  * New versioned Build-Depends: r-cran-jsonlite (>= 1.1)
-
- -- Andreas Tille <tille at debian.org>  Wed, 16 Nov 2016 10:22:52 +0100
-
-r-cran-rredlist (0.1.0-1) unstable; urgency=low
-
-  * Initial release (Closes: #819296)
-
- -- Andreas Tille <tille at debian.org>  Sat, 26 Mar 2016 09:04:02 +0100
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index f599e28..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/debian/control b/debian/control
deleted file mode 100644
index 0eeb51a..0000000
--- a/debian/control
+++ /dev/null
@@ -1,32 +0,0 @@
-Source: r-cran-rredlist
-Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
-Section: gnu-r
-Priority: optional
-Build-Depends: debhelper (>= 10),
-               dh-r,
-               r-base-dev,
-               r-cran-jsonlite (>= 1.1),
-               r-cran-httr,
-               r-cran-crul
-Standards-Version: 3.9.8
-Vcs-Browser: https://anonscm.debian.org/viewvc/debian-med/trunk/packages/R/r-cran-rredlist/trunk/
-Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/R/r-cran-rredlist/trunk/
-Homepage: https://cran.r-project.org/package=rredlist
-
-Package: r-cran-rredlist
-Architecture: all
-Depends: ${misc:Depends},
-         ${R:Depends}
-Recommends: ${R:Recommends}
-Suggests: ${R:Suggests}
-Description: GNU R IUCN Red List Client
- The IUCN Red List is a global list of threatened and endangered
- species. This GNU R package provides an IUCN Red List client to the Red
- List API routines.
- .
- The IUCN Global Species Programme working with the IUCN Species Survival
- Commission (SSC) has been assessing the conservation status of species,
- subspecies, varieties, and even selected subpopulations on a global
- scale for the past 50 years in order to highlight taxa threatened with
- extinction, and thereby promote their conservation.
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index df2f76b..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,32 +0,0 @@
-Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Contact: Scott Chamberlain <myrmecocystus at gmail.com>
-Upstream-Name: rredlist
-Source: https://cran.r-project.org/package=rredlist
-
-Files: *
-Copyright: 2013-2016 Scott Chamberlain <myrmecocystus at gmail.com>
-License: MIT
-
-Files: debian/*
-Copyright: 2016 Andreas Tille <tille at debian.org>
-License: MIT
-
-License: MIT
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- .
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
- .
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 960011c..0000000
--- a/debian/docs
+++ /dev/null
@@ -1,3 +0,0 @@
-tests
-debian/README.test
-debian/tests/run-unit-test
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index ae86733..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/make -f
-
-%:
-	dh $@ --buildsystem R
-
-override_dh_install:
-	dh_install
-	find debian -name LICENSE -delete
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/debian/tests/control b/debian/tests/control
deleted file mode 100644
index b044b0c..0000000
--- a/debian/tests/control
+++ /dev/null
@@ -1,3 +0,0 @@
-Tests: run-unit-test
-Depends: @, r-cran-testthat
-Restrictions: allow-stderr
diff --git a/debian/tests/run-unit-test b/debian/tests/run-unit-test
deleted file mode 100644
index 7f2407c..0000000
--- a/debian/tests/run-unit-test
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh -e
-
-oname=rredlist
-pkg=r-cran-`echo $oname | tr [A-Z] [a-z]`
-
-if [ "$ADTTMP" = "" ] ; then
-  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
-fi
-cd $ADTTMP
-cp -a /usr/share/doc/${pkg}/tests/* $ADTTMP
-LC_ALL=C R --no-save < test-all.R
-rm -fr $ADTTMP/*
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index f0721f3..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,3 +0,0 @@
-version=4
-http://cran.r-project.org/src/contrib/rredlist_([-0-9\.]*).tar.gz
-
diff --git a/man/rl_citation.Rd b/man/rl_citation.Rd
new file mode 100644
index 0000000..7ab9081
--- /dev/null
+++ b/man/rl_citation.Rd
@@ -0,0 +1,23 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_citation.R
+\name{rl_citation}
+\alias{rl_citation}
+\title{Get the citation Red List API version}
+\usage{
+rl_citation(...)
+}
+\arguments{
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+API citation as character string
+}
+\description{
+Get the citation Red List API version
+}
+\examples{
+\dontrun{
+rl_citation()
+}
+}
+
diff --git a/man/rl_common_names.Rd b/man/rl_common_names.Rd
new file mode 100644
index 0000000..a633395
--- /dev/null
+++ b/man/rl_common_names.Rd
@@ -0,0 +1,39 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_common_names.R
+\name{rl_common_names}
+\alias{rl_common_names}
+\alias{rl_common_names_}
+\title{Get common names for a given taxonomic name}
+\usage{
+rl_common_names(name = NULL, key = NULL, parse = TRUE, ...)
+
+rl_common_names_(name = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get common names for a given taxonomic name
+}
+\examples{
+\dontrun{
+rl_common_names('Loxodonta africana')
+rl_common_names_('Loxodonta africana')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_countries.Rd b/man/rl_countries.Rd
new file mode 100644
index 0000000..0b46f4e
--- /dev/null
+++ b/man/rl_countries.Rd
@@ -0,0 +1,37 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_countries.R
+\name{rl_countries}
+\alias{rl_countries}
+\alias{rl_countries_}
+\title{Get countries}
+\usage{
+rl_countries(key = NULL, parse = TRUE, ...)
+
+rl_countries_(key = NULL, ...)
+}
+\arguments{
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get countries
+}
+\examples{
+\dontrun{
+rl_countries()
+rl_countries_()
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_habitats.Rd b/man/rl_habitats.Rd
new file mode 100644
index 0000000..f0422dc
--- /dev/null
+++ b/man/rl_habitats.Rd
@@ -0,0 +1,52 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_habitats.R, R/rl_history.R
+\name{rl_habitats}
+\alias{rl_habitats}
+\alias{rl_habitats_}
+\alias{rl_history_}
+\title{Get species habitats by taxon name, IUCN id, and region}
+\usage{
+rl_habitats(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_habitats_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+
+rl_history_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get species habitats by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_habitats('Fratercula arctica')
+rl_habitats('Fratercula arctica', region = 'europe')
+rl_habitats(id = 12392)
+rl_habitats(id = 22694927, region = 'europe')
+
+rl_habitats_('Fratercula arctica')
+rl_habitats_(id = 12392)
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_history.Rd b/man/rl_history.Rd
new file mode 100644
index 0000000..57acacd
--- /dev/null
+++ b/man/rl_history.Rd
@@ -0,0 +1,46 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_history.R
+\name{rl_history}
+\alias{rl_history}
+\title{Get historical assessments by taxon name, IUCN id, and region}
+\usage{
+rl_history(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get historical assessments by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_history('Loxodonta africana')
+rl_history('Ursus maritimus', region = 'europe')
+rl_history(id = 12392)
+rl_history(id = 22823, region = 'europe')
+
+rl_history_('Loxodonta africana')
+rl_history_(id = 12392)
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_measures.Rd b/man/rl_measures.Rd
new file mode 100644
index 0000000..ca3c855
--- /dev/null
+++ b/man/rl_measures.Rd
@@ -0,0 +1,49 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_measures.R
+\name{rl_measures}
+\alias{rl_measures}
+\alias{rl_measures_}
+\title{Get species conservation measures by taxon name, IUCN id, and region}
+\usage{
+rl_measures(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_measures_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get species conservation measures by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_measures('Fratercula arctica')
+rl_measures('Fratercula arctica', region = 'europe')
+rl_measures(id = 12392)
+rl_measures(id = 22694927, region = 'europe')
+
+rl_measures_('Fratercula arctica')
+rl_measures_(id = 22694927, region = 'europe')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_narrative.Rd b/man/rl_narrative.Rd
new file mode 100644
index 0000000..b84ef83
--- /dev/null
+++ b/man/rl_narrative.Rd
@@ -0,0 +1,49 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_narrative.R
+\name{rl_narrative}
+\alias{rl_narrative}
+\alias{rl_narrative_}
+\title{Get species narrative information by taxon name, IUCN id, and region}
+\usage{
+rl_narrative(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_narrative_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get species narrative information by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_narrative('Fratercula arctica')
+rl_narrative('Fratercula arctica', region = 'europe')
+rl_narrative(id = 12392)
+rl_narrative(id = 22694927, region = 'europe')
+
+rl_narrative_('Fratercula arctica')
+rl_narrative_('Fratercula arctica', region = 'europe')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_occ_country.Rd b/man/rl_occ_country.Rd
new file mode 100644
index 0000000..cddfaff
--- /dev/null
+++ b/man/rl_occ_country.Rd
@@ -0,0 +1,47 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_occ_country.R
+\name{rl_occ_country}
+\alias{rl_occ_country}
+\title{Get country occurrence by species name or ID}
+\usage{
+rl_occ_country(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get country occurrence by species name or ID
+}
+\examples{
+\dontrun{
+rl_occ_country('Loxodonta africana')
+rl_occ_country('Fratercula arctica', region = 'europe')
+rl_occ_country(id = 12392)
+rl_occ_country(id = 22694927, region = 'europe')
+
+rl_occ_country('Fratercula arctica', parse = FALSE)
+rl_occ_country_('Fratercula arctica')
+rl_occ_country_('Fratercula arctica', region = 'europe')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_regions.Rd b/man/rl_regions.Rd
new file mode 100644
index 0000000..d9b59cb
--- /dev/null
+++ b/man/rl_regions.Rd
@@ -0,0 +1,38 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_regions.R
+\name{rl_regions}
+\alias{rl_regions}
+\alias{rl_regions_}
+\title{Get regions}
+\usage{
+rl_regions(key = NULL, parse = TRUE, ...)
+
+rl_regions_(key = NULL, ...)
+}
+\arguments{
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get regions
+}
+\examples{
+\dontrun{
+rl_regions()
+rl_regions(parse = FALSE)
+rl_regions_()
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_search.Rd b/man/rl_search.Rd
new file mode 100644
index 0000000..271120f
--- /dev/null
+++ b/man/rl_search.Rd
@@ -0,0 +1,53 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_occ_country.R, R/rl_search.R
+\name{rl_occ_country_}
+\alias{rl_occ_country_}
+\alias{rl_search}
+\alias{rl_search_}
+\title{Search by taxon name, IUCN id, and region}
+\usage{
+rl_occ_country_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+
+rl_search(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_search_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Search by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_search('Fratercula arctica')
+rl_search('Fratercula arctica', region = 'europe')
+rl_search(id = 12392)
+rl_search(id = 22694927, region = 'europe')
+
+rl_search('Fratercula arctica', parse = FALSE)
+rl_search_('Fratercula arctica')
+rl_search_('Fratercula arctica', region = 'europe')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_sp.Rd b/man/rl_sp.Rd
new file mode 100644
index 0000000..6dd57f2
--- /dev/null
+++ b/man/rl_sp.Rd
@@ -0,0 +1,30 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_sp.R
+\name{rl_sp}
+\alias{rl_sp}
+\alias{rl_sp_}
+\title{Get species}
+\usage{
+rl_sp(page, key = NULL, parse = TRUE, ...)
+
+rl_sp_(page, key = NULL, ...)
+}
+\arguments{
+\item{page}{(integer/numeric) Page to get. Default: 1}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\description{
+Get species
+}
+\examples{
+\dontrun{
+rl_sp(page = 3)
+}
+}
+
diff --git a/man/rl_sp_category.Rd b/man/rl_sp_category.Rd
new file mode 100644
index 0000000..3169081
--- /dev/null
+++ b/man/rl_sp_category.Rd
@@ -0,0 +1,34 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_sp_category.R
+\name{rl_sp_category}
+\alias{rl_sp_category}
+\alias{rl_sp_category_}
+\title{Get species by category}
+\usage{
+rl_sp_category(category, key = NULL, parse = TRUE, ...)
+
+rl_sp_category_(category, key = NULL, parse = TRUE, ...)
+}
+\arguments{
+\item{category}{(character) 2 letter category code}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\description{
+Get species by category
+}
+\examples{
+\dontrun{
+rl_sp_category('VU')
+rl_sp_category('EN')
+rl_sp_category('EX')
+rl_sp_category('EX', parse = FALSE)
+rl_sp_category_('EX')
+}
+}
+
diff --git a/man/rl_sp_citation.Rd b/man/rl_sp_citation.Rd
new file mode 100644
index 0000000..a6b32a8
--- /dev/null
+++ b/man/rl_sp_citation.Rd
@@ -0,0 +1,49 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_sp_citation.R
+\name{rl_sp_citation}
+\alias{rl_sp_citation}
+\alias{rl_sp_citation_}
+\title{Get citations by taxon name, IUCN id, and region}
+\usage{
+rl_sp_citation(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_sp_citation_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get citations by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_sp_citation('Balaena mysticetus')
+rl_sp_citation('Balaena mysticetus', region = 'europe')
+rl_sp_citation(id = 12392)
+
+rl_sp_citation(id = 2467, region = 'europe')
+rl_sp_citation(id = 2467, region = 'europe', parse = FALSE)
+rl_sp_citation_(id = 2467, region = 'europe')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_sp_count.Rd b/man/rl_sp_count.Rd
new file mode 100644
index 0000000..7f01858
--- /dev/null
+++ b/man/rl_sp_count.Rd
@@ -0,0 +1,37 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_sp_count.R
+\name{rl_sp_count}
+\alias{rl_sp_count}
+\alias{rl_sp_count_}
+\title{Get total species count of taxa in the Red List}
+\usage{
+rl_sp_count(key = NULL, parse = TRUE, ...)
+
+rl_sp_count_(key = NULL, ...)
+}
+\arguments{
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get total species count of taxa in the Red List
+}
+\examples{
+\dontrun{
+rl_sp_count()
+rl_sp_count_()
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_sp_country.Rd b/man/rl_sp_country.Rd
new file mode 100644
index 0000000..e0a194a
--- /dev/null
+++ b/man/rl_sp_country.Rd
@@ -0,0 +1,47 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_sp_country.R
+\name{rl_sp_country}
+\alias{rl_sp_country}
+\alias{rl_sp_country_}
+\title{Get species by country}
+\usage{
+rl_sp_country(country, key = NULL, parse = TRUE, ...)
+
+rl_sp_country_(country, key = NULL, ...)
+}
+\arguments{
+\item{country}{(character) Country 2 letter character code}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get species by country
+}
+\examples{
+\dontrun{
+rl_sp_country('AZ')
+rl_sp_country('NZ')
+
+# don't parse to data.frame, gives list
+rl_sp_country('NZ', parse = FALSE)
+# don't parse at all, get json back
+rl_sp_country_('NZ')
+
+# curl options
+res <- rl_sp_country('NZ', verbose = TRUE)
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_synonyms.Rd b/man/rl_synonyms.Rd
new file mode 100644
index 0000000..5c7515e
--- /dev/null
+++ b/man/rl_synonyms.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_synonyms.R
+\name{rl_synonyms}
+\alias{rl_synonyms}
+\alias{rl_synonyms_}
+\title{Get species synonym information by taxonomic name}
+\usage{
+rl_synonyms(name = NULL, key = NULL, parse = TRUE, ...)
+
+rl_synonyms_(name = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get species synonym information by taxonomic name
+}
+\examples{
+\dontrun{
+rl_synonyms('Loxodonta africana')
+rl_synonyms('Loxodonta africana', parse = FALSE)
+rl_synonyms_('Loxodonta africana')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_threats.Rd b/man/rl_threats.Rd
new file mode 100644
index 0000000..68a15ac
--- /dev/null
+++ b/man/rl_threats.Rd
@@ -0,0 +1,49 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_threats.R
+\name{rl_threats}
+\alias{rl_threats}
+\alias{rl_threats_}
+\title{Get species threats by taxon name, IUCN id, and region}
+\usage{
+rl_threats(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_threats_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) Binomial taxonomic name}
+
+\item{id}{(character) IUCN id}
+
+\item{region}{(character) Binomial taxonomic name}
+
+\item{key}{A IUCN API token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get species threats by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_threats('Fratercula arctica')
+rl_threats('Fratercula arctica', region = 'europe')
+rl_threats(id = 12392)
+rl_threats(id = 22694927, region = 'europe')
+rl_threats_('Fratercula arctica')
+
+rl_threats(id = 62290750)
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
+
diff --git a/man/rl_version.Rd b/man/rl_version.Rd
new file mode 100644
index 0000000..3891727
--- /dev/null
+++ b/man/rl_version.Rd
@@ -0,0 +1,23 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_version.R
+\name{rl_version}
+\alias{rl_version}
+\title{Get the Red List API version}
+\usage{
+rl_version(...)
+}
+\arguments{
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+API version as character string
+}
+\description{
+Get the Red List API version
+}
+\examples{
+\dontrun{
+rl_version()
+}
+}
+
diff --git a/man/rredlist-package.Rd b/man/rredlist-package.Rd
new file mode 100644
index 0000000..178303b
--- /dev/null
+++ b/man/rredlist-package.Rd
@@ -0,0 +1,61 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rredlist-package.R
+\docType{package}
+\name{rredlist-package}
+\alias{rredlist}
+\alias{rredlist-package}
+\title{rredlist - IUCN Red List Client}
+\description{
+rredlist - IUCN Red List Client
+}
+\section{Authentication}{
+
+IUCN requires you to get your own API key, an alphanumeric string that you
+need to send in every request. Get it at
+\url{http://apiv3.iucnredlist.org/api/v3/token}.
+Keep this key private. You can pass the key in to each function via the
+\code{key} parameter, but it's better to store the key either as a
+environment variable (\code{IUCN_REDLIST_KEY}) or an R option
+(\code{iucn_redlist_key}) - we suggest using the former option.
+}
+
+\section{High vs. Low level package APIs}{
+
+\strong{High level API}
+High level functions do the HTTP request and parse data to a data.frame for
+ease of downstream use. The high level functions have no underscore on
+the end of the function name, e.g., \code{\link{rl_search}}
+
+\strong{Low level API}
+The parsing to data.frame in the high level API does take extra time.
+The low level API only does the HTTP request, and gives back JSON without
+doing any more parsing. The low level functions DO have an underscore on
+the end of the function name, e.g., \code{\link{rl_search_}}
+}
+
+\section{No Spatial}{
+
+This package does not include support for the spatial API, described at
+\url{http://apiv3.iucnredlist.org/spatial}
+}
+
+\section{Citing the Red List API}{
+
+The citation is
+\code{IUCN 2015. IUCN Red List of Threatened Species. Version 2015-4 <www.iucnredlist.org>}.
+You can get this programatically via \code{\link{rl_citation}}
+}
+
+\section{Rate limiting}{
+
+From the IUCN folks: Too many frequent calls, or too many calls per day
+might get your access blocked temporarily. If you're a heavy API user, the
+Red List Unit asked that you contact them, as there might be better options.
+They suggest a 2-second delay between your calls if you plan to make a
+lot of calls.
+}
+\author{
+Scott Chamberlain \email{myrmecocystus at gmail.com}
+}
+\keyword{package}
+
diff --git a/tests/test-all.R b/tests/test-all.R
new file mode 100644
index 0000000..a387469
--- /dev/null
+++ b/tests/test-all.R
@@ -0,0 +1,2 @@
+library(testthat)
+test_check("rredlist")
diff --git a/tests/testthat/test-fail-well.R b/tests/testthat/test-fail-well.R
new file mode 100644
index 0000000..ce39bd2
--- /dev/null
+++ b/tests/testthat/test-fail-well.R
@@ -0,0 +1,38 @@
+context("package fails well")
+
+test_that("fails well on bad key", {
+  skip_on_cran()
+
+  expect_error(rl_common_names('Loxodonta africana', key = "adfds"),
+               "Token not valid!")
+  expect_error(rl_common_names_('Loxodonta africana', key = "adfds"),
+               "Token not valid")
+})
+
+test_that("fails well when correct parameters not given", {
+  skip_on_cran()
+
+  expect_error(rl_search(), "is not TRUE")
+  expect_error(rl_search_(), "is not TRUE")
+})
+
+test_that("fails well when an invalid region passed", {
+  skip_on_cran()
+
+  # results in an `error` slot, which we catch
+
+  expect_error(rl_habitats(id = 22694927, region = 34234),
+               "region must be of class character")
+  expect_error(rl_habitats_(id = 22694927, region = '34234'),
+               "Region not found.")
+
+  expect_error(rl_search(id = 22694927, region = 2727343),
+               "region must be of class character")
+  expect_error(rl_search_(id = 22694927, region = '3wer'),
+               "Region not found.")
+
+  expect_error(rl_measures(id = 22694927, region = 12345),
+               "region must be of class character")
+  expect_error(rl_measures_(id = 22694927, region = '3wer'),
+               "Region not found.")
+})
diff --git a/tests/testthat/test-rl_citation.R b/tests/testthat/test-rl_citation.R
new file mode 100644
index 0000000..e946053
--- /dev/null
+++ b/tests/testthat/test-rl_citation.R
@@ -0,0 +1,17 @@
+context("rl_citation functions")
+
+test_that("rl_citation works", {
+  skip_on_cran()
+
+  aa <- rl_citation()
+
+  expect_is(aa, "character")
+  expect_match(aa, "IUCN")
+  expect_match(aa, "www.iucnredlist.org")
+})
+
+test_that("rl_citation curl options work", {
+  skip_on_cran()
+
+  expect_error(rl_citation(timeout_ms = 1), "Timeout was reached")
+})
diff --git a/tests/testthat/test-rl_common_names.R b/tests/testthat/test-rl_common_names.R
new file mode 100644
index 0000000..31309ea
--- /dev/null
+++ b/tests/testthat/test-rl_common_names.R
@@ -0,0 +1,62 @@
+context("rl_common_names functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_common_names('Loxodonta africana')
+
+  expect_is(aa, "list")
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_true(any(grepl("elephant", aa$result$taxonname, ignore.case = TRUE)))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_common_names('Loxodonta africana', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_true(any(grepl("elephant", vapply(aa$result, "[[", "", "taxonname"), ignore.case = TRUE)))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_common_names_('Loxodonta africana')
+
+  expect_is(aa, "character")
+  expect_is(jsonlite::fromJSON(aa), "list")
+})
+
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_common_names('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_common_names(5), "name must be of class character")
+  expect_error(rl_common_names(list()), "name must be of class character")
+
+  expect_error(rl_common_names(key = 5), "key must be of class character")
+  expect_error(rl_common_names(key = matrix()), "key must be of class character")
+
+  expect_error(rl_common_names(parse = 5), "parse must be of class logical")
+  expect_error(rl_common_names(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_common_names(letters[1:2]), "name must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_countries.R b/tests/testthat/test-rl_countries.R
new file mode 100644
index 0000000..5b3b346
--- /dev/null
+++ b/tests/testthat/test-rl_countries.R
@@ -0,0 +1,45 @@
+context("rl_countries functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_countries()
+
+  expect_is(aa, "list")
+  expect_type(aa$count, "integer")
+  expect_is(aa$results, "data.frame")
+  expect_true(any(grepl("Egypt", aa$results$country, ignore.case = TRUE)))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_countries(parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_type(aa$count, "integer")
+  expect_is(aa$results, "list")
+  expect_true(any(grepl("Egypt", vapply(aa$results, "[[", "", "country"), ignore.case = TRUE)))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_countries_()
+
+  expect_is(aa, "character")
+  expect_is(jsonlite::fromJSON(aa), "list")
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_countries(key = 5), "key must be of class character")
+  expect_error(rl_countries(key = matrix()), "key must be of class character")
+
+  expect_error(rl_countries(parse = 5), "parse must be of class logical")
+  expect_error(rl_countries(parse = matrix()), "parse must be of class logical")
+})
+
diff --git a/tests/testthat/test-rl_habitat.R b/tests/testthat/test-rl_habitat.R
new file mode 100644
index 0000000..dc048df
--- /dev/null
+++ b/tests/testthat/test-rl_habitat.R
@@ -0,0 +1,73 @@
+context("rl_habitats functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_habitats('Fratercula arctica')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_true(any(grepl("breeding", aa$result$season, ignore.case = TRUE)))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_habitats('Fratercula arctica', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_true(any(grepl("breeding", vapply(aa$result, "[[", "", "season"), ignore.case = TRUE)))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_habitats_('Fratercula arctica')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_habitats('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_habitats(5), "name must be of class character")
+  expect_error(rl_habitats(list()), "name must be of class character")
+
+  expect_error(rl_habitats(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_habitats(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_habitats("ab", region = 5), "region must be of class character")
+  expect_error(rl_habitats("ab", region = list()), "region must be of class character")
+
+  expect_error(rl_habitats(key = 5), "key must be of class character")
+  expect_error(rl_habitats(key = matrix()), "key must be of class character")
+
+  expect_error(rl_habitats(parse = 5), "parse must be of class logical")
+  expect_error(rl_habitats(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_habitats(letters[1:2]), "name must be length 1")
+  expect_error(rl_habitats(id = 1:2), "id must be length 1")
+  expect_error(rl_habitats(letters[1], region = letters[1:2]), "region must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_history.R b/tests/testthat/test-rl_history.R
new file mode 100644
index 0000000..fa923ed
--- /dev/null
+++ b/tests/testthat/test-rl_history.R
@@ -0,0 +1,95 @@
+context("rl_history functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_history('Loxodonta africana')
+
+  expect_is(aa, "list")
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_true(any(grepl("Vulnerable", aa$result$category, ignore.case = TRUE)))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_history('Loxodonta africana', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_true(any(grepl("Vulnerable", vapply(aa$result, "[[", "", "category"), ignore.case = TRUE)))
+})
+
+test_that("high level works - by ID", {
+  skip_on_cran()
+
+  aa <- rl_history(id = 12392)
+
+  expect_is(aa, "list")
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_true(any(grepl("Vulnerable", aa$result$category, ignore.case = TRUE)))
+})
+
+test_that("high level works - region", {
+  skip_on_cran()
+
+  aa <- rl_history(id = 22823, region = 'europe')
+  bb <- rl_history(id = 22823, region = 'mediterranean')
+
+  expect_is(aa, "list")
+  expect_named(aa, c('name', 'region_identifier', 'result'))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_gt(NROW(aa$result), 0)
+
+  expect_is(bb, "list")
+  expect_named(bb, c('name', 'region_identifier', 'result'))
+  expect_is(bb$name, "character")
+  expect_is(bb$result, "list")
+  expect_equal(length(bb$result), 0)
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_history_('Ursus maritimus', region = 'europe')
+
+  expect_is(aa, "character")
+  expect_is(jsonlite::fromJSON(aa), "list")
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_history(), "is not TRUE")
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_history(5), "name must be of class character")
+  expect_error(rl_history(list()), "name must be of class character")
+
+  expect_error(rl_history(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_history(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_history("ab", region = 5), "region must be of class character")
+  expect_error(rl_history("ab", region = list()), "region must be of class character")
+
+  expect_error(rl_history(key = 5), "key must be of class character")
+  expect_error(rl_history(key = matrix()), "key must be of class character")
+
+  expect_error(rl_history(parse = 5), "parse must be of class logical")
+  expect_error(rl_history(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_history(letters[1:2]), "name must be length 1")
+  expect_error(rl_history(id = 1:2), "id must be length 1")
+  expect_error(rl_history(letters[1], region = letters[1:2]), "region must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_measures.R b/tests/testthat/test-rl_measures.R
new file mode 100644
index 0000000..33dd41d
--- /dev/null
+++ b/tests/testthat/test-rl_measures.R
@@ -0,0 +1,73 @@
+context("rl_measures functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_measures('Fratercula arctica')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_named(aa$result, c("code", "title"))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_measures('Fratercula arctica', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_named(aa$result[[1]], c("code", "title"))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_measures_('Fratercula arctica')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_measures('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_measures(5), "name must be of class character")
+  expect_error(rl_measures(list()), "name must be of class character")
+
+  expect_error(rl_measures(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_measures(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_measures("ad", region = 5), "region must be of class character")
+  expect_error(rl_measures("ad", region = list()), "region must be of class character")
+
+  expect_error(rl_measures(key = 5), "key must be of class character")
+  expect_error(rl_measures(key = matrix()), "key must be of class character")
+
+  expect_error(rl_measures(parse = 5), "parse must be of class logical")
+  expect_error(rl_measures(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_measures(letters[1:2]), "name must be length 1")
+  expect_error(rl_measures(id = 1:2), "id must be length 1")
+  expect_error(rl_measures(letters[1], region = letters[1:2]), "region must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_narrative.R b/tests/testthat/test-rl_narrative.R
new file mode 100644
index 0000000..d2a3299
--- /dev/null
+++ b/tests/testthat/test-rl_narrative.R
@@ -0,0 +1,73 @@
+context("rl_narrative functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_narrative('Fratercula arctica')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_named(aa$result[,1:3], c("species_id", "taxonomicnotes", "rationale"))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_narrative('Fratercula arctica', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_named(aa$result[[1]][1:3], c("species_id", "taxonomicnotes", "rationale"))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_narrative_('Fratercula arctica')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_narrative('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_narrative(5), "name must be of class character")
+  expect_error(rl_narrative(list()), "name must be of class character")
+
+  expect_error(rl_narrative(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_narrative(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_narrative("adsfa", region = 5), "region must be of class character")
+  expect_error(rl_narrative("adsfa", region = list()), "region must be of class character")
+
+  expect_error(rl_narrative(key = 5), "key must be of class character")
+  expect_error(rl_narrative(key = matrix()), "key must be of class character")
+
+  expect_error(rl_narrative(parse = 5), "parse must be of class logical")
+  expect_error(rl_narrative(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_narrative(letters[1:2]), "name must be length 1")
+  expect_error(rl_narrative(id = 1:2), "id must be length 1")
+  expect_error(rl_narrative(letters[1], region = letters[1:2]), "region must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_search.R b/tests/testthat/test-rl_search.R
new file mode 100644
index 0000000..aedbbaa
--- /dev/null
+++ b/tests/testthat/test-rl_search.R
@@ -0,0 +1,73 @@
+context("rl_search functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_search('Fratercula arctica')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_true(any(grepl("arctica", aa$result$scientific_name, ignore.case = TRUE)))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_search('Fratercula arctica', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_true(any(grepl("arctica", vapply(aa$result, "[[", "", "scientific_name"), ignore.case = TRUE)))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_search_('Fratercula arctica')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_search('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_search(5), "name must be of class character")
+  expect_error(rl_search(list()), "name must be of class character")
+
+  expect_error(rl_search(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_search(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_search("adfadf", region = 5), "region must be of class character")
+  expect_error(rl_search("adfadf", region = list()), "region must be of class character")
+
+  expect_error(rl_search(key = 5), "key must be of class character")
+  expect_error(rl_search(key = matrix()), "key must be of class character")
+
+  expect_error(rl_search(parse = 5), "parse must be of class logical")
+  expect_error(rl_search(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_search(letters[1:2]), "name must be length 1")
+  expect_error(rl_search(id = 1:2), "id must be length 1")
+  expect_error(rl_search(letters[1], region = letters[1:2]), "region must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_sp_category.R b/tests/testthat/test-rl_sp_category.R
new file mode 100644
index 0000000..ed12f31
--- /dev/null
+++ b/tests/testthat/test-rl_sp_category.R
@@ -0,0 +1,71 @@
+context("rl_sp_category functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_sp_category('VU')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("count", "category", "result"))
+  expect_is(aa$count, "integer")
+  expect_is(aa$category, "character")
+  expect_equal(aa$category, "VU")
+  expect_is(aa$result, "data.frame")
+  expect_named(aa$result,
+               c('taxonid', 'scientific_name', 'subspecies', 'rank', 'subpopulation'))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_sp_category('VU', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("count", "category", "result"))
+  expect_is(aa$count, "integer")
+  expect_is(aa$category, "character")
+  expect_equal(aa$category, "VU")
+  expect_is(aa$result, "list")
+  expect_named(aa$result[[1]],
+               c('taxonid', 'scientific_name', 'subspecies', 'rank', 'subpopulation'))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_sp_category_('VU')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("count", "category", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_sp_category('asdfad')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_sp_category(5), "category must be of class character")
+  expect_error(rl_sp_category(list()), "category must be of class character")
+
+  expect_error(rl_sp_category(key = 5), "key must be of class character")
+  expect_error(rl_sp_category(key = matrix()), "key must be of class character")
+
+  expect_error(rl_sp_category(parse = 5), "parse must be of class logical")
+  expect_error(rl_sp_category(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_sp_category(letters[1:2]), "category must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_synonyms.R b/tests/testthat/test-rl_synonyms.R
new file mode 100644
index 0000000..47e9cde
--- /dev/null
+++ b/tests/testthat/test-rl_synonyms.R
@@ -0,0 +1,70 @@
+context("rl_synonyms functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_synonyms('Loxodonta africana')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "count", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$count, "integer")
+  expect_is(aa$result, "data.frame")
+  expect_named(aa$result,
+               c('accepted_id', 'accepted_name', 'authority', 'synonym', 'syn_authority'))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_synonyms('Loxodonta africana', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "count", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$count, "integer")
+  expect_is(aa$result, "list")
+  expect_named(aa$result[[1]],
+               c('accepted_id', 'accepted_name', 'authority', 'synonym', 'syn_authority'))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_synonyms_('Loxodonta africana')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "count", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_synonyms('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_synonyms(5), "name must be of class character")
+  expect_error(rl_synonyms(list()), "name must be of class character")
+
+  expect_error(rl_synonyms(key = 5), "key must be of class character")
+  expect_error(rl_synonyms(key = matrix()), "key must be of class character")
+
+  expect_error(rl_synonyms(parse = 5), "parse must be of class logical")
+  expect_error(rl_synonyms(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_synonyms(letters[1:2]), "name must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_threats.R b/tests/testthat/test-rl_threats.R
new file mode 100644
index 0000000..0c034fa
--- /dev/null
+++ b/tests/testthat/test-rl_threats.R
@@ -0,0 +1,74 @@
+context("rl_threats functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_threats('Fratercula arctica')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_named(aa$result[,1:3], c("code", "title", "timing"))
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_threats('Fratercula arctica', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_named(aa$result[[1]][1:3], c("code", "title", "timing"))
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_threats_('Fratercula arctica')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_threats('Loxodonta asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_threats(5), "name must be of class character")
+  expect_error(rl_threats(list()), "name must be of class character")
+
+  expect_error(rl_threats(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_threats(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_threats("ad", region = 5), "region must be of class character")
+  expect_error(rl_threats("ad", region = list()), "region must be of class character")
+
+  expect_error(rl_threats(key = 5), "key must be of class character")
+  expect_error(rl_threats(key = matrix()), "key must be of class character")
+
+  expect_error(rl_threats(parse = 5), "parse must be of class logical")
+  expect_error(rl_threats(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_threats(letters[1:2]), "name must be length 1")
+  expect_error(rl_threats(id = 1:2), "id must be length 1")
+  expect_error(rl_threats(letters[1], region = letters[1:2]), "region must be length 1")
+})
+
diff --git a/tests/testthat/test-rl_version.R b/tests/testthat/test-rl_version.R
new file mode 100644
index 0000000..413e379
--- /dev/null
+++ b/tests/testthat/test-rl_version.R
@@ -0,0 +1,16 @@
+context("rl_version functions")
+
+test_that("rl_version works", {
+  skip_on_cran()
+
+  aa <- rl_version()
+
+  expect_is(aa, "character")
+  expect_match(aa, "[0-9]{4}-[0-9]")
+})
+
+test_that("rl_version curl options work", {
+  skip_on_cran()
+
+  expect_error(rl_version(timeout_ms = 1), "Timeout was reached")
+})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-rredlist.git



More information about the debian-med-commit mailing list