diff --git a/api/config/initializers/sidekiq.rb b/api/config/initializers/sidekiq.rb index a4c8e5e..348f060 100644 --- a/api/config/initializers/sidekiq.rb +++ b/api/config/initializers/sidekiq.rb @@ -1,3 +1,5 @@ +require 'dotenv' +Dotenv.load require 'sidekiq' require 'sidekiq-cron' require 'yaml' diff --git a/api/jobs/set_costumer_id_job.rb b/api/jobs/set_costumer_id_job.rb index 7c62d8d..48e82e6 100644 --- a/api/jobs/set_costumer_id_job.rb +++ b/api/jobs/set_costumer_id_job.rb @@ -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 diff --git a/api/modal/dwolla.rb b/api/modal/dwolla.rb index df8728e..aaa71c5 100644 --- a/api/modal/dwolla.rb +++ b/api/modal/dwolla.rb @@ -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)