class Vellum::VellumVariable
def self.from_json(json_object:)
-
(VellumVariable)-
Parameters:
-
json_object(JSON) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id key = struct.key type = VELLUM_VARIABLE_TYPE.key(parsed_json["type"]) || parsed_json["type"] new(id: id, key: key, type: type, additional_properties: struct) end
def self.validate_raw(obj:)
-
(Void)-
Parameters:
-
obj(Object) --
def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.") obj.type.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end
def initialize(id:, key:, type:, additional_properties: nil)
-
(VellumVariable)-
Parameters:
-
additional_properties(OpenStruct) -- Additional properties unmapped to the current class definition -
type(VELLUM_VARIABLE_TYPE) -- -
key(String) -- -
id(String) --
def initialize(id:, key:, type:, additional_properties: nil) # @type [String] @id = id # @type [String] @key = key # @type [VELLUM_VARIABLE_TYPE] @type = type # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end
def to_json(*_args)
-
(JSON)-
def to_json(*_args) { "id": @id, "key": @key, "type": VELLUM_VARIABLE_TYPE[@type] || @type }.to_json end