forked from propellerpdx/bambooHR
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from MangoTheCat/develop
release ready merge develop to main
- Loading branch information
Showing
103 changed files
with
16,717 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
^renv$ | ||
^renv\.lock$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^\.github$ | ||
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ | ||
^README\.Rmd$ | ||
^LICENSE\.md$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
source("renv/activate.R") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master, develop] | ||
pull_request: | ||
branches: [main, master, develop] | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v1 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v1 | ||
with: | ||
extra-packages: rcmdcheck | ||
|
||
- uses: r-lib/actions/check-r-package@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master, develop] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v1 | ||
|
||
- uses: r-lib/actions/setup-r@v1 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v1 | ||
with: | ||
extra-packages: pkgdown | ||
needs: website | ||
|
||
- name: Deploy package | ||
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master, develop] | ||
pull_request: | ||
branches: [main, master, develop] | ||
|
||
name: test-coverage | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v1 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v1 | ||
with: | ||
extra-packages: covr, testthat | ||
|
||
- name: Test coverage | ||
run: covr::codecov() | ||
shell: Rscript {0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.Rhistory | ||
.RData | ||
.Ruserdata | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
Package: bambooHR | ||
Type: Package | ||
Title: An R wrapper to the BambooHR API | ||
Title: A Wrapper to the 'BambooHR' API | ||
Version: 0.1.0 | ||
Authors@R: | ||
Authors@R: | ||
c( | ||
person("Tom", "Bowling", , "tom.bowling@ascent.io", role = c("aut", "cre")), | ||
person("Harry", "Alexander", , "harry.alexander@ascent.io", role = "aut"), | ||
person("Tim", "Fry", , "tim.fry@ascent.io", role = "aut"), | ||
person("Mark", "Druffel", , "mdruffel@propellerpdx.com", role = "aut") | ||
person("Andrew", "Little", role = "ctb"), | ||
person("Mark", "Druffel", , "mdruffel@propellerpdx.com", role = "ctb")) | ||
Maintainer: Tom Bowling <tom.bowling@ascent.io> | ||
Description: Enables a user to consume the BambooHR API endpoints using R. | ||
Description: Enables a user to consume the 'BambooHR' API endpoints using R. The | ||
actual URL of the API will depend on your company domain, and will be handled | ||
by the package automatically once you setup the config file. The API documentation | ||
can be found here <https://documentation.bamboohr.com/docs>. | ||
Depends: R (>= 4.0.0) | ||
Imports: | ||
Imports: | ||
rlang, | ||
glue, | ||
httr, | ||
curl | ||
curl, | ||
jsonlite, | ||
magrittr, | ||
dplyr, | ||
purrr, | ||
tibble, | ||
tidyr, | ||
lubridate, | ||
testthat, | ||
janitor, | ||
stringr, | ||
cli, | ||
withr, | ||
fs | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 7.1.2 | ||
URL: https://mangothecat.github.io/bambooHR/ | ||
BugReports: https://github.com/MangoTheCat/bambooHR/issues | ||
Suggests: httptest | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
exportPattern("^[[:alpha:]]+") | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export("%>%") | ||
export(build_url) | ||
export(config_setup) | ||
export(get_employee) | ||
export(get_meta) | ||
export(get_table) | ||
export(get_timeoff_policies) | ||
export(get_timeoff_requests) | ||
export(get_timeoff_types) | ||
export(get_whos_out) | ||
export(use_config) | ||
importFrom(magrittr,"%>%") | ||
importFrom(rlang,.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#' @keywords internal | ||
"_PACKAGE" | ||
|
||
## usethis namespace: start | ||
#' @importFrom magrittr %>% | ||
## usethis namespace: end | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,30 @@ | ||
#' @title Build URL Endpoints with Company Domain and API Version | ||
#' | ||
#' @description fill in | ||
#' @description Used to generate the base API request URL. URLs will start with "https://api.bamboohr.com/api/gateway.php/{company_domain}" which forms the base URL where a query string can then be appended to make the full request URL. | ||
#' | ||
#' @param company_domain tbd | ||
#' @param api_version tbd | ||
#' @param base_url tbd | ||
#' @param company_domain The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the company_domain is "mycompany". | ||
#' Default value is obtained from \code{options("bambooHR.company_name")}. This can also be set in the config file using \code{config_setup("api key", "company_domain")}. | ||
#' @param api_version Version of API to use to make request. Default is "v1". | ||
#' @param base_url URL to BambooHR API. Default is "https://api.bamboohr.com/api/gateway.php". | ||
#' | ||
#' @return text | ||
#' @return character vector of URL with API version and company domain to give the base URL for API requests. | ||
#' | ||
#' @examples | ||
#' @export | ||
#' | ||
#' | ||
#' @author Mark Druffel, \email{mdruffel@propellerpdx.com} | ||
|
||
build_url <- function(company_domain, api_version, base_url){ | ||
if(!rlang::is_null(base_url)){ | ||
base_url <- base_url | ||
} else{ | ||
base_url <- rlang::missing_arg() | ||
} | ||
if(!rlang::is_null(api_version)){ | ||
api_version <- api_version | ||
} else{ | ||
api_version <- rlang::missing_arg() | ||
build_url <- function(company_domain = .get_company_name(), | ||
api_version = "v1", | ||
base_url = "https://api.bamboohr.com/api/gateway.php") { | ||
if (is.null(company_domain)) { | ||
stop("Please enter company_domain or set a default value using `config_setup()`.") | ||
} | ||
if(!rlang::is_null(company_domain)){ | ||
company_domain <- company_domain | ||
} else{ | ||
company_domain <- rlang::missing_arg() | ||
} | ||
base_url <- get_base_url(base_url) | ||
api_version <- get_api_version(api_version) | ||
company_domain <- get_company_domain(company_domain) | ||
|
||
stopifnot( | ||
is.character(company_domain), | ||
is.character(api_version), | ||
is.character(base_url) | ||
) | ||
|
||
url <- glue::glue("{base_url}/{company_domain}/{api_version}") | ||
return(url) | ||
} | ||
|
||
get_base_url <- function(base_url){ | ||
base_url <- rlang::maybe_missing(base_url, default = "https://api.bamboohr.com/api/gateway.php") | ||
return(base_url) | ||
} | ||
get_api_version <- function(api_version){ | ||
api_version <- rlang::maybe_missing(api_version, default = "v1") | ||
return(api_version) | ||
} | ||
get_company_domain <- function(company_domain){ | ||
company_domain <- rlang::maybe_missing(company_domain, default = "propellerpdx") | ||
return(company_domain) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.