Sha256: bf9bb6c68b356e979f155c24120835b4ef331a79d06cf37b255d4c382f324fef

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8

class Demo
  module Core

    module App

      AUTHENTICATION_ERROR = Core::ENV.chain { wrap Error::AuthenticationError }
      AUTHORIZATION_ERROR  = Core::ENV.chain { wrap Error::AuthorizationError }
      VALIDATION_ERROR     = Core::ENV.chain { wrap Error::ValidationError }
      APPLICATION_ERROR    = Core::ENV.chain { wrap Error::ApplicationError }
      INTERNAL_ERROR       = Core::ENV.chain { wrap Error::InternalError }

      AUTHENTICATE = Core::ENV.chain do
        authenticate Handler::Authenticator, AUTHENTICATION_ERROR
      end

      AUTHORIZE = Core::ENV.chain(nil, AUTHENTICATE) do
        authorize Handler::Authorizer, AUTHORIZATION_ERROR
      end

      Core::ENV.register(:create_person, AUTHORIZE, INTERNAL_ERROR) do
        validate Domain::DTO::NEW_PERSON_VALIDATOR, VALIDATION_ERROR
        accept   Handler::Acceptor

        call Action::CreatePerson, APPLICATION_ERROR, [
          Observers::LOG_EVENT,
          Observers::SEND_EMAIL
        ]
      end

    end

    # The application
    APP = Core::ENV.dispatcher

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
substation-0.0.11 spec/demo/core/facade.rb
substation-0.0.10 spec/demo/core/facade.rb