#' Get Time Sheet
#'
#' Obtain your Harvest Account ID and Personal Access Token by registering at
#' \href{https://id.getharvest.com/developers}{Harvest Developers}.
#'
#' @param id A string of the Harvest Account ID
#' @param pat A string of the Harvest Personal Access Token
#' @param from A date of the start date.
#' @param to A Date of the end date.
#'
#' @return A tibble of the time sheet.
#' @export
#' @examples
#' \dontrun{
#' timesheet <- pts_get_timesheet(from = as.Date("2018-12-23"),
#' to = as.Date("2019-03-27"))
#' }
pts_get_timesheet <- function(id = harvestR::harvest_id(),
pat = harvestR::harvest_pat(),
from = as.Date("2018-04-01"), to = Sys.Date()) {
check_string(id)
check_string(pat)
check_date(from)
check_date(to)
from <- as.character(from)
to <- as.character(to)
timesheet <- harvestR::get_table(table = "time_entries" , user = id, key = pat,
query = list(from = from, to = to))
timesheet %<>%
select(Date = .data$spent_date, Member = .data$user.name,
Project = .data$project.name, Task = .data$task.name,
Hours = .data$hours,
Billable = .data$billable) %>%
mutate(Date = as.Date(.data$Date))
timesheet %<>% pts_add_entry(from)
timesheet %<>% pts_add_entry(to)
timesheet %<>% arrange(.data$Date, .data$Member, .data$Project, .data$Task, .data$Hours)
timesheet
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.