Sha256: c11b085e4911d5da1cb7cb6a470f222781273efa07093f44c7d6c3ffe6086c9a

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

module Osso
  module Models
    # Base class for Enterprises. This should map one-to-one with
    # your own Account model. Persisting the EnterpriseAccount id
    # in your application's database is recommended. The table also
    # includes fields for external IDs such that you can persist
    # your ID for an account in your Osso instance.
    class EnterpriseAccount < ActiveRecord::Base
      belongs_to :oauth_client
      has_many :users
      has_many :identity_providers

      def single_provider?
        identity_providers.one?
      end

      def provider
        return nil unless single_provider?

        identity_providers.first
      end

      alias identity_provider provider
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
osso-0.0.3.8 lib/osso/models/enterprise_account.rb
osso-0.0.3.7 lib/osso/models/enterprise_account.rb
osso-0.0.3.6 lib/osso/models/enterprise_account.rb