# 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
#' GamePPA Class
#'
#' @field id
#' @field season
#' @field week
#' @field team
#' @field conference
#' @field opponnent
#' @field offense
#' @field defense
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
GamePPA <- R6::R6Class(
'GamePPA',
public = list(
`id` = NULL,
`season` = NULL,
`week` = NULL,
`team` = NULL,
`conference` = NULL,
`opponnent` = NULL,
`offense` = NULL,
`defense` = NULL,
initialize = function(`id`, `season`, `week`, `team`, `conference`, `opponnent`, `offense`, `defense`){
if (!missing(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
self$`id` <- `id`
}
if (!missing(`season`)) {
stopifnot(is.numeric(`season`), length(`season`) == 1)
self$`season` <- `season`
}
if (!missing(`week`)) {
stopifnot(is.numeric(`week`), length(`week`) == 1)
self$`week` <- `week`
}
if (!missing(`team`)) {
stopifnot(is.character(`team`), length(`team`) == 1)
self$`team` <- `team`
}
if (!missing(`conference`)) {
stopifnot(is.character(`conference`), length(`conference`) == 1)
self$`conference` <- `conference`
}
if (!missing(`opponnent`)) {
stopifnot(is.character(`opponnent`), length(`opponnent`) == 1)
self$`opponnent` <- `opponnent`
}
if (!missing(`offense`)) {
stopifnot(R6::is.R6(`offense`))
self$`offense` <- `offense`
}
if (!missing(`defense`)) {
stopifnot(R6::is.R6(`defense`))
self$`defense` <- `defense`
}
},
toJSON = function() {
GamePPAObject <- list()
if (!is.null(self$`id`)) {
GamePPAObject[['id']] <- self$`id`
}
if (!is.null(self$`season`)) {
GamePPAObject[['season']] <- self$`season`
}
if (!is.null(self$`week`)) {
GamePPAObject[['week']] <- self$`week`
}
if (!is.null(self$`team`)) {
GamePPAObject[['team']] <- self$`team`
}
if (!is.null(self$`conference`)) {
GamePPAObject[['conference']] <- self$`conference`
}
if (!is.null(self$`opponnent`)) {
GamePPAObject[['opponnent']] <- self$`opponnent`
}
if (!is.null(self$`offense`)) {
GamePPAObject[['offense']] <- self$`offense`$toJSON()
}
if (!is.null(self$`defense`)) {
GamePPAObject[['defense']] <- self$`defense`$toJSON()
}
GamePPAObject
},
fromJSON = function(GamePPAJson) {
GamePPAObject <- jsonlite::fromJSON(GamePPAJson)
if (!is.null(GamePPAObject$`id`)) {
self$`id` <- GamePPAObject$`id`
}
if (!is.null(GamePPAObject$`season`)) {
self$`season` <- GamePPAObject$`season`
}
if (!is.null(GamePPAObject$`week`)) {
self$`week` <- GamePPAObject$`week`
}
if (!is.null(GamePPAObject$`team`)) {
self$`team` <- GamePPAObject$`team`
}
if (!is.null(GamePPAObject$`conference`)) {
self$`conference` <- GamePPAObject$`conference`
}
if (!is.null(GamePPAObject$`opponnent`)) {
self$`opponnent` <- GamePPAObject$`opponnent`
}
if (!is.null(GamePPAObject$`offense`)) {
offenseObject <- GamePPAOffense$new()
offenseObject$fromJSON(jsonlite::toJSON(GamePPAObject$offense, auto_unbox = TRUE))
self$`offense` <- offenseObject
}
if (!is.null(GamePPAObject$`defense`)) {
defenseObject <- GamePPAOffense$new()
defenseObject$fromJSON(jsonlite::toJSON(GamePPAObject$defense, auto_unbox = TRUE))
self$`defense` <- defenseObject
}
},
toJSONString = function() {
sprintf(
'{
"id": %d,
"season": %d,
"week": %d,
"team": %s,
"conference": %s,
"opponnent": %s,
"offense": %s,
"defense": %s
}',
self$`id`,
self$`season`,
self$`week`,
self$`team`,
self$`conference`,
self$`opponnent`,
self$`offense`$toJSON(),
self$`defense`$toJSON()
)
},
fromJSONString = function(GamePPAJson) {
GamePPAObject <- jsonlite::fromJSON(GamePPAJson)
self$`id` <- GamePPAObject$`id`
self$`season` <- GamePPAObject$`season`
self$`week` <- GamePPAObject$`week`
self$`team` <- GamePPAObject$`team`
self$`conference` <- GamePPAObject$`conference`
self$`opponnent` <- GamePPAObject$`opponnent`
GamePPAOffenseObject <- GamePPAOffense$new()
self$`offense` <- GamePPAOffenseObject$fromJSON(jsonlite::toJSON(GamePPAObject$offense, auto_unbox = TRUE))
GamePPAOffenseObject <- GamePPAOffense$new()
self$`defense` <- GamePPAOffenseObject$fromJSON(jsonlite::toJSON(GamePPAObject$defense, auto_unbox = TRUE))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.