Class: DdbRuby::FifthEdition::CustomBackground
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::CustomBackground
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 370 def self.from_dynamic!(d) d = Types::Hash[d] new( id: d.fetch("id"), entity_type_id: d.fetch("entityTypeId"), custom_background_name: d.fetch("name"), description: d.fetch("description"), features_background: d.fetch("featuresBackground"), characteristics_background: d.fetch("characteristicsBackground"), features_background_definition_id: d.fetch("featuresBackgroundDefinitionId"), characteristics_background_definition_id: d.fetch("characteristicsBackgroundDefinitionId"), background_type: d.fetch("backgroundType"), ) end |
.from_json!(json) ⇒ Object
385 386 387 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 385 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 389 def to_dynamic { "id" => id, "entityTypeId" => entity_type_id, "name" => custom_background_name, "description" => description, "featuresBackground" => features_background, "characteristicsBackground" => characteristics_background, "featuresBackgroundDefinitionId" => features_background_definition_id, "characteristicsBackgroundDefinitionId" => characteristics_background_definition_id, "backgroundType" => background_type, } end |
#to_json(options = nil) ⇒ Object
403 404 405 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 403 def to_json( = nil) JSON.generate(to_dynamic, ) end |