Sha256: 92f0a6c6835f9694321b0d11a9a5c87a868597f1d3d1e329bfe56e31e3283485

Contents?: true

Size: 812 Bytes

Versions: 10

Compression:

Stored size: 812 Bytes

Contents

module Arpa
  module Services
    module Profiles
      module Update
        class ProfileUpdater

          def update(params)
            profile = profile_instance(params)
            validate_profile(profile)
            updater_repo.update(profile)
          end

          private

          def profile_instance(params)
            Arpa::Entities::Profile.new(params)
          end

          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

          def updater_repo
            @updater_repo ||= Arpa::Repositories::Profiles::Updater.new
          end

        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arpa-0.2.0 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.1.0 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.9 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.8 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.7 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.6 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.5 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.4 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.3 lib/arpa/services/profiles/update/profile_updater.rb
arpa-0.0.2 lib/arpa/services/profiles/update/profile_updater.rb