├── .gitignore ├── LICENSE ├── NAMESPACE ├── .Rbuildignore ├── README-unnamed-chunk-3-1.png ├── .travis.yml ├── R ├── aaa.R └── get_wait_times.R ├── parkhoppr.Rproj ├── DESCRIPTION ├── man └── get_wait_times.Rd ├── README.Rmd └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2017 2 | COPYRIGHT HOLDER: Lucy D'Agostino McGowan 3 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(get_wait_times) 4 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^README\.Rmd$ 4 | ^README-.*\.png$ 5 | ^\.travis\.yml$ 6 | -------------------------------------------------------------------------------- /README-unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LucyMcGowan/parkhoppr/HEAD/README-unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r 2 | 3 | language: R 4 | sudo: false 5 | cache: packages 6 | -------------------------------------------------------------------------------- /R/aaa.R: -------------------------------------------------------------------------------- 1 | .park_lookup <- list( 2 | magic_kingdom = list(park_id = 80007944, resort_id = 80007798), 3 | animal_kingdom = list(park_id = 80007823, resort_id = 80007798), 4 | epcot = list(park_id = 80007838, resort_id = 80007798), 5 | hollywood_studios = list(park_id = 80007998, resort_id = 80007798), 6 | disneyland_mk = list(park_id = 330339, resort_id = 80008297), 7 | disneyland_cali_adventure = list(park_id = 336894, resort_id = 80008297) 8 | ) 9 | -------------------------------------------------------------------------------- /parkhoppr.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: parkhoppr 2 | Title: API for accessing Disney World wait times 3 | Version: 0.0.0.9000 4 | Authors@R: person("Lucy", "D'Agostino McGowan", email = "lucydagostino@gmail.com", role = c("aut", "cre")) 5 | Description: API for accessing Disney World wait times. 6 | Depends: R (>= 3.3.3) 7 | License: MIT + file LICENSE 8 | Encoding: UTF-8 9 | LazyData: true 10 | Roxygen: list(markdown = TRUE) 11 | RoxygenNote: 6.0.1 12 | Imports: httr, 13 | tibble, 14 | glue, 15 | purrr 16 | URL: https://github.com/LucyMcGowan/parkhoppr 17 | BugReports: https://github.com/LucyMcGowan/parkhoppr/issues 18 | -------------------------------------------------------------------------------- /man/get_wait_times.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_wait_times.R 3 | \name{get_wait_times} 4 | \alias{get_wait_times} 5 | \title{Get Disney World wait times.} 6 | \usage{ 7 | get_wait_times(park = "magic_kingdom") 8 | } 9 | \arguments{ 10 | \item{park}{Character. The name of the park you are interested in 11 | receiving wait times for. Must be one of the following: 12 | \itemize{ 13 | \item \code{magic_kingdom} 14 | \item \code{hollywood_studios} 15 | \item \code{epcot} 16 | \item \code{animal_kingdom} 17 | }} 18 | } 19 | \value{ 20 | \code{tibble} containing the following columns: 21 | \itemize{ 22 | \item \code{name}: Character. The name of the attraction. 23 | \item \code{wait_time}: Integer. The posted wait time (in minutes). 24 | \item \code{fast_pass}: Logical. Can you obtain a fast pass for this 25 | attraction? 26 | \item \code{status}: Character: The current status of the attraction. 27 | \item \code{single_rider}: Logical. Does the ride have a single rider queue? 28 | \item \code{type}: Character. The type of attraction. 29 | \item \code{wait_time_list}: List. A list containing all wait time data 30 | obtained from the API. 31 | } 32 | } 33 | \description{ 34 | Get Disney World wait times. 35 | } 36 | \examples{ 37 | \dontrun{ 38 | ## Get a tibble of Epcot wait times 39 | get_wait_times(park = "epcot") 40 | 41 | ## Get a tibble of Hollywood Studios wait times 42 | get_wait_times(park = "hollywood_studios") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, echo = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "README-" 12 | ) 13 | ``` 14 | 15 | # parkhoppr 16 | 17 | [![Travis-CI Build Status](https://travis-ci.org/LucyMcGowan/parkhoppr.svg?branch=master)](https://travis-ci.org/LucyMcGowan/parkhoppr) 18 | 19 | The goal of parkhoppr is to allow access to Disney World wait times. 20 | 21 | ## Installation 22 | 23 | You can install parkhoppr from github with: 24 | 25 | ```{r gh-installation, eval = FALSE} 26 | # install.packages("devtools") 27 | devtools::install_github("LucyMcGowan/parkhoppr") 28 | ``` 29 | 30 | ## Example 31 | 32 | There is currently just one function - you can get wait times for rides at Disney World✨. 33 | 34 | ```{r example} 35 | ## load the library 36 | library("parkhoppr") 37 | ## by default, get_wait_times() outputs Magic Kingdom wait times 38 | get_wait_times() 39 | ``` 40 | 41 | You can specify the Disney World park you would like to retrieve wait times for using the `park` parameter. 42 | 43 | ```{r} 44 | get_wait_times(park = "hollywood_studios") 45 | ``` 46 | 47 | 48 | ## have some fun! 49 | ```{r, message = FALSE, warning = FALSE} 50 | library("dplyr") 51 | library("ggplot2") 52 | get_wait_times() %>% 53 | filter(fast_pass == TRUE) %>% 54 | mutate(wait_cat = case_when( 55 | wait_time >= 45 ~ "bad", 56 | wait_time >= 25 & wait_time < 45 ~ "ok", 57 | wait_time < 25 ~ "good" 58 | )) %>% 59 | arrange(wait_time) %>% 60 | mutate(name = forcats::fct_reorder(name, wait_time)) %>% 61 | ggplot(aes(name, wait_time, fill = wait_cat)) + 62 | geom_bar(stat = "identity") + 63 | theme(axis.text.x = element_text(angle = 45, hjust = 1), 64 | legend.position = "none", 65 | plot.margin = unit(c(0.1, 0.1, 0.1, 2), "cm")) + 66 | xlab("") + 67 | ylab("wait time") 68 | ``` 69 | 70 | 71 | 72 | *Shout out to the [themeparks](https://github.com/cubehouse/themeparks) library that inspired this little jaunt!* 73 | -------------------------------------------------------------------------------- /R/get_wait_times.R: -------------------------------------------------------------------------------- 1 | #' Get Disney World wait times. 2 | #' 3 | #' @param park Character. The name of the park you are interested in 4 | #' receiving wait times for. Must be one of the following: 5 | #' 6 | #' * `magic_kingdom` 7 | #' * `hollywood_studios` 8 | #' * `epcot` 9 | #' * `animal_kingdom` 10 | #' 11 | #' @return `tibble` containing the following columns: 12 | #' 13 | #' * `name`: Character. The name of the attraction. 14 | #' * `wait_time`: Integer. The posted wait time (in minutes). 15 | #' * `fast_pass`: Logical. Can you obtain a fast pass for this 16 | #' attraction? 17 | #' * `status`: Character: The current status of the attraction. 18 | #' * `single_rider`: Logical. Does the ride have a single rider queue? 19 | #' * `type`: Character. The type of attraction. 20 | #' * `wait_time_list`: List. A list containing all wait time data 21 | #' obtained from the API. 22 | #' @export 23 | #' 24 | #' @examples 25 | #' \dontrun{ 26 | #' ## Get a tibble of Epcot wait times 27 | #' get_wait_times(park = "epcot") 28 | #' 29 | #' ## Get a tibble of Hollywood Studios wait times 30 | #' get_wait_times(park = "hollywood_studios") 31 | #' } 32 | get_wait_times <- function(park = "magic_kingdom") { 33 | token_url <- "https://authorization.go.com/token"; 34 | token_body <- "grant_type=assertion&assertion_type=public&client_id=WDPRO-MOBILE.MDX.WDW.ANDROID-PROD"; 35 | base_url = "https://api.wdpro.disney.go.com/facility-service/theme-parks/"; 36 | 37 | token <- httr::POST(url = token_url, 38 | body = token_body) 39 | access_token <- httr::content(token)$access_token 40 | 41 | park_info <- .park_lookup[[park]] 42 | park_id <- park_info$park_id 43 | resort_id <- park_info$resort_id 44 | 45 | url <- glue::glue("{base_url}{park_id};destination={resort_id}/wait-times") 46 | response <- httr::GET(url, httr::add_headers( 47 | Authorization = paste("BEARER", access_token), 48 | Accept = "application/json;apiversion=1", 49 | "X-Conversation-Id" = "WDPRO-MOBILE.MDX.CLIENT-PROD", 50 | "X-Correlation-ID" = Sys.Date() 51 | )) 52 | 53 | out_lst <- httr::content(response)[["entries"]] 54 | 55 | out_tbl <- tibble::tibble( 56 | name = purrr::map_chr(out_lst, "name"), 57 | wait_time_lst = purrr::map(out_lst, "waitTime"), 58 | type = purrr::map_chr(out_lst, "type") 59 | ) 60 | 61 | out_tbl[["status"]] <- purrr::map_chr(out_tbl$wait_time_lst, "status") 62 | out_tbl[["single_rider"]] <- purrr::map_lgl(out_tbl$wait_time_lst, "singleRider") 63 | out_tbl[["wait_time"]] <- purrr::map_int(out_tbl$wait_time_lst, "postedWaitMinutes", .null = NA) 64 | out_tbl[["fast_pass"]] <- purrr::map_lgl(out_tbl$wait_time_lst, c("fastPass", "available")) 65 | 66 | out_tbl <- out_tbl[ , c(1, 6, 7, 4, 5, 3, 2)] 67 | return(out_tbl) 68 | } 69 | 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | parkhoppr 4 | ========= 5 | 6 | [![Travis-CI Build Status](https://travis-ci.org/LucyMcGowan/parkhoppr.svg?branch=master)](https://travis-ci.org/LucyMcGowan/parkhoppr) 7 | 8 | The goal of parkhoppr is to allow access to Disney World wait times. 9 | 10 | Installation 11 | ------------ 12 | 13 | You can install parkhoppr from github with: 14 | 15 | ``` r 16 | # install.packages("devtools") 17 | devtools::install_github("LucyMcGowan/parkhoppr") 18 | ``` 19 | 20 | Example 21 | ------- 22 | 23 | There is currently just one function - you can get wait times for rides at Disney World✨. 24 | 25 | ``` r 26 | ## load the library 27 | library("parkhoppr") 28 | ## by default, get_wait_times() outputs Magic Kingdom wait times 29 | get_wait_times() 30 | #> # A tibble: 78 x 7 31 | #> name wait_time fast_pass 32 | #> 33 | #> 1 Stitch's Great Escape! NA FALSE 34 | #> 2 Monsters, Inc. Laugh Floor 20 TRUE 35 | #> 3 Walt Disney World Railroad - Frontierland NA FALSE 36 | #> 4 Walt Disney's Enchanted Tiki Room NA FALSE 37 | #> 5 Sorcerers of the Magic Kingdom NA FALSE 38 | #> 6 The Barnstormer 35 TRUE 39 | #> 7 Walt Disney World Railroad - Fantasyland NA FALSE 40 | #> 8 Casey Jr. Splash 'N' Soak Station NA FALSE 41 | #> 9 Cinderella Castle NA FALSE 42 | #> 10 Under the Sea - Journey of The Little Mermaid 10 TRUE 43 | #> # ... with 68 more rows, and 4 more variables: status , 44 | #> # single_rider , type , wait_time_lst 45 | ``` 46 | 47 | You can specify the Disney World park you would like to retrieve wait times for using the `park` parameter. 48 | 49 | ``` r 50 | get_wait_times(park = "hollywood_studios") 51 | #> # A tibble: 43 x 7 52 | #> name wait_time fast_pass 53 | #> 54 | #> 1 Lights, Motors, Action! Extreme Stunt Show NA FALSE 55 | #> 2 Toy Story Mania! 45 TRUE 56 | #> 3 Wandering Oaken's Frozen Snowground NA FALSE 57 | #> 4 Take-Along Olaf NA FALSE 58 | #> 5 Star Wars: Rebels - The Ultimate Guide NA FALSE 59 | #> 6 "\"Frozen Fever\" Short Film" NA FALSE 60 | #> 7 Star Wars Launch Bay NA FALSE 61 | #> 8 Star Wars: Path of the Jedi NA FALSE 62 | #> 9 Star Wars at Walt Disney World Resort NA FALSE 63 | #> 10 Star Wars Photo Opportunities NA FALSE 64 | #> # ... with 33 more rows, and 4 more variables: status , 65 | #> # single_rider , type , wait_time_lst 66 | ``` 67 | 68 | have some fun! 69 | -------------- 70 | 71 | ``` r 72 | library("dplyr") 73 | library("ggplot2") 74 | get_wait_times() %>% 75 | filter(fast_pass == TRUE) %>% 76 | mutate(wait_cat = case_when( 77 | wait_time >= 45 ~ "bad", 78 | wait_time >= 25 & wait_time < 45 ~ "ok", 79 | wait_time < 25 ~ "good" 80 | )) %>% 81 | arrange(wait_time) %>% 82 | mutate(name = forcats::fct_reorder(name, wait_time)) %>% 83 | ggplot(aes(name, wait_time, fill = wait_cat)) + 84 | geom_bar(stat = "identity") + 85 | theme(axis.text.x = element_text(angle = 45, hjust = 1), 86 | legend.position = "none", 87 | plot.margin = unit(c(0.1, 0.1, 0.1, 2), "cm")) + 88 | xlab("") + 89 | ylab("wait time") 90 | ``` 91 | 92 | ![](README-unnamed-chunk-3-1.png) 93 | 94 | *Shout out to the [themeparks](https://github.com/cubehouse/themeparks) library that inspired this little jaunt!* 95 | --------------------------------------------------------------------------------