Sha256: 93222572db3bccbf3ab122494210f7990bc2a2017f55e289bce26b0d87ecd64d

Contents?: true

Size: 1.63 KB

Versions: 5

Compression:

Stored size: 1.63 KB

Contents

# frozen_string_literal: true

module Masks
  # An interface that all configuration adapters should adhere to.
  #
  # @see Masks::Adapters::ActiveRecord
  module Adapter
    # Creates a new adapter.
    #
    # @param [Masks::Configuration] config
    # @return [Masks::Adapter]
    def initialize(config)
      @config = config
    end

    # Returns an actor given the passed options, which may
    # contain a nickname and/or an email.
    #
    # @param [Masks::Session] session
    # @param [Hash] opts
    # @return [Masks::Actor] or nil if not found
    def find_actor(session, **opts)
      raise NotImplementedError
    end

    # Returns a list of actors matching the passed actor_ids.
    #
    # @param [Masks::Session] session
    # @param [Array] actor_ids
    # @return [Array<Masks::Actor>]
    def find_actors(session, actor_ids)
      raise NotImplementedError
    end

    # Expires any outdated or invalid actors.
    #
    # @return
    def expire_actors
      raise NotImplementedError
    end

    # Builds an actor from the passed options, which may contain
    # a nickname or email. Additional attributes, like a password,
    # will not be supplied.
    #
    # @param [Masks::Session] session
    # @param [Hash] opts
    # @return [Masks::Actor]
    def build_actor(session, **opts)
      raise NotImplementedError
    end

    # @visibility private
    def find_recovery(session, **opts)
      raise NotImplementedError
    end

    # @visibility private
    def build_recovery(session, **opts)
      raise NotImplementedError
    end

    # @visibility private
    def expire_recoveries
      raise NotImplementedError
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 app/models/concerns/masks/adapter.rb
masks-0.3.2 app/models/concerns/masks/adapter.rb
masks-0.3.1 app/models/concerns/masks/adapter.rb
masks-0.3.0 app/models/concerns/masks/adapter.rb
masks-0.2.0 app/models/concerns/masks/adapter.rb