Sha256: 20fa8d12791105911ab2584627a515aaa2fbedb50a01e4a189ae3b1b63054e6f

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

module Unidom::Visitor::Concerns::AsCredential

  extend ActiveSupport::Concern

  included do |includer|

    has_one :authenticating, class_name: 'Unidom::Visitor::Authenticating', as: :credential

    def authenticate!(it, at: Time.now, flag_code: 'RQRD')
      return authenticating if authenticating.present?
      create_authenticating! visitor: it, flag_code: flag_code, opened_at: at
    end

=begin
    def authenticate?(it, at: Time.now, flag_code: 'RQRD')
      return false if authenticating.blank?
      result = true
      result &&= it==authenticating.visitor                                 if it.present?
      result &&= at<=authenticating.closed_at&&at>=authenticating.opened_at if at.present?
      result &&= flag_code==authenticating.flag_code                        if flag_code.present?
      result
    end
=end

  end

  module ClassMethods
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unidom-visitor-1.9 app/models/unidom/visitor/concerns/as_credential.rb
unidom-visitor-1.8 app/models/unidom/visitor/concerns/as_credential.rb