Class: InfinumAzure::Users::Migration
- Inherits:
-
Object
- Object
- InfinumAzure::Users::Migration
- Defined in:
- lib/tasks/infinum_azure/users/migration.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response) ⇒ Migration
constructor
A new instance of Migration.
- #perform ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(response) ⇒ Migration
Returns a new instance of Migration.
14 15 16 17 18 |
# File 'lib/tasks/infinum_azure/users/migration.rb', line 14 def initialize(response) @response = response @users_updated_count = 0 @emails_not_found = [] end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
12 13 14 |
# File 'lib/tasks/infinum_azure/users/migration.rb', line 12 def response @response end |
Class Method Details
.perform(response = {}) ⇒ Object
8 9 10 |
# File 'lib/tasks/infinum_azure/users/migration.rb', line 8 def self.perform(response = {}) new(response).perform end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tasks/infinum_azure/users/migration.rb', line 20 def perform user_migration_scope.call.each do |record| resource = response.find { |object| object['email'] == record.email } emails_not_found.push(record.email) && next if resource.nil? user_migration_operation.call(record, resource) self.users_updated_count += 1 end self end |
#results ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/tasks/infinum_azure/users/migration.rb', line 32 def results <<~HEREDOC Count of updated resources: #{users_updated_count} Emails not found on Infinum Azure AD B2C: #{emails_not_found.size} Emails: #{emails_not_found.join("\n")} HEREDOC end |