-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into task/45-add-make-lint-step
- Loading branch information
Showing
7 changed files
with
100 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
db/migrate/20221229143942_add_institutions_from_open_banking_provider.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace :institutions_data do | ||
desc "Sync all the institutions data from GoCardless" | ||
task sync: :environment do | ||
puts "Syncing institutions data..." | ||
institutions = OpenBankingConnector.new.fetch_institutions_by_country("ES") | ||
|
||
institutions.each do |institution| | ||
temp_institution = Institution.find_by(institution_id: institution[:id]) | ||
|
||
if temp_institution | ||
temp_institution.update!( | ||
name: institution[:name], | ||
thumbnail_url: institution[:logo] | ||
) | ||
else | ||
Institution.create!( | ||
institution_id: institution[:id], | ||
name: institution[:name], | ||
thumbnail_url: institution[:logo] | ||
) | ||
end | ||
end | ||
|
||
puts "Successfully synced #{institutions.count} institutions" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters