Class: PostSecurityAPIValidationBodySchema

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



27111
27112
27113
27114
27115
27116
27117
27118
# File 'lib/schemas.rb', line 27111

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    language:                                      d.fetch("language"),
    schema:                                        d.fetch("schema"),
    post_security_api_validation_body_schema_type: d.fetch("type"),
  )
end

.from_json!(json) ⇒ Object



27120
27121
27122
# File 'lib/schemas.rb', line 27120

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



27124
27125
27126
27127
27128
27129
27130
# File 'lib/schemas.rb', line 27124

def to_dynamic
  {
    "language" => language,
    "schema"   => schema,
    "type"     => post_security_api_validation_body_schema_type,
  }
end

#to_json(options = nil) ⇒ Object



27132
27133
27134
# File 'lib/schemas.rb', line 27132

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end