Sha256: 2307238843fa14ab0a9541471ae080e7c1c275bce65c5104558965cde0c5d9f3
Contents?: true
Size: 841 Bytes
Versions: 6
Compression:
Stored size: 841 Bytes
Contents
module {{namespace_module}} module {{resource_module}} module Create class Control include Shogun::Control include {{resource_module}} def initialize(payload:) @normalizer = Normalizer.new(raw: payload.to_hash) @validator = Validator.new(data: @normalizer) if @validator.valid? @model = Model.create(@normalizer.to_hash) @presenter = Presenter.new(resource: @model) @denormalizer = Denormalizer.new(object: @presenter) @status = OK else @presenters = Shogun::Presenters.new(resources: @validator.invalids, cast: Errors::Presenter) @denormalizer = Errors::Denormalizer.new(object: @presenters) @status = UNPROCESSABLE_ENTITY end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems