Class: PostCollectionsMergeBody

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



22093
22094
22095
22096
22097
22098
22099
22100
# File 'lib/schemas.rb', line 22093

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    destination: d.fetch("destination"),
    source:      d.fetch("source"),
    strategy:    d["strategy"],
  )
end

.from_json!(json) ⇒ Object



22102
22103
22104
# File 'lib/schemas.rb', line 22102

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

Instance Method Details

#to_dynamicObject



22106
22107
22108
22109
22110
22111
22112
# File 'lib/schemas.rb', line 22106

def to_dynamic
  {
    "destination" => destination,
    "source"      => source,
    "strategy"    => strategy,
  }
end

#to_json(options = nil) ⇒ Object



22114
22115
22116
# File 'lib/schemas.rb', line 22114

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