Sha256: 15564ee49a838cfd4fa740551be07f4400ce79e2aa96921e9f87a87990d90cae

Contents?: true

Size: 695 Bytes

Versions: 8

Compression:

Stored size: 695 Bytes

Contents

module Nyauth
  class Registration
    include ActiveModel::Model
    attr_reader :email, :password, :password_confirmation, :client

    def initialize(service_params = {})
      @email = service_params[:email]
      @password = service_params[:password]
      @password_confirmation = service_params[:password_confirmation]
    end

    def save(options = {})
      options.reverse_merge!(as: :user)
      klass = options[:as].to_s.classify.constantize
      @client = klass.create(email: @email,
                             password: @password,
                             password_confirmation: @password_confirmation)
      @errors = @client.errors
      @client.valid?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nyauth-0.7.2 app/services/nyauth/registration.rb
nyauth-0.7.1 app/services/nyauth/registration.rb
nyauth-0.7.0 app/services/nyauth/registration.rb
nyauth-0.6.2 app/services/nyauth/registration.rb
nyauth-0.6.1 app/services/nyauth/registration.rb
nyauth-0.6.0 app/services/nyauth/registration.rb
nyauth-0.5.0 app/services/nyauth/registration.rb
nyauth-0.4.0 app/services/nyauth/registration.rb