Skip to content

Instantly share code, notes, and snippets.

@Yenwod

Yenwod/heroku.rake

Last active Dec 25, 2019
Embed
What would you like to do?
require 'platform-api'
namespace :heroku do
desc "set test webhook for Stripe based upon review-app url"
task update_stripe_test_webhook: :environment do
new_webhook_url = ""
heroku = PlatformAPI.connect_oauth('the-token-you-generated-via-README-instructions')
heroku.app.list.each do |app|
if app["name"].include?('vaxcalc-app-pattern-')
new_webhook_url = app["web_url"]
end
end
webhook_endpoints = Stripe::WebhookEndpoint.list
if webhook_endpoints.first.livemode == false
webhook_endpoints.first.url = new_webhook_url + 'stripe-webhook-path-defined-in-routes.rb'
webhook_endpoints.first.save
else
raise "rake task heroku:update_stripe_test_webhook should only work with TEST webhooks!"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.