Class: DdbRuby::FifthEdition::Condition
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Condition
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1268 def self.from_dynamic!(d) d = Types::Hash[d] new( condition_type: d.fetch("type"), condition_id: d.fetch("conditionId"), condition_duration: d.fetch("conditionDuration"), duration_unit: d.fetch("durationUnit"), exception: d.fetch("exception"), ) end |
.from_json!(json) ⇒ Object
1279 1280 1281 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1279 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1283 1284 1285 1286 1287 1288 1289 1290 1291 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1283 def to_dynamic { "type" => condition_type, "conditionId" => condition_id, "conditionDuration" => condition_duration, "durationUnit" => duration_unit, "exception" => exception, } end |
#to_json(options = nil) ⇒ Object
1293 1294 1295 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1293 def to_json( = nil) JSON.generate(to_dynamic, ) end |