Sha256: c621c842d2d5834c859176178ee86b4097a8f45c48a7c900b55e4b427d49e0a6

Contents?: true

Size: 463 Bytes

Versions: 6

Compression:

Stored size: 463 Bytes

Contents

module Nyauth
  class ConfirmationRequest
    include ActiveModel::Model
    attr_reader :email, :client

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

    def save(options = {})
      options.reverse_merge!(as: :user)
      klass = options[:as].to_s.classify.constantize
      @client = klass.find_by!(email: @email)
      @client.request_confirmation
    rescue
      errors.add(:base, :invalid_email)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nyauth-0.7.0 app/services/nyauth/confirmation_request.rb
nyauth-0.6.2 app/services/nyauth/confirmation_request.rb
nyauth-0.6.1 app/services/nyauth/confirmation_request.rb
nyauth-0.6.0 app/services/nyauth/confirmation_request.rb
nyauth-0.5.0 app/services/nyauth/confirmation_request.rb
nyauth-0.4.0 app/services/nyauth/confirmation_request.rb