Class: DdbRuby::FifthEdition::BackgroundDuration
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::BackgroundDuration
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1366 1367 1368 1369 1370 1371 1372 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1366 def self.from_dynamic!(d) d = Types::Hash[d] new( duration_interval: d.fetch("durationInterval"), duration_unit: d.fetch("durationUnit"), ) end |
.from_json!(json) ⇒ Object
1374 1375 1376 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1374 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1378 1379 1380 1381 1382 1383 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1378 def to_dynamic { "durationInterval" => duration_interval, "durationUnit" => duration_unit, } end |
#to_json(options = nil) ⇒ Object
1385 1386 1387 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1385 def to_json( = nil) JSON.generate(to_dynamic, ) end |