Sha256: e471a1b1e9b9ab7d88c17b820f5030c137603807d5abb912a376b2ab7ad0de0e

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

module Unidom::Visitor::Concerns::AsVisitor

  extend ActiveSupport::Concern

  included do |includer|

    has_many :identificatings, class_name: 'Unidom::Visitor::Identificating', as: :visitor

    has_many :authenticatings, class_name: 'Unidom::Visitor::Authenticating', as: :visitor

    has_many :recognizations,  class_name: 'Unidom::Visitor::Recognization',  as: :visitor

    scope :identified_by, ->(identity) { joins(:identificatings).merge(Unidom::Visitor::Identificating.identity_is identity) }

    def is_identificated!(as: nil, at: Time.now)
      identificatings.create! identity: as, opened_at: at
    end

=begin
    def is_authenticated!(through: nil, at: Time.now, flag_code: 'RQRD')
      authenticatings.create! credential: through, opened_at: at, flag_code: flag_code
    end

    def cognize!(it, at: Time.now, primary: true)
      recognizations.create! party: it, elemental: primary, opened_at: at
    end
=end

  end

  module ClassMethods

=begin
    def sign_up!(it, as: nil, through: nil, at: Time.now, flag_code: 'RQRD', primary: true)
      cognize! it,      primary: true,    at: at
      is_identificated! as:      as,      at: at
      is_authenticated! through: through, at: at
      self
    end
=end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-visitor-1.5 app/models/unidom/visitor/concerns/as_visitor.rb