Sha256: ef30780cfe8b7db440463ccb73ab3badd3482b55e0ebef237e3fc79ac9ce01fb

Contents?: true

Size: 410 Bytes

Versions: 1

Compression:

Stored size: 410 Bytes

Contents

require 'main/import'
require 'main/entities/user'
require 'kleisli'

module Main
  module Transactions
    class RegisterUser
      include Main::Import('persistence.db')

      def call(params)
        if params['name']
          Right(db[:users] << Main::Entities::User.new(*params.values_at('id', 'name')))
        else
          Left(validation: 'name is missing')
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-web-0.1.0 spec/dummy/apps/main/lib/main/transactions/register_user.rb