# College Football Data API
#
# This is an API for accessing all sorts of college football data. It currently has a wide array of data ranging from play by play to player statistics to game scores and more.
#
# OpenAPI spec version: 2.3.5
# Contact: admin@collegefootballdata.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' Play Class
#'
#' @field id
#' @field drive_id
#' @field game_id
#' @field drive_number
#' @field play_number
#' @field offense
#' @field offense_conference
#' @field offense_score
#' @field defense
#' @field home
#' @field away
#' @field defense_conference
#' @field defense_score
#' @field period
#' @field clock
#' @field offense_timeouts
#' @field defense_timeouts
#' @field yard_line
#' @field yards_to_goal
#' @field down
#' @field distance
#' @field yards_gained
#' @field scoring
#' @field play_type
#' @field play_text
#' @field ppa
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Play <- R6::R6Class(
'Play',
public = list(
`id` = NULL,
`drive_id` = NULL,
`game_id` = NULL,
`drive_number` = NULL,
`play_number` = NULL,
`offense` = NULL,
`offense_conference` = NULL,
`offense_score` = NULL,
`defense` = NULL,
`home` = NULL,
`away` = NULL,
`defense_conference` = NULL,
`defense_score` = NULL,
`period` = NULL,
`clock` = NULL,
`offense_timeouts` = NULL,
`defense_timeouts` = NULL,
`yard_line` = NULL,
`yards_to_goal` = NULL,
`down` = NULL,
`distance` = NULL,
`yards_gained` = NULL,
`scoring` = NULL,
`play_type` = NULL,
`play_text` = NULL,
`ppa` = NULL,
initialize = function(`id`, `drive_id`, `game_id`, `drive_number`, `play_number`, `offense`, `offense_conference`, `offense_score`, `defense`, `home`, `away`, `defense_conference`, `defense_score`, `period`, `clock`, `offense_timeouts`, `defense_timeouts`, `yard_line`, `yards_to_goal`, `down`, `distance`, `yards_gained`, `scoring`, `play_type`, `play_text`, `ppa`){
if (!missing(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
self$`id` <- `id`
}
if (!missing(`drive_id`)) {
stopifnot(is.numeric(`drive_id`), length(`drive_id`) == 1)
self$`drive_id` <- `drive_id`
}
if (!missing(`game_id`)) {
stopifnot(is.numeric(`game_id`), length(`game_id`) == 1)
self$`game_id` <- `game_id`
}
if (!missing(`drive_number`)) {
stopifnot(is.numeric(`drive_number`), length(`drive_number`) == 1)
self$`drive_number` <- `drive_number`
}
if (!missing(`play_number`)) {
stopifnot(is.numeric(`play_number`), length(`play_number`) == 1)
self$`play_number` <- `play_number`
}
if (!missing(`offense`)) {
stopifnot(is.character(`offense`), length(`offense`) == 1)
self$`offense` <- `offense`
}
if (!missing(`offense_conference`)) {
stopifnot(is.character(`offense_conference`), length(`offense_conference`) == 1)
self$`offense_conference` <- `offense_conference`
}
if (!missing(`offense_score`)) {
stopifnot(is.numeric(`offense_score`), length(`offense_score`) == 1)
self$`offense_score` <- `offense_score`
}
if (!missing(`defense`)) {
stopifnot(is.character(`defense`), length(`defense`) == 1)
self$`defense` <- `defense`
}
if (!missing(`home`)) {
stopifnot(is.character(`home`), length(`home`) == 1)
self$`home` <- `home`
}
if (!missing(`away`)) {
stopifnot(is.character(`away`), length(`away`) == 1)
self$`away` <- `away`
}
if (!missing(`defense_conference`)) {
stopifnot(is.character(`defense_conference`), length(`defense_conference`) == 1)
self$`defense_conference` <- `defense_conference`
}
if (!missing(`defense_score`)) {
stopifnot(is.numeric(`defense_score`), length(`defense_score`) == 1)
self$`defense_score` <- `defense_score`
}
if (!missing(`period`)) {
stopifnot(is.numeric(`period`), length(`period`) == 1)
self$`period` <- `period`
}
if (!missing(`clock`)) {
stopifnot(R6::is.R6(`clock`))
self$`clock` <- `clock`
}
if (!missing(`offense_timeouts`)) {
stopifnot(is.numeric(`offense_timeouts`), length(`offense_timeouts`) == 1)
self$`offense_timeouts` <- `offense_timeouts`
}
if (!missing(`defense_timeouts`)) {
stopifnot(is.numeric(`defense_timeouts`), length(`defense_timeouts`) == 1)
self$`defense_timeouts` <- `defense_timeouts`
}
if (!missing(`yard_line`)) {
stopifnot(is.numeric(`yard_line`), length(`yard_line`) == 1)
self$`yard_line` <- `yard_line`
}
if (!missing(`yards_to_goal`)) {
stopifnot(is.numeric(`yards_to_goal`), length(`yards_to_goal`) == 1)
self$`yards_to_goal` <- `yards_to_goal`
}
if (!missing(`down`)) {
stopifnot(is.numeric(`down`), length(`down`) == 1)
self$`down` <- `down`
}
if (!missing(`distance`)) {
stopifnot(is.numeric(`distance`), length(`distance`) == 1)
self$`distance` <- `distance`
}
if (!missing(`yards_gained`)) {
stopifnot(is.numeric(`yards_gained`), length(`yards_gained`) == 1)
self$`yards_gained` <- `yards_gained`
}
if (!missing(`scoring`)) {
self$`scoring` <- `scoring`
}
if (!missing(`play_type`)) {
stopifnot(is.character(`play_type`), length(`play_type`) == 1)
self$`play_type` <- `play_type`
}
if (!missing(`play_text`)) {
stopifnot(is.character(`play_text`), length(`play_text`) == 1)
self$`play_text` <- `play_text`
}
if (!missing(`ppa`)) {
self$`ppa` <- `ppa`
}
},
toJSON = function() {
PlayObject <- list()
if (!is.null(self$`id`)) {
PlayObject[['id']] <- self$`id`
}
if (!is.null(self$`drive_id`)) {
PlayObject[['drive_id']] <- self$`drive_id`
}
if (!is.null(self$`game_id`)) {
PlayObject[['game_id']] <- self$`game_id`
}
if (!is.null(self$`drive_number`)) {
PlayObject[['drive_number']] <- self$`drive_number`
}
if (!is.null(self$`play_number`)) {
PlayObject[['play_number']] <- self$`play_number`
}
if (!is.null(self$`offense`)) {
PlayObject[['offense']] <- self$`offense`
}
if (!is.null(self$`offense_conference`)) {
PlayObject[['offense_conference']] <- self$`offense_conference`
}
if (!is.null(self$`offense_score`)) {
PlayObject[['offense_score']] <- self$`offense_score`
}
if (!is.null(self$`defense`)) {
PlayObject[['defense']] <- self$`defense`
}
if (!is.null(self$`home`)) {
PlayObject[['home']] <- self$`home`
}
if (!is.null(self$`away`)) {
PlayObject[['away']] <- self$`away`
}
if (!is.null(self$`defense_conference`)) {
PlayObject[['defense_conference']] <- self$`defense_conference`
}
if (!is.null(self$`defense_score`)) {
PlayObject[['defense_score']] <- self$`defense_score`
}
if (!is.null(self$`period`)) {
PlayObject[['period']] <- self$`period`
}
if (!is.null(self$`clock`)) {
PlayObject[['clock']] <- self$`clock`$toJSON()
}
if (!is.null(self$`offense_timeouts`)) {
PlayObject[['offense_timeouts']] <- self$`offense_timeouts`
}
if (!is.null(self$`defense_timeouts`)) {
PlayObject[['defense_timeouts']] <- self$`defense_timeouts`
}
if (!is.null(self$`yard_line`)) {
PlayObject[['yard_line']] <- self$`yard_line`
}
if (!is.null(self$`yards_to_goal`)) {
PlayObject[['yards_to_goal']] <- self$`yards_to_goal`
}
if (!is.null(self$`down`)) {
PlayObject[['down']] <- self$`down`
}
if (!is.null(self$`distance`)) {
PlayObject[['distance']] <- self$`distance`
}
if (!is.null(self$`yards_gained`)) {
PlayObject[['yards_gained']] <- self$`yards_gained`
}
if (!is.null(self$`scoring`)) {
PlayObject[['scoring']] <- self$`scoring`
}
if (!is.null(self$`play_type`)) {
PlayObject[['play_type']] <- self$`play_type`
}
if (!is.null(self$`play_text`)) {
PlayObject[['play_text']] <- self$`play_text`
}
if (!is.null(self$`ppa`)) {
PlayObject[['ppa']] <- self$`ppa`
}
PlayObject
},
fromJSON = function(PlayJson) {
PlayObject <- jsonlite::fromJSON(PlayJson)
if (!is.null(PlayObject$`id`)) {
self$`id` <- PlayObject$`id`
}
if (!is.null(PlayObject$`drive_id`)) {
self$`drive_id` <- PlayObject$`drive_id`
}
if (!is.null(PlayObject$`game_id`)) {
self$`game_id` <- PlayObject$`game_id`
}
if (!is.null(PlayObject$`drive_number`)) {
self$`drive_number` <- PlayObject$`drive_number`
}
if (!is.null(PlayObject$`play_number`)) {
self$`play_number` <- PlayObject$`play_number`
}
if (!is.null(PlayObject$`offense`)) {
self$`offense` <- PlayObject$`offense`
}
if (!is.null(PlayObject$`offense_conference`)) {
self$`offense_conference` <- PlayObject$`offense_conference`
}
if (!is.null(PlayObject$`offense_score`)) {
self$`offense_score` <- PlayObject$`offense_score`
}
if (!is.null(PlayObject$`defense`)) {
self$`defense` <- PlayObject$`defense`
}
if (!is.null(PlayObject$`home`)) {
self$`home` <- PlayObject$`home`
}
if (!is.null(PlayObject$`away`)) {
self$`away` <- PlayObject$`away`
}
if (!is.null(PlayObject$`defense_conference`)) {
self$`defense_conference` <- PlayObject$`defense_conference`
}
if (!is.null(PlayObject$`defense_score`)) {
self$`defense_score` <- PlayObject$`defense_score`
}
if (!is.null(PlayObject$`period`)) {
self$`period` <- PlayObject$`period`
}
if (!is.null(PlayObject$`clock`)) {
clockObject <- DriveStartTime$new()
clockObject$fromJSON(jsonlite::toJSON(PlayObject$clock, auto_unbox = TRUE))
self$`clock` <- clockObject
}
if (!is.null(PlayObject$`offense_timeouts`)) {
self$`offense_timeouts` <- PlayObject$`offense_timeouts`
}
if (!is.null(PlayObject$`defense_timeouts`)) {
self$`defense_timeouts` <- PlayObject$`defense_timeouts`
}
if (!is.null(PlayObject$`yard_line`)) {
self$`yard_line` <- PlayObject$`yard_line`
}
if (!is.null(PlayObject$`yards_to_goal`)) {
self$`yards_to_goal` <- PlayObject$`yards_to_goal`
}
if (!is.null(PlayObject$`down`)) {
self$`down` <- PlayObject$`down`
}
if (!is.null(PlayObject$`distance`)) {
self$`distance` <- PlayObject$`distance`
}
if (!is.null(PlayObject$`yards_gained`)) {
self$`yards_gained` <- PlayObject$`yards_gained`
}
if (!is.null(PlayObject$`scoring`)) {
self$`scoring` <- PlayObject$`scoring`
}
if (!is.null(PlayObject$`play_type`)) {
self$`play_type` <- PlayObject$`play_type`
}
if (!is.null(PlayObject$`play_text`)) {
self$`play_text` <- PlayObject$`play_text`
}
if (!is.null(PlayObject$`ppa`)) {
self$`ppa` <- PlayObject$`ppa`
}
},
toJSONString = function() {
sprintf(
'{
"id": %d,
"drive_id": %d,
"game_id": %d,
"drive_number": %d,
"play_number": %d,
"offense": %s,
"offense_conference": %s,
"offense_score": %d,
"defense": %s,
"home": %s,
"away": %s,
"defense_conference": %s,
"defense_score": %d,
"period": %d,
"clock": %s,
"offense_timeouts": %d,
"defense_timeouts": %d,
"yard_line": %d,
"yards_to_goal": %d,
"down": %d,
"distance": %d,
"yards_gained": %d,
"scoring": %s,
"play_type": %s,
"play_text": %s,
"ppa": %s
}',
self$`id`,
self$`drive_id`,
self$`game_id`,
self$`drive_number`,
self$`play_number`,
self$`offense`,
self$`offense_conference`,
self$`offense_score`,
self$`defense`,
self$`home`,
self$`away`,
self$`defense_conference`,
self$`defense_score`,
self$`period`,
self$`clock`$toJSON(),
self$`offense_timeouts`,
self$`defense_timeouts`,
self$`yard_line`,
self$`yards_to_goal`,
self$`down`,
self$`distance`,
self$`yards_gained`,
self$`scoring`,
self$`play_type`,
self$`play_text`,
self$`ppa`
)
},
fromJSONString = function(PlayJson) {
PlayObject <- jsonlite::fromJSON(PlayJson)
self$`id` <- PlayObject$`id`
self$`drive_id` <- PlayObject$`drive_id`
self$`game_id` <- PlayObject$`game_id`
self$`drive_number` <- PlayObject$`drive_number`
self$`play_number` <- PlayObject$`play_number`
self$`offense` <- PlayObject$`offense`
self$`offense_conference` <- PlayObject$`offense_conference`
self$`offense_score` <- PlayObject$`offense_score`
self$`defense` <- PlayObject$`defense`
self$`home` <- PlayObject$`home`
self$`away` <- PlayObject$`away`
self$`defense_conference` <- PlayObject$`defense_conference`
self$`defense_score` <- PlayObject$`defense_score`
self$`period` <- PlayObject$`period`
DriveStartTimeObject <- DriveStartTime$new()
self$`clock` <- DriveStartTimeObject$fromJSON(jsonlite::toJSON(PlayObject$clock, auto_unbox = TRUE))
self$`offense_timeouts` <- PlayObject$`offense_timeouts`
self$`defense_timeouts` <- PlayObject$`defense_timeouts`
self$`yard_line` <- PlayObject$`yard_line`
self$`yards_to_goal` <- PlayObject$`yards_to_goal`
self$`down` <- PlayObject$`down`
self$`distance` <- PlayObject$`distance`
self$`yards_gained` <- PlayObject$`yards_gained`
self$`scoring` <- PlayObject$`scoring`
self$`play_type` <- PlayObject$`play_type`
self$`play_text` <- PlayObject$`play_text`
self$`ppa` <- PlayObject$`ppa`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.