Sha256: c8ce93abe73b2c4add31131424157aaef523f80ef9de822af68793e17797460a

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

require 'omniauth/infinum_id'
require 'infinum_id/version'
require 'infinum_id/engine'
require 'dry-configurable'
require 'blueprinter'
require 'devise'
require 'http'

module InfinumId
  extend Dry::Configurable

  setting :service_name, reader: true
  setting :resource_name, 'User', reader: true
  setting :infinum_id_send_email, false, reader: true
  setting :send_invite_request, true, reader: true

  setting :resource_attributes, [:uid, :email, :first_name, :last_name, :deactivated_at],
                                 reader: true

  def self.resource_class
    resource_name.constantize
  end

  def self.url
    dig_secret(:url)
  end

  def self.client_id
    dig_secret(:client_id)
  end

  def self.client_secret
    dig_secret(:client_secret)
  end

  def self.dig_secret(key)
    if Rails::VERSION::MAJOR >= 5
      Rails.application.secrets.dig(:infinum_id, key)
    else
      Rails.application.secrets.dig(:infinum_id, key.to_s)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
infinum_id-1.6.0 lib/infinum_id.rb
infinum_id-1.5.1 lib/infinum_id.rb