Sha256: b94cb16a07ec788502ec6cdbeb9d54ece0025a24217c956247ca0c6329fee1ff

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

require_dependency 'flexite/action_service'

module Flexite
  class Config::CreateService < ActionService
    def call
      if @form.invalid?
        return failure
      end

      @record = Config.create(@form.attributes, without_protection: true)
      success
    end

    protected

    def failure
      Result.new(success: false, endpoint: { status: 400 })
    end

    def success
      Result.new(flash: { type: :success, message: 'Config was created!' },
                 data: @record)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flexite-0.0.7 app/services/flexite/config/create_service.rb
flexite-0.0.6 app/services/flexite/config/create_service.rb
flexite-0.0.5 app/services/flexite/config/create_service.rb
flexite-0.0.4 app/services/flexite/config/create_service.rb
flexite-0.0.3 app/services/flexite/config/create_service.rb