DoubleYouGTT / hubspot

R package 📦 for working with Hubspot 👩‍💼👨‍💼 data
https://itsalocke.com/hubspot/
Other
10 stars 8 forks source link

Add support for Get submissions for a form endpoint #94

Open maelle opened 4 years ago

maelle commented 4 years ago

Get submissions for a form

R script template

#' WIP - Get submissions for a form (raw and tidy)
#'
#' @description Get the submissions for the specified form. This will include the fields in the submissions, the time of the form submission, and the page URL that the form was submitted on. Submissions will be returned in reverse-chronological order. from the [Get submissions for a form endpoint](https://developers.hubspot.com/docs/methods/forms/get-submissions-for-a-form).
#' @details Required scope(s) for the OAuth token: forms.
#' @template token_path
#' @template apikey
#'
#' @return A list (`hs_get_submissions_for_a_form_raw()`)
#' @rdname get-submissions-for-a-form
#' @export
#' @examples
#' \donttest{
#' hs_get_submissions_for_a_form_raw()
#' }
hs_get_submissions_for_a_form_raw <- function() {
  path <- "/form-integrations/v1/submissions/forms/:form_guid"
}
# tidiers -----------------------------------------------------------------
#' @rdname get-submissions-for-a-form
#' @template get_submissions_for_a_form
#' @template view
#' @return A tibble with associated entities (`hs_get_submissions_for_a_form_tidy()`)
#' @export
hs_get_submissions_for_a_form_tidy <- function(get_submissions_for_a_form = hs_get_submissions_for_a_form_raw(),
                                              view = "lalalala") {
  # view <- match.arg(view, c('lalalala'))

  # switch(view,
  #       'lalalala' = blabla)
}

test template

vcr::use_cassette("hs_get_submissions_for_a_form_raw", {

  test_that("hs_get_submissions_for_a_form_raw works", {

    expect_is(hs_get_submissions_for_a_form_raw(), "list")

  })

})