stripe-cli-ruby 1.54.1-x86_64-linux → 1.55.1-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d4661d3e9c5e1c37e625d94b5e97d5279aa45983d3224dd96117d7159df255b
4
- data.tar.gz: 4d1736ee6f6589c9e4ae35670ac8fa4b4e7a52cf2901a46661f97a21e3b037cc
3
+ metadata.gz: '08a54c14377aaf77142bce777e72808f119d45de62d6fe1d690c8c4b09d8dc70'
4
+ data.tar.gz: 1b96bbc7023fce9c94ede01b6ac9c87cf0ee310d7d88aee41a9af89cd0dc6cb2
5
5
  SHA512:
6
- metadata.gz: f0741ad0e6941db1017cf7ad7d94b0e3e890bb087a052084da1264ff8bb491ecbc4058bbbba4288ca7d6327b74b5dc0f23e7de68b2091bb2fc2f35f406ea2756
7
- data.tar.gz: a40f34ac2b6d9ffc7db13fda5748f1d17c291ef17d8584aae61ea733fc425b6fa44d17f3138335130f3a69d3ec7d4c544ab558164abf6696a59701be223bbc53
6
+ metadata.gz: 2a665da221d6c2f2e3ad341f685c47881b662888cfe4d5fc885cebdf85cca2013887054197b95c0e2f1cfe062194e668d8efb20e97d78585fac0658cafab2b53
7
+ data.tar.gz: a0a20eca5a8a99836199eea68299a831b9a4d156746ad573a3cf48f3356ba4b05ae8690c72f32bab990e885008d38ba16ebc300ccff154003e4471f496d65e2f
data/README.md CHANGED
@@ -71,7 +71,9 @@ Add `plugin :stripe` to `puma.rb` configuration:
71
71
  plugin :stripe if ENV["RAILS_ENV"] == "development"
72
72
  ```
73
73
 
74
- By default, events will be forwarded to `/stripe_events`, this can be configured using `stripe_forward_to "/stripe/webhook"` in `puma.rb`.
74
+ By default, all events will be forwarded to `/stripe_events`, this can be configured using `stripe_forward_to "/stripe/webhook"` in `puma.rb`.
75
+
76
+ To forward the events of the webhook endpoints set up in your Stripe dashboard instead, add `stripe_use_configured_webhooks` to `puma.rb`. Each endpoint's events go to that endpoint's path on your local server, so an endpoint at `https://example.com/stripe/webhook` gets forwarded to `http://localhost:3000/stripe/webhook`. Your test mode account needs at least one webhook endpoint.
75
77
 
76
78
  You can grab your *signing secret* using `StripeCLI.signing_secret`. For example:
77
79
 
Binary file
@@ -10,8 +10,12 @@ Puma::Plugin.create do
10
10
  @launcher = launcher
11
11
 
12
12
  launcher.events.on_booted do
13
- launcher.log_writer.log "Stripe: forwarding webhooks to #{forward_to}"
14
- @pid = spawn(StripeCLI.executable, "listen", "--all-snapshot", "--forward-to", forward_to.to_s, "--api-key", Stripe.api_key.to_s)
13
+ if use_configured_webhooks?
14
+ launcher.log_writer.log "Stripe: forwarding webhooks configured in the dashboard to #{forward_to}"
15
+ else
16
+ launcher.log_writer.log "Stripe: forwarding webhooks to #{forward_to}"
17
+ end
18
+ @pid = spawn(StripeCLI.executable, "listen", "--all-snapshot", *("--use-configured-webhooks" if use_configured_webhooks?), "--forward-to", forward_to.to_s, "--api-key", Stripe.api_key.to_s)
15
19
  rescue StripeCLI::UnsupportedPlatformException, StripeCLI::ExecutableNotFoundException, Errno::ENOENT => e
16
20
  launcher.log_writer.log "[Stripe] Could not start the Stripe CLI: #{e.message}"
17
21
  end
@@ -29,10 +33,18 @@ Puma::Plugin.create do
29
33
  rescue Errno::ECHILD, Errno::ESRCH
30
34
  end
31
35
 
36
+ def use_configured_webhooks?
37
+ @launcher.options[:stripe_use_configured_webhooks]
38
+ end
39
+
40
+ # Dashboard endpoints bring their own paths, so only the host and port are ours.
32
41
  def forward_to
33
- path = @launcher.options.fetch(:stripe_forward_to, "/stripe_events")
34
42
  _, port, host = @launcher.binder.ios.first.addr
35
- URI::HTTP.build(port:, host:, path:)
43
+ if use_configured_webhooks?
44
+ URI::HTTP.build(port:, host:)
45
+ else
46
+ URI::HTTP.build(port:, host:, path: @launcher.options.fetch(:stripe_forward_to, "/stripe_events"))
47
+ end
36
48
  end
37
49
  end
38
50
 
@@ -41,5 +53,9 @@ module Puma
41
53
  def stripe_forward_to(path)
42
54
  @options[:stripe_forward_to] = path
43
55
  end
56
+
57
+ def stripe_use_configured_webhooks(enabled = true)
58
+ @options[:stripe_use_configured_webhooks] = enabled
59
+ end
44
60
  end
45
61
  end
@@ -3,7 +3,7 @@
3
3
  module StripeCLI
4
4
  # constants describing the upstream stripe/stripe-cli project
5
5
  module Upstream
6
- VERSION = "1.54.1"
6
+ VERSION = "1.55.1"
7
7
 
8
8
  # rubygems platform name => upstream release filename
9
9
  NATIVE_PLATFORMS = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StripeCLI
4
- VERSION = "1.54.1"
4
+ VERSION = "1.55.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-cli-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.54.1
4
+ version: 1.55.1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Zacharias Knudsen