Class: AuctionFunCore::Contracts::UserContext::RegistrationContract

Inherits:
ApplicationContract
  • Object
show all
Defined in:
lib/auction_fun_core/contracts/user_context/registration_contract.rb

Overview

This class is designed to create new users. It validates the parameters, ensuring their format and uniqueness.

Examples:

Registering a new staff member

contract = AuctionFunCore::Contracts::StaffContext::RegistrationContract.new
attributes = {
  name: 'John Doe',
  email: '[email protected]',
  phone: '1234567890'
  password: 'password',
  password_confirmation: 'password'
}
result = contract.call(attributes)
if result.success?
  puts "New user registered successfully."
else
  puts "Failed to register new user: #{result.errors.to_h}"
end

Constant Summary collapse

I18N_SCOPE =

Scope for internationalization (i18n) entries specific to errors in this contract.

"contracts.errors.custom.default"

Constants inherited from ApplicationContract

ApplicationContract::EMAIL_REGEX, ApplicationContract::I18N_MACRO_SCOPE

Constants included from Business::Configuration

Business::Configuration::AUCTION_KINDS, Business::Configuration::AUCTION_MAX_TITLE_LENGTH, Business::Configuration::AUCTION_MIN_TITLE_LENGTH, Business::Configuration::AUCTION_STATUSES, Business::Configuration::AUCTION_STOPWATCH_MAX_VALUE, Business::Configuration::AUCTION_STOPWATCH_MIN_VALUE, Business::Configuration::MAX_NAME_LENGTH, Business::Configuration::MAX_PASSWORD_LENGTH, Business::Configuration::MIN_NAME_LENGTH, Business::Configuration::MIN_PASSWORD_LENGTH