# Altana Atlas API
#
# Altana Atlas for Regulatory Risk and Trade Compliance
#
# OpenAPI spec version: {{ version or \"v0.0.1\" }}
# Contact: engineering@altanatech.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' PredictedGoods Class
#'
#' @field hs_code
#' @field amount_to_collect
#' @field hs_definition
#' @field tariff
#' @field confidence
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PredictedGoods <- R6::R6Class(
'PredictedGoods',
public = list(
`hs_code` = NULL,
`amount_to_collect` = NULL,
`hs_definition` = NULL,
`tariff` = NULL,
`confidence` = NULL,
initialize = function(`hs_code`, `amount_to_collect`, `hs_definition`, `tariff`, `confidence`){
if (!missing(`hs_code`)) {
stopifnot(is.character(`hs_code`), length(`hs_code`) == 1)
self$`hs_code` <- `hs_code`
}
if (!missing(`amount_to_collect`)) {
stopifnot(is.numeric(`amount_to_collect`), length(`amount_to_collect`) == 1)
stopifnot(R6::is.R6(`amount_to_collect`))
self$`amount_to_collect` <- `amount_to_collect`
}
if (!missing(`hs_definition`)) {
stopifnot(is.character(`hs_definition`), length(`hs_definition`) == 1)
self$`hs_definition` <- `hs_definition`
}
if (!missing(`tariff`)) {
stopifnot(R6::is.R6(`tariff`))
self$`tariff` <- `tariff`
}
if (!missing(`confidence`)) {
stopifnot(is.numeric(`confidence`), length(`confidence`) == 1)
stopifnot(R6::is.R6(`confidence`))
self$`confidence` <- `confidence`
}
},
toJSON = function() {
PredictedGoodsObject <- list()
if (!is.null(self$`hs_code`)) {
PredictedGoodsObject[['hs_code']] <- self$`hs_code`
}
if (!is.null(self$`amount_to_collect`)) {
PredictedGoodsObject[['amount_to_collect']] <- self$`amount_to_collect`$toJSON()
}
if (!is.null(self$`hs_definition`)) {
PredictedGoodsObject[['hs_definition']] <- self$`hs_definition`
}
if (!is.null(self$`tariff`)) {
PredictedGoodsObject[['tariff']] <- self$`tariff`$toJSON()
}
if (!is.null(self$`confidence`)) {
PredictedGoodsObject[['confidence']] <- self$`confidence`$toJSON()
}
PredictedGoodsObject
},
fromJSON = function(PredictedGoodsJson) {
PredictedGoodsObject <- jsonlite::fromJSON(PredictedGoodsJson)
if (!is.null(PredictedGoodsObject$`hs_code`)) {
self$`hs_code` <- PredictedGoodsObject$`hs_code`
}
if (!is.null(PredictedGoodsObject$`amount_to_collect`)) {
amount_to_collectObject <- BigDecimal$new()
amount_to_collectObject$fromJSON(jsonlite::toJSON(PredictedGoodsObject$amount_to_collect, auto_unbox = TRUE))
self$`amount_to_collect` <- amount_to_collectObject
}
if (!is.null(PredictedGoodsObject$`hs_definition`)) {
self$`hs_definition` <- PredictedGoodsObject$`hs_definition`
}
if (!is.null(PredictedGoodsObject$`tariff`)) {
tariffObject <- Tariff$new()
tariffObject$fromJSON(jsonlite::toJSON(PredictedGoodsObject$tariff, auto_unbox = TRUE))
self$`tariff` <- tariffObject
}
if (!is.null(PredictedGoodsObject$`confidence`)) {
confidenceObject <- BigDecimal$new()
confidenceObject$fromJSON(jsonlite::toJSON(PredictedGoodsObject$confidence, auto_unbox = TRUE))
self$`confidence` <- confidenceObject
}
},
toJSONString = function() {
sprintf(
'{
"hs_code": %s,
"amount_to_collect": %s,
"hs_definition": %s,
"tariff": %s,
"confidence": %s
}',
self$`hs_code`,
self$`amount_to_collect`$toJSON(),
self$`hs_definition`,
self$`tariff`$toJSON(),
self$`confidence`$toJSON()
)
},
fromJSONString = function(PredictedGoodsJson) {
PredictedGoodsObject <- jsonlite::fromJSON(PredictedGoodsJson)
self$`hs_code` <- PredictedGoodsObject$`hs_code`
BigDecimalObject <- BigDecimal$new()
self$`amount_to_collect` <- BigDecimalObject$fromJSON(jsonlite::toJSON(PredictedGoodsObject$amount_to_collect, auto_unbox = TRUE))
self$`hs_definition` <- PredictedGoodsObject$`hs_definition`
TariffObject <- Tariff$new()
self$`tariff` <- TariffObject$fromJSON(jsonlite::toJSON(PredictedGoodsObject$tariff, auto_unbox = TRUE))
BigDecimalObject <- BigDecimal$new()
self$`confidence` <- BigDecimalObject$fromJSON(jsonlite::toJSON(PredictedGoodsObject$confidence, auto_unbox = TRUE))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.