R/RankingWeekRanks.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


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

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