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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 622e6067f00eb0c34af4261c16e7ddee15a0dc3938d12121154827cd5fc78453
4
- data.tar.gz: 0f5135cb03f10177a68bbb07762dfc43e8acdac1d4453fe795b3307673f75b3f
3
+ metadata.gz: 90d6d19afa81645efcadb2d980a9d8279d00686e33cc101283a07faaebb76afd
4
+ data.tar.gz: 338d0f8196af2c086cfb2df0bdc2350ac8577d8d45e9db19a9f032191df24161
5
5
  SHA512:
6
- metadata.gz: fea8d1feadced10288c2f663b54cc6b497485a3b25e27d002330fe24c2fbb9e4d67d8beda3c555c1c9fa5beb8dece21987e5c4a514bde9cbb96aa540b1679c5e
7
- data.tar.gz: 6087e16c92ea14b3e34381589763c0b27ccc2d67296f63f7368e56b3f24acfba895376edee81e890515dcfd50f8453364bfb6ece68f4912de0d5d5e2daf84cc4
6
+ metadata.gz: 91789378fbba4beeb4e0245d5f980fdaa27136043ba0e53bb9e4478e57e1e397317fc4069989dd48dfee01eed64c34856294f2b5b3d66681377f0178955dee76
7
+ data.tar.gz: 9289a39f3f459f6a048d252e0803af0a1dd77c559e90f5f6cc261e060ea006de892b96c2a4b50039302936cc11a830fb7a1dc069addcaac989cbdfd566aa591a
@@ -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.5
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.6
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
@@ -1,3 +1,8 @@
1
+ ### 2.3.1 (May 12, 2020)
2
+
3
+ - Fix deprecation warning in Ruby 2.7 (#130)
4
+ - Fixes tests for Stripe 5.19.0 (#133)
5
+
1
6
  ### 2.3.0 (August 23, 2019)
2
7
 
3
8
  - Add support for Stripe v5.x (#119)
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)
@@ -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 = Proc.new)
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 = Proc.new)
26
+ def all(callable = nil, &block)
27
+ callable ||= block
26
28
  subscribe nil, callable
27
29
  end
28
30
 
@@ -1,3 +1,3 @@
1
1
  module StripeEvent
2
- VERSION = "2.3.0"
2
+ VERSION = "2.3.1"
3
3
  end
@@ -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.to_i
16
- signature = Stripe::Webhook::Signature.send(:compute_signature, "#{timestamp}.#{payload}", secret)
17
-
18
- "t=#{timestamp},v1=#{signature}"
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)
@@ -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", "< 11.0"
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.0
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: 2019-08-23 00:00:00.000000000 Z
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: '11.0'
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: '11.0'
102
+ version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rspec-rails
105
105
  requirement: !ruby/object:Gem::Requirement