Sha256: 97f8f70c37eb46429c2641de781dd90c05695605036b3a2cde79af815e610a7f

Contents?: true

Size: 917 Bytes

Versions: 2

Compression:

Stored size: 917 Bytes

Contents

require 'omniauth/infinum_id'
require 'infinum_id/version'
require 'infinum_id/engine'
require 'dry-configurable'
require 'blueprinter'
require 'devise'
require 'sidekiq'
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 :resource_attributes, [:uid, :email, :first_name, :last_name],
                                 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.4.1 lib/infinum_id.rb
infinum_id-1.4.0 lib/infinum_id.rb