class Arpa::Services::Profiles::Create::ProfileCreator

Public Instance Methods

create(params) click to toggle source
# File lib/arpa/services/profiles/create/profile_creator.rb, line 6
def create(params)
  profile = profile_instance(params)
  validate_profile(profile)
  creator_repo.create(profile)
end

Private Instance Methods

creator_repo() click to toggle source
# File lib/arpa/services/profiles/create/profile_creator.rb, line 23
def creator_repo
  @creator_repo ||= Arpa::Repositories::Profiles::Creator.new
end
profile_instance(params) click to toggle source
# File lib/arpa/services/profiles/create/profile_creator.rb, line 14
def profile_instance(params)
  Arpa::Entities::Profile.new(params)
end
validate_profile(profile) click to toggle source
# File lib/arpa/services/profiles/create/profile_creator.rb, line 18
def validate_profile(profile)
  validator = Arpa::Validators::ProfileValidator.new(profile)
  raise Arpa::Exceptions::RecordInvalid.new(message: validator.errors.messages, errors: validator.errors) unless validator.valid?
end