# 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
#' PregameWP Class
#'
#' @field season
#' @field seasonType
#' @field week
#' @field gameId
#' @field homeTeam
#' @field awayTeam
#' @field spread
#' @field homeWinProb
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PregameWP <- R6::R6Class(
'PregameWP',
public = list(
`season` = NULL,
`seasonType` = NULL,
`week` = NULL,
`gameId` = NULL,
`homeTeam` = NULL,
`awayTeam` = NULL,
`spread` = NULL,
`homeWinProb` = NULL,
initialize = function(`season`, `seasonType`, `week`, `gameId`, `homeTeam`, `awayTeam`, `spread`, `homeWinProb`){
if (!missing(`season`)) {
stopifnot(is.numeric(`season`), length(`season`) == 1)
self$`season` <- `season`
}
if (!missing(`seasonType`)) {
stopifnot(is.character(`seasonType`), length(`seasonType`) == 1)
self$`seasonType` <- `seasonType`
}
if (!missing(`week`)) {
stopifnot(is.numeric(`week`), length(`week`) == 1)
self$`week` <- `week`
}
if (!missing(`gameId`)) {
stopifnot(is.numeric(`gameId`), length(`gameId`) == 1)
self$`gameId` <- `gameId`
}
if (!missing(`homeTeam`)) {
stopifnot(is.character(`homeTeam`), length(`homeTeam`) == 1)
self$`homeTeam` <- `homeTeam`
}
if (!missing(`awayTeam`)) {
stopifnot(is.character(`awayTeam`), length(`awayTeam`) == 1)
self$`awayTeam` <- `awayTeam`
}
if (!missing(`spread`)) {
self$`spread` <- `spread`
}
if (!missing(`homeWinProb`)) {
self$`homeWinProb` <- `homeWinProb`
}
},
toJSON = function() {
PregameWPObject <- list()
if (!is.null(self$`season`)) {
PregameWPObject[['season']] <- self$`season`
}
if (!is.null(self$`seasonType`)) {
PregameWPObject[['seasonType']] <- self$`seasonType`
}
if (!is.null(self$`week`)) {
PregameWPObject[['week']] <- self$`week`
}
if (!is.null(self$`gameId`)) {
PregameWPObject[['gameId']] <- self$`gameId`
}
if (!is.null(self$`homeTeam`)) {
PregameWPObject[['homeTeam']] <- self$`homeTeam`
}
if (!is.null(self$`awayTeam`)) {
PregameWPObject[['awayTeam']] <- self$`awayTeam`
}
if (!is.null(self$`spread`)) {
PregameWPObject[['spread']] <- self$`spread`
}
if (!is.null(self$`homeWinProb`)) {
PregameWPObject[['homeWinProb']] <- self$`homeWinProb`
}
PregameWPObject
},
fromJSON = function(PregameWPJson) {
PregameWPObject <- jsonlite::fromJSON(PregameWPJson)
if (!is.null(PregameWPObject$`season`)) {
self$`season` <- PregameWPObject$`season`
}
if (!is.null(PregameWPObject$`seasonType`)) {
self$`seasonType` <- PregameWPObject$`seasonType`
}
if (!is.null(PregameWPObject$`week`)) {
self$`week` <- PregameWPObject$`week`
}
if (!is.null(PregameWPObject$`gameId`)) {
self$`gameId` <- PregameWPObject$`gameId`
}
if (!is.null(PregameWPObject$`homeTeam`)) {
self$`homeTeam` <- PregameWPObject$`homeTeam`
}
if (!is.null(PregameWPObject$`awayTeam`)) {
self$`awayTeam` <- PregameWPObject$`awayTeam`
}
if (!is.null(PregameWPObject$`spread`)) {
self$`spread` <- PregameWPObject$`spread`
}
if (!is.null(PregameWPObject$`homeWinProb`)) {
self$`homeWinProb` <- PregameWPObject$`homeWinProb`
}
},
toJSONString = function() {
sprintf(
'{
"season": %d,
"seasonType": %s,
"week": %d,
"gameId": %d,
"homeTeam": %s,
"awayTeam": %s,
"spread": %s,
"homeWinProb": %s
}',
self$`season`,
self$`seasonType`,
self$`week`,
self$`gameId`,
self$`homeTeam`,
self$`awayTeam`,
self$`spread`,
self$`homeWinProb`
)
},
fromJSONString = function(PregameWPJson) {
PregameWPObject <- jsonlite::fromJSON(PregameWPJson)
self$`season` <- PregameWPObject$`season`
self$`seasonType` <- PregameWPObject$`seasonType`
self$`week` <- PregameWPObject$`week`
self$`gameId` <- PregameWPObject$`gameId`
self$`homeTeam` <- PregameWPObject$`homeTeam`
self$`awayTeam` <- PregameWPObject$`awayTeam`
self$`spread` <- PregameWPObject$`spread`
self$`homeWinProb` <- PregameWPObject$`homeWinProb`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.