R/PlayerGameSchool.r

# 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


#' PlayerGameSchool Class
#'
#' @field name 
#' @field conference 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PlayerGameSchool <- R6::R6Class(
  'PlayerGameSchool',
  public = list(
    `name` = NULL,
    `conference` = NULL,
    initialize = function(`name`, `conference`){
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`conference`)) {
        stopifnot(is.character(`conference`), length(`conference`) == 1)
        self$`conference` <- `conference`
      }
    },
    toJSON = function() {
      PlayerGameSchoolObject <- list()
      if (!is.null(self$`name`)) {
        PlayerGameSchoolObject[['name']] <- self$`name`
      }
      if (!is.null(self$`conference`)) {
        PlayerGameSchoolObject[['conference']] <- self$`conference`
      }

      PlayerGameSchoolObject
    },
    fromJSON = function(PlayerGameSchoolJson) {
      PlayerGameSchoolObject <- jsonlite::fromJSON(PlayerGameSchoolJson)
      if (!is.null(PlayerGameSchoolObject$`name`)) {
        self$`name` <- PlayerGameSchoolObject$`name`
      }
      if (!is.null(PlayerGameSchoolObject$`conference`)) {
        self$`conference` <- PlayerGameSchoolObject$`conference`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "name": %s,
           "conference": %s
        }',
        self$`name`,
        self$`conference`
      )
    },
    fromJSONString = function(PlayerGameSchoolJson) {
      PlayerGameSchoolObject <- jsonlite::fromJSON(PlayerGameSchoolJson)
      self$`name` <- PlayerGameSchoolObject$`name`
      self$`conference` <- PlayerGameSchoolObject$`conference`
    }
  )
)
saiemgilani/cfbd-api-R documentation built on Feb. 16, 2021, 12:07 a.m.