Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Oct 30, 2024
1 parent 2a1a466 commit 1496d5f
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 65 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.httr-oauth$
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
34 changes: 34 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.RData
.Ruserdata
.httr-oauth
docs
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ License: GPL (>= 2)
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
RoxygenNote: 7.3.2
Imports:
jsonlite,
httr
URL: https://rd.thecoatlessprofessor.com/r-web-api/
11 changes: 6 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ knitr::opts_chunk$set(

## Retrieving Data from a Custom Web API

[![Travis-CI Build Status](https://travis-ci.org/r-pkg-examples/r-web-api.svg?branch=master)](https://travis-ci.org/r-pkg-examples/r-web-api)

<!-- badges: start -->
[![R-CMD-check](https://github.com/coatless-r-n-d/r-web-api/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-r-n-d/r-web-api/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The `cumtd` _R_ package provides an example of implementing and using a
Web API. In particular, the package is a case study in retrieving data from the
[Champaign-Urbana Mass Transit District ('CUMTD')](https://developer.cumtd.com/)
Expand All @@ -36,8 +38,8 @@ to illustrate how a real-time API can be used with
To install the `cumtd` package, use:

```r
if(!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("r-pkg-examples/r-web-api")
if(!requireNamespace("remotes")) install.packages("remotes")
remotes::install_github("coatless-r-n-d/r-web-api")
```

To access its contents, load it into _R_ with:
Expand Down Expand Up @@ -93,7 +95,6 @@ a body portion that contains the desired data and needs to be converted into an
_R_ data structure.



### License

GPL (\>= 2)
89 changes: 45 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

## Retrieving Data from a Custom Web API

[![Travis-CI Build
Status](https://travis-ci.org/r-pkg-examples/r-web-api.svg?branch=master)](https://travis-ci.org/r-pkg-examples/r-web-api)
<!-- badges: start -->

[![R-CMD-check](https://github.com/coatless-r-n-d/r-web-api/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-r-n-d/r-web-api/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The `cumtd` *R* package provides an example of implementing and using a
Web API. In particular, the package is a case study in retrieving data
Expand All @@ -29,8 +31,8 @@ example to illustrate how a real-time API can be used with
To install the `cumtd` package, use:

``` r
if(!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("r-pkg-examples/r-web-api")
if(!requireNamespace("remotes")) install.packages("remotes")
remotes::install_github("coatless-r-n-d/r-web-api")
```

To access its contents, load it into *R* with:
Expand All @@ -43,47 +45,46 @@ library("cumtd")

We have support presently for:

| Implemented Functions |
| :-------------------------------- |
| classify\_departure\_status |
| convert\_response |
| cumtd |
| cumtd\_check\_key |
| cumtd\_set\_key |
| cumtd\_show\_key |
| get\_all\_routes |
| get\_all\_stops |
| get\_all\_vehicles |
| get\_api\_usage |
| get\_departures\_by\_stop |
| get\_route\_shape |
| get\_route\_shape\_between\_stops |

End points to be added (PRs
appreciated\!):

| End Point Documentation |
| :----------------------------------------------------------------------------------------------------------- |
| [GetCalendarDatesByDate](https://developer.cumtd.com/documentation/v2.2/method/getcalendardatesbydate) |
| Implemented Functions |
|:------------------------------|
| classify_departure_status |
| convert_response |
| cumtd |
| cumtd_check_key |
| cumtd_set_key |
| cumtd_show_key |
| get_all_routes |
| get_all_stops |
| get_all_vehicles |
| get_api_usage |
| get_departures_by_stop |
| get_route_shape |
| get_route_shape_between_stops |

End points to be added (PRs appreciated!):

| End Point Documentation |
|:---|
| [GetCalendarDatesByDate](https://developer.cumtd.com/documentation/v2.2/method/getcalendardatesbydate) |
| [GetCalendarDatesByService](https://developer.cumtd.com/documentation/v2.2/method/getcalendardatesbyservice) |
| [GetNews](https://developer.cumtd.com/documentation/v2.2/method/getnews) |
| [GetReroutes](https://developer.cumtd.com/documentation/v2.2/method/getreroutes) |
| [GetReroutesByRoute](https://developer.cumtd.com/documentation/v2.2/method/getreroutesbyroute) |
| [GetRoute](https://developer.cumtd.com/documentation/v2.2/method/getroute) |
| [GetRoutesByStop](https://developer.cumtd.com/documentation/v2.2/method/getroutesbystop) |
| [GetStop](https://developer.cumtd.com/documentation/v2.2/method/getstop) |
| [GetStopsByLatLon](https://developer.cumtd.com/documentation/v2.2/method/getstopsbylatlon) |
| [GetStopsBySearch](https://developer.cumtd.com/documentation/v2.2/method/getstopsbysearch) |
| [GetStopTimesByTrip](https://developer.cumtd.com/documentation/v2.2/method/getstoptimesbytrip) |
| [GetStopTimesByStop](https://developer.cumtd.com/documentation/v2.2/method/getstoptimesbystop) |
| [GetPlannedTripsByLatLon](https://developer.cumtd.com/documentation/v2.2/method/getplannedtripsbylatlon) |
| [GetPlannedTripsByStops](https://developer.cumtd.com/documentation/v2.2/method/getplannedtripsbystops) |
| [GetTrip](https://developer.cumtd.com/documentation/v2.2/method/gettrip) |
| [GetTripsByBlock](https://developer.cumtd.com/documentation/v2.2/method/gettripsbyblock) |
| [GetTripsByRoute](https://developer.cumtd.com/documentation/v2.2/method/gettripsbyroute) |
| [GetVehicle](https://developer.cumtd.com/documentation/v2.2/method/getvehicle) |
| [GetVehiclesByRoute](https://developer.cumtd.com/documentation/v2.2/method/getvehiclesbyroute) |
| [GetLastFeedUpdate](https://developer.cumtd.com/documentation/v2.2/method/getlastfeedupdate) |
| [GetNews](https://developer.cumtd.com/documentation/v2.2/method/getnews) |
| [GetReroutes](https://developer.cumtd.com/documentation/v2.2/method/getreroutes) |
| [GetReroutesByRoute](https://developer.cumtd.com/documentation/v2.2/method/getreroutesbyroute) |
| [GetRoute](https://developer.cumtd.com/documentation/v2.2/method/getroute) |
| [GetRoutesByStop](https://developer.cumtd.com/documentation/v2.2/method/getroutesbystop) |
| [GetStop](https://developer.cumtd.com/documentation/v2.2/method/getstop) |
| [GetStopsByLatLon](https://developer.cumtd.com/documentation/v2.2/method/getstopsbylatlon) |
| [GetStopsBySearch](https://developer.cumtd.com/documentation/v2.2/method/getstopsbysearch) |
| [GetStopTimesByTrip](https://developer.cumtd.com/documentation/v2.2/method/getstoptimesbytrip) |
| [GetStopTimesByStop](https://developer.cumtd.com/documentation/v2.2/method/getstoptimesbystop) |
| [GetPlannedTripsByLatLon](https://developer.cumtd.com/documentation/v2.2/method/getplannedtripsbylatlon) |
| [GetPlannedTripsByStops](https://developer.cumtd.com/documentation/v2.2/method/getplannedtripsbystops) |
| [GetTrip](https://developer.cumtd.com/documentation/v2.2/method/gettrip) |
| [GetTripsByBlock](https://developer.cumtd.com/documentation/v2.2/method/gettripsbyblock) |
| [GetTripsByRoute](https://developer.cumtd.com/documentation/v2.2/method/gettripsbyroute) |
| [GetVehicle](https://developer.cumtd.com/documentation/v2.2/method/getvehicle) |
| [GetVehiclesByRoute](https://developer.cumtd.com/documentation/v2.2/method/getvehiclesbyroute) |
| [GetLastFeedUpdate](https://developer.cumtd.com/documentation/v2.2/method/getlastfeedupdate) |

### Implementation Details

Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: https://rd.thecoatlessprofessor.com/r-web-api/
template:
bootstrap: 5

2 changes: 1 addition & 1 deletion man/classify_departure_status.Rd

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

13 changes: 9 additions & 4 deletions man/cumtd-package.Rd

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

3 changes: 1 addition & 2 deletions man/cumtd.Rd

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

8 changes: 6 additions & 2 deletions man/get_api_usage.Rd

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

3 changes: 1 addition & 2 deletions man/get_departures_by_stop.Rd

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

0 comments on commit 1496d5f

Please sign in to comment.