diff --git a/R/utils.R b/R/utils.R index 238dbbf..afd8ede 100644 --- a/R/utils.R +++ b/R/utils.R @@ -76,6 +76,7 @@ date_convert <- function(.x) { .x[["metadata"]] <- I(list(.x[["metadata"]])) .x[["score"]] <- I(list(.x[["score"]])) .x[["tags"]] <- I(list(.x[["tags"]])) + .x[["references"]] <- I(list(.x[["references"]])) if ("rapid7Analysis" %in% names(.x)) { if (length(.x[["rapid7Analysis"]])) { @@ -85,6 +86,22 @@ date_convert <- function(.x) { } } + if ("rapid7AnalysisCreated" %in% names(.x)) { + if (length(.x[["rapid7AnalysisCreated"]])) { + .x[["rapid7AnalysisCreated"]] <- paste0(.x[["rapid7AnalysisCreated"]], collapse = " ") + } else { + .x[["rapid7AnalysisCreated"]] <- NA_character_ + } + } + + if ("rapid7AnalysisRevisionDate" %in% names(.x)) { + if (length(.x[["rapid7AnalysisRevisionDate"]])) { + .x[["rapid7AnalysisRevisionDate"]] <- paste0(.x[["rapid7AnalysisRevisionDate"]], collapse = " ") + } else { + .x[["rapid7AnalysisRevisionDate"]] <- NA_character_ + } + } + .x <- as.data.frame(.x, stringsAsFactors = FALSE) .x @@ -133,7 +150,7 @@ handle_response <- function(.x, api_key = attackerkb_api_key(), came_from = NULL path <- .x[["links"]][["self"]][["href"]] - if (length(path) == 0) path <- sub("^kb_", "/", came_from) + if (length(path) == 0) path <- sub("^kb_", "/v1/", came_from) ret <- .x[["data"]] diff --git a/inst/tinytest/test_attackerkb.R b/inst/tinytest/test_attackerkb.R index aa3f72e..a3ddd94 100644 --- a/inst/tinytest/test_attackerkb.R +++ b/inst/tinytest/test_attackerkb.R @@ -1,4 +1,4 @@ # Placeholder with simple test -expect_equal(1 + 1, 2) +