Skip to content
Browse files

added login for access token

  • Loading branch information...
1 parent 73d8aba commit a1997336b89067de21ec853acc762f70ab441aa7 @jeffdonthemic jeffdonthemic committed
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/tasks/scheduler.rake
View
10 lib/tasks/scheduler.rake
@@ -1,6 +1,12 @@
desc "This task is called by the Heroku scheduler add-on to cache home page stats"
task :cache_platform_stats => :environment do
puts "Calling SFDC to cache platform stats...."
- results = Services.submit_platform_stats_job(current_access_token)
- puts results['message']
+
+ # log in for an access token
+ config = YAML.load_file(File.join(::Rails.root, 'config', 'databasedotcom.yml'))
+ client = Databasedotcom::Client.new(config)
+ access_token = client.authenticate :username => ENV['SFDC_USERNAME'], :password => ENV['SFDC_PASSWORD']
+
+ results = Services.submit_platform_stats_job(access_token)
+ puts "Kicked off Apex Job with ID #{results['message']}"
end

0 comments on commit a199733

Please sign in to comment.
Something went wrong with that request. Please try again.