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