# 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
#' DeclaredGoods Class
#'
#' @field hs_code
#' @field goods_description
#' @field value
#' @field currency
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DeclaredGoods <- R6::R6Class(
'DeclaredGoods',
public = list(
`hs_code` = NULL,
`goods_description` = NULL,
`value` = NULL,
`currency` = NULL,
initialize = function(`hs_code`, `goods_description`, `value`, `currency`){
if (!missing(`hs_code`)) {
stopifnot(is.character(`hs_code`), length(`hs_code`) == 1)
self$`hs_code` <- `hs_code`
}
if (!missing(`goods_description`)) {
stopifnot(is.character(`goods_description`), length(`goods_description`) == 1)
self$`goods_description` <- `goods_description`
}
if (!missing(`value`)) {
stopifnot(is.numeric(`value`), length(`value`) == 1)
stopifnot(R6::is.R6(`value`))
self$`value` <- `value`
}
if (!missing(`currency`)) {
stopifnot(is.character(`currency`), length(`currency`) == 1)
self$`currency` <- `currency`
}
},
toJSON = function() {
DeclaredGoodsObject <- list()
if (!is.null(self$`hs_code`)) {
DeclaredGoodsObject[['hs_code']] <- self$`hs_code`
}
if (!is.null(self$`goods_description`)) {
DeclaredGoodsObject[['goods_description']] <- self$`goods_description`
}
if (!is.null(self$`value`)) {
DeclaredGoodsObject[['value']] <- self$`value`$toJSON()
}
if (!is.null(self$`currency`)) {
DeclaredGoodsObject[['currency']] <- self$`currency`
}
DeclaredGoodsObject
},
fromJSON = function(DeclaredGoodsJson) {
DeclaredGoodsObject <- jsonlite::fromJSON(DeclaredGoodsJson)
if (!is.null(DeclaredGoodsObject$`hs_code`)) {
self$`hs_code` <- DeclaredGoodsObject$`hs_code`
}
if (!is.null(DeclaredGoodsObject$`goods_description`)) {
self$`goods_description` <- DeclaredGoodsObject$`goods_description`
}
if (!is.null(DeclaredGoodsObject$`value`)) {
valueObject <- BigDecimal$new()
valueObject$fromJSON(jsonlite::toJSON(DeclaredGoodsObject$value, auto_unbox = TRUE))
self$`value` <- valueObject
}
if (!is.null(DeclaredGoodsObject$`currency`)) {
self$`currency` <- DeclaredGoodsObject$`currency`
}
},
toJSONString = function() {
sprintf(
'{
"hs_code": %s,
"goods_description": %s,
"value": %s,
"currency": %s
}',
self$`hs_code`,
self$`goods_description`,
self$`value`$toJSON(),
self$`currency`
)
},
fromJSONString = function(DeclaredGoodsJson) {
DeclaredGoodsObject <- jsonlite::fromJSON(DeclaredGoodsJson)
self$`hs_code` <- DeclaredGoodsObject$`hs_code`
self$`goods_description` <- DeclaredGoodsObject$`goods_description`
BigDecimalObject <- BigDecimal$new()
self$`value` <- BigDecimalObject$fromJSON(jsonlite::toJSON(DeclaredGoodsObject$value, auto_unbox = TRUE))
self$`currency` <- DeclaredGoodsObject$`currency`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.