Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
Added data_classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Steph Locke committed Mar 21, 2016
1 parent bfcfccf commit b57da92
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: HIBPwned
Title: Bindings for the HaveIBeenPwned.com data breach API
Version: 0.0.0.9003
Version: 0.0.0.9004
Authors@R: c(person("Steph", "Locke"
, email = "stephanie.g.locke@gmail.com"
, role = c("aut", "cre"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export(HIBP_headers)
export(account_breaches)
export(breached_site)
export(breached_sites)
export(data_classes)
importFrom(httr,add_headers)
importFrom(httr,content)
importFrom(jsonlite,fromJSON)
Expand Down
15 changes: 15 additions & 0 deletions R/data_classes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#' Get list of classes of data that have been
#' exposed in breaches
#'
#' @param ... Optional passthrough to HIBP_headers()
#'
#' @return Data.frame containing data class details
#' @export
#'
#' @examples
#' data_classes()
data_classes<-function(...){
URLS<-"https://haveibeenpwned.com/api/dataclasses"
res<- GETcontent(URLS, HIBP_headers(...))
return(res)
}
23 changes: 23 additions & 0 deletions man/data_classes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tests/testthat/test-data_classes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
context("data_classes")

test_that("data_classes works",{
res<-data_classes()
expect_is(res, "character")
expect_gte(length(res),48)

# With header passthrough
expect_error(data_classes(agent="blah"),NA)
})

0 comments on commit b57da92

Please sign in to comment.