Class: InfinumAzure::Config
- Inherits:
-
Object
- Object
- InfinumAzure::Config
- Defined in:
- lib/infinum_azure/config.rb
Constant Summary collapse
- PROVIDER_INFINUM_ID =
'infinum_id'
- PROVIDER_INFINUM_AZURE =
'infinum_azure'
- UID =
'uid'
- DEFAULT_RESOURCE_ATTRIBUTES =
[ :uid, :email, :first_name, :last_name, :avatar_url, :deactivated_at, :groups, :employee ].freeze
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#resource_attributes ⇒ Object
Returns the value of attribute resource_attributes.
-
#resource_name ⇒ Object
Returns the value of attribute resource_name.
-
#tenant ⇒ Object
Returns the value of attribute tenant.
-
#user_migration_operation ⇒ Object
Returns the value of attribute user_migration_operation.
-
#user_migration_scope ⇒ Object
Returns the value of attribute user_migration_scope.
-
#users_auth_url ⇒ Object
Returns the value of attribute users_auth_url.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/infinum_azure/config.rb', line 22 def initialize self.resource_attributes = DEFAULT_RESOURCE_ATTRIBUTES self.user_migration_scope = -> { InfinumAzure.resource_class.where(provider: PROVIDER_INFINUM_ID) } self.user_migration_operation = lambda { |record, resource| record.update_columns( # rubocop:disable Rails/SkipsModelValidations provider: PROVIDER_INFINUM_AZURE, uid: resource[UID] ) } end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
16 17 18 |
# File 'lib/infinum_azure/config.rb', line 16 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
17 18 19 |
# File 'lib/infinum_azure/config.rb', line 17 def client_secret @client_secret end |
#domain ⇒ Object
Returns the value of attribute domain.
18 19 20 |
# File 'lib/infinum_azure/config.rb', line 18 def domain @domain end |
#resource_attributes ⇒ Object
Returns the value of attribute resource_attributes.
13 14 15 |
# File 'lib/infinum_azure/config.rb', line 13 def resource_attributes @resource_attributes end |
#resource_name ⇒ Object
Returns the value of attribute resource_name.
12 13 14 |
# File 'lib/infinum_azure/config.rb', line 12 def resource_name @resource_name end |
#tenant ⇒ Object
Returns the value of attribute tenant.
19 20 21 |
# File 'lib/infinum_azure/config.rb', line 19 def tenant @tenant end |
#user_migration_operation ⇒ Object
Returns the value of attribute user_migration_operation.
15 16 17 |
# File 'lib/infinum_azure/config.rb', line 15 def user_migration_operation @user_migration_operation end |
#user_migration_scope ⇒ Object
Returns the value of attribute user_migration_scope.
14 15 16 |
# File 'lib/infinum_azure/config.rb', line 14 def user_migration_scope @user_migration_scope end |
#users_auth_url ⇒ Object
Returns the value of attribute users_auth_url.
20 21 22 |
# File 'lib/infinum_azure/config.rb', line 20 def users_auth_url @users_auth_url end |
Instance Method Details
#validate! ⇒ Object
33 34 35 36 37 38 |
# File 'lib/infinum_azure/config.rb', line 33 def validate! [:resource_name, :resource_attributes, :user_migration_scope, :user_migration_operation, :client_id, :client_secret, :domain, :tenant].each do |attribute| raise InfinumAzure::Error, "InfinumAzure attribute '@#{attribute}' not set" if public_send(attribute).blank? end end |