Nucleus Core Ruby
- Overview
- Supported Frameworks
- Support
- License
- Code of conduct
- Contribution guide
Overview
Nucleus Core provides a framework-agnostic foundation for encapsulating domain logic enabling seamless integration across various platforms and mediums.
It prescribes that a request is broken down as follows:
Device
- Receives request
Framework
- Formats request parameters and passes them to a receiver
Business Logic**
- Authenticate & Authorize
- Execute Operation/Workflow
- Interact with data via repository
- Return a view object
Framework
- Renders view object given the requested format
Device
- Device displays output to the medium it serves
Getting started
- Install the gem
gem install 'nucleus-core'
- Initialize and configure
require "nucleus-core"
NucleusCore.configure do |config|
config.logger = Logger.new($stdout)
config.default_response_format = :json # defaults to :json
# The request_exceptions attribute allows you to define custom exception handling for different
# HTTP error types. The keys are standard error names like :bad_request, :unauthorized, and :not_found,
# and the values are the exception classes or errors you want to handle for each case.
config.request_exceptions = {
not_found: RecordNotFound,
unprocessible: [RecordInvalid, RecordNotSaved],
bad_request: ArgumentError,
forbidden: NotPermittedError,
unauthorized: UnAuthenticatedError
}
end
- Refer to the 'How-To' section for guidance on expressing your business logic.
Supported Frameworks
Support
If you want to report a bug, or have ideas, feedback or questions about the gem, let me know via GitHub issues and we will do our best to provide a helpful answer, and if you'd like to support the mission donate
License
The gem is available under the terms of the proprietary software license.
Code of conduct
Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Contribution guide
Pull requests are welcome!