Skip to content

Commit

Permalink
improve cron-job code
Browse files Browse the repository at this point in the history
  • Loading branch information
lyna-azerouk committed Nov 13, 2024
1 parent 568a907 commit 5a1c907
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions api/config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'dotenv'
Dotenv.load
require 'sidekiq'
require 'sidekiq-cron'
require 'yaml'
Expand Down
2 changes: 1 addition & 1 deletion api/jobs/set_costumer_id_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def perform
dwolla.init()
costumers = dwolla.get_costomers()

costumers["_embedded"]["customers"].each do |customer|
costumers.each do |customer|
user = ::User.find_by(email: customer["email"] )
user.update(dwolla_id: customer["id"] ) if user.present?
end
Expand Down
3 changes: 2 additions & 1 deletion api/modal/dwolla.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def create_verifed_user(request_body)
end

def get_costomers
@@dwolla.get "customers"
response_body = @@dwolla.get "customers"
response_body["_embedded"]["customers"]
end

def get_costumer(request_body)
Expand Down

0 comments on commit 5a1c907

Please sign in to comment.