stripe_event 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -12
- data/CHANGELOG.md +5 -0
- data/README.md +0 -7
- data/lib/stripe_event.rb +4 -2
- data/lib/stripe_event/version.rb +1 -1
- data/spec/controllers/webhook_controller_spec.rb +13 -4
- data/stripe_event.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d6d19afa81645efcadb2d980a9d8279d00686e33cc101283a07faaebb76afd
|
4
|
+
data.tar.gz: 338d0f8196af2c086cfb2df0bdc2350ac8577d8d45e9db19a9f032191df24161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91789378fbba4beeb4e0245d5f980fdaa27136043ba0e53bb9e4478e57e1e397317fc4069989dd48dfee01eed64c34856294f2b5b3d66681377f0178955dee76
|
7
|
+
data.tar.gz: 9289a39f3f459f6a048d252e0803af0a1dd77c559e90f5f6cc261e060ea006de892b96c2a4b50039302936cc11a830fb7a1dc069addcaac989cbdfd566aa591a
|
data/.travis.yml
CHANGED
@@ -2,15 +2,14 @@ language: ruby
|
|
2
2
|
cache: bundler
|
3
3
|
|
4
4
|
rvm:
|
5
|
-
- 2.3
|
6
|
-
- 2.4
|
7
5
|
- 2.5
|
8
6
|
- 2.6
|
7
|
+
- 2.7
|
9
8
|
|
10
9
|
gemfile:
|
11
|
-
- gemfiles/rails4.2.gemfile
|
12
10
|
- gemfiles/rails5.1.gemfile
|
13
11
|
- gemfiles/rails5.2.gemfile
|
12
|
+
- gemfiles/rails6.0.gemfile
|
14
13
|
- gemfiles/stripe3.gemfile
|
15
14
|
- gemfiles/stripe4.gemfile
|
16
15
|
- gemfiles/stripe5.gemfile
|
@@ -19,17 +18,12 @@ matrix:
|
|
19
18
|
include:
|
20
19
|
- rvm: 2.3
|
21
20
|
gemfile: gemfiles/rails3.2.gemfile
|
22
|
-
- rvm: 2.
|
23
|
-
gemfile: gemfiles/rails6.0.gemfile
|
24
|
-
- rvm: 2.6
|
25
|
-
gemfile: gemfiles/rails6.0.gemfile
|
26
|
-
- rvm: 2.6
|
27
|
-
gemfile: gemfiles/rails_master.gemfile
|
28
|
-
exclude:
|
29
|
-
- rvm: 2.5
|
21
|
+
- rvm: 2.3
|
30
22
|
gemfile: gemfiles/rails4.2.gemfile
|
31
|
-
- rvm: 2.
|
23
|
+
- rvm: 2.4
|
32
24
|
gemfile: gemfiles/rails4.2.gemfile
|
25
|
+
- rvm: ruby
|
26
|
+
gemfile: gemfiles/rails_master.gemfile
|
33
27
|
allow_failures:
|
34
28
|
- gemfile: gemfiles/rails_master.gemfile
|
35
29
|
fast_finish: true
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -105,13 +105,6 @@ StripeEvent.signing_secrets = [
|
|
105
105
|
|
106
106
|
If you have built an application that has multiple Stripe accounts--say, each of your customers has their own--you may want to define your own way of retrieving events from Stripe (e.g. perhaps you want to use the [account parameter](https://stripe.com/docs/connect/webhooks) from the top level to detect the customer for the event, then grab their specific API key). You can do this:
|
107
107
|
|
108
|
-
```ruby
|
109
|
-
StripeEvent.event_filter = lambda do |event|
|
110
|
-
api_key = Account.find_by!(stripe_account_id: event.account).api_key
|
111
|
-
Stripe::Event.retrieve(event.id, api_key)
|
112
|
-
end
|
113
|
-
```
|
114
|
-
|
115
108
|
```ruby
|
116
109
|
class EventFilter
|
117
110
|
def call(event)
|
data/lib/stripe_event.rb
CHANGED
@@ -18,11 +18,13 @@ module StripeEvent
|
|
18
18
|
backend.instrument namespace.call(event.type), event if event
|
19
19
|
end
|
20
20
|
|
21
|
-
def subscribe(name, callable =
|
21
|
+
def subscribe(name, callable = nil, &block)
|
22
|
+
callable ||= block
|
22
23
|
backend.subscribe namespace.to_regexp(name), adapter.call(callable)
|
23
24
|
end
|
24
25
|
|
25
|
-
def all(callable =
|
26
|
+
def all(callable = nil, &block)
|
27
|
+
callable ||= block
|
26
28
|
subscribe nil, callable
|
27
29
|
end
|
28
30
|
|
data/lib/stripe_event/version.rb
CHANGED
@@ -12,10 +12,19 @@ describe StripeEvent::WebhookController, type: :controller do
|
|
12
12
|
|
13
13
|
def generate_signature(params, secret)
|
14
14
|
payload = params.to_json
|
15
|
-
timestamp = Time.now
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
timestamp = Time.now
|
16
|
+
|
17
|
+
# compute_signature was private until version 5.19.0 when it was made
|
18
|
+
# public and had it's API changed to split timestamp to a separate field.
|
19
|
+
signer = Stripe::Webhook::Signature.method(:compute_signature)
|
20
|
+
signature =
|
21
|
+
if signer.arity == 3
|
22
|
+
signer.call(timestamp, payload, secret)
|
23
|
+
else
|
24
|
+
signer.call("#{timestamp.to_i}.#{payload}", secret)
|
25
|
+
end
|
26
|
+
|
27
|
+
"t=#{timestamp.to_i},v1=#{signature}"
|
19
28
|
end
|
20
29
|
|
21
30
|
def webhook(signature, params)
|
data/stripe_event.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency "appraisal"
|
24
24
|
s.add_development_dependency "coveralls"
|
25
25
|
s.add_development_dependency "rails", [">= 3.1"]
|
26
|
-
s.add_development_dependency "rake"
|
26
|
+
s.add_development_dependency "rake"
|
27
27
|
s.add_development_dependency "rspec-rails", "~> 3.7"
|
28
28
|
s.add_development_dependency "webmock", "~> 1.9"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe_event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Whalen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -90,16 +90,16 @@ dependencies:
|
|
90
90
|
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rspec-rails
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|