Sha256: 7e2f6cfb1f7e125905533d946ba111797c94999bbbb1003abe360a97629fc144

Contents?: true

Size: 785 Bytes

Versions: 8

Compression:

Stored size: 785 Bytes

Contents

module Ecm::UserArea
  class CreateDefaultUserService < Itsf::Services::V2::Service::Base
    class Response < Itsf::Services::V2::Response::Base
      attr_accessor :user
    end

    def do_work
      response.user = create_default_user
      respond
    end

    private

    def create_default_user
      user = Ecm::UserArea::User.new(user_attributes)
      if user.save
        info 'Created default user'
      else
        error "Could not create default user. Errors: #{user.errors.full_messages.to_sentence}"
      end
      user
    end

    def user_attributes
      {
        email: 'user@example.com',
        password: 'password',
        password_confirmation: 'password',
        active: true,
        approved: true,
        confirmed: true
      }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ecm_user_area2-2.3.0 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-2.2.0 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-2.0.0 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-1.2.10 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-1.2.9 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-1.2.8 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-1.2.6 app/services/ecm/user_area/create_default_user_service.rb
ecm_user_area2-1.0.3 app/services/ecm/user_area/create_default_user_service.rb