# 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
#' BoxScore Class
#'
#' @field teams
#' @field players
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BoxScore <- R6::R6Class(
'BoxScore',
public = list(
`teams` = NULL,
`players` = NULL,
initialize = function(`teams`, `players`){
if (!missing(`teams`)) {
stopifnot(R6::is.R6(`teams`))
self$`teams` <- `teams`
}
if (!missing(`players`)) {
stopifnot(R6::is.R6(`players`))
self$`players` <- `players`
}
},
toJSON = function() {
BoxScoreObject <- list()
if (!is.null(self$`teams`)) {
BoxScoreObject[['teams']] <- self$`teams`$toJSON()
}
if (!is.null(self$`players`)) {
BoxScoreObject[['players']] <- self$`players`$toJSON()
}
BoxScoreObject
},
fromJSON = function(BoxScoreJson) {
BoxScoreObject <- jsonlite::fromJSON(BoxScoreJson)
if (!is.null(BoxScoreObject$`teams`)) {
teamsObject <- BoxScoreTeams$new()
teamsObject$fromJSON(jsonlite::toJSON(BoxScoreObject$teams, auto_unbox = TRUE))
self$`teams` <- teamsObject
}
if (!is.null(BoxScoreObject$`players`)) {
playersObject <- BoxScorePlayers$new()
playersObject$fromJSON(jsonlite::toJSON(BoxScoreObject$players, auto_unbox = TRUE))
self$`players` <- playersObject
}
},
toJSONString = function() {
sprintf(
'{
"teams": %s,
"players": %s
}',
self$`teams`$toJSON(),
self$`players`$toJSON()
)
},
fromJSONString = function(BoxScoreJson) {
BoxScoreObject <- jsonlite::fromJSON(BoxScoreJson)
BoxScoreTeamsObject <- BoxScoreTeams$new()
self$`teams` <- BoxScoreTeamsObject$fromJSON(jsonlite::toJSON(BoxScoreObject$teams, auto_unbox = TRUE))
BoxScorePlayersObject <- BoxScorePlayers$new()
self$`players` <- BoxScorePlayersObject$fromJSON(jsonlite::toJSON(BoxScoreObject$players, auto_unbox = TRUE))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.