Sha256: 0ec1c731be974883b73b5b5da747a829ba45f5f3a0205f9bfbcc856a5bff4fc9

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

# frozen_string_literal: true

module Pragma
  module Operation
    # Creates a new record and responds with the decorated record.
    #
    # @author Alessandro Desantis
    class Create < Pragma::Operation::Base
      step Macro::Classes()
      step Macro::Model()
      step Macro::Policy()
      step Macro::Contract::Build()
      step Macro::Contract::Validate()
      step Macro::Contract::Persist()
      step Macro::Decorator()
      step :respond!

      def respond!(options)
        options['result.response'] = Response::Created.new(
          entity: options['result.decorator.instance']
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pragma-2.1.1 lib/pragma/operation/create.rb
pragma-2.1.0 lib/pragma/operation/create.rb