Class: DdbRuby::FifthEdition::InventoryLimitedUse
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::InventoryLimitedUse
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3584 3585 3586 3587 3588 3589 3590 3591 3592 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3584 def self.from_dynamic!(d) d = Types::Hash[d] new( max_uses: d.fetch("maxUses"), number_used: d.fetch("numberUsed"), reset_type: d.fetch("resetType"), reset_type_description: d.fetch("resetTypeDescription"), ) end |
.from_json!(json) ⇒ Object
3594 3595 3596 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3594 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3598 3599 3600 3601 3602 3603 3604 3605 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3598 def to_dynamic { "maxUses" => max_uses, "numberUsed" => number_used, "resetType" => reset_type, "resetTypeDescription" => reset_type_description, } end |
#to_json(options = nil) ⇒ Object
3607 3608 3609 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3607 def to_json( = nil) JSON.generate(to_dynamic, ) end |