Sha256: cda1974dea6043a79e961914c50dd1a8ff1f05801cd6148a4b68f9cac69b0766
Contents?: true
Size: 798 Bytes
Versions: 3
Compression:
Stored size: 798 Bytes
Contents
# frozen_string_literal: true module Pragma module Operation # Finds the requested record, authorizes it, updates it accordingly to the parameters and # responds with the decorated record. # # @author Alessandro Desantis class Create < Pragma::Operation::Base include Pragma::Operation::Defaults def call context.record = build_record context.contract = build_contract(context.record) validate! context.contract authorize! context.contract context.contract.save respond_with status: :created, resource: decorate(context.record) end protected # Builds the requested record. # # @return [Object] def build_record self.class.model_klass.new end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pragma-1.1.2 | lib/pragma/operation/create.rb |
pragma-1.1.1 | lib/pragma/operation/create.rb |
pragma-1.1.0 | lib/pragma/operation/create.rb |