stripe-rails 1.5.0 → 1.5.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: 8fbadf81c0f8478feeffda1a46ed1b29b7fd5771eec9fbec5f2a8cd0684a051f
4
- data.tar.gz: baa6413f94ecc16b4ac4ba192e29dc7ef3c5742de759ed1e22397a13e71b764e
3
+ metadata.gz: 7db8795e52cc3f40773d7104222eb9f36ceea62a5d51ddc9a0f5215d2635021c
4
+ data.tar.gz: ee17376ed75a5f28e755a7bd7e4e8bcf4e91fb2de23b96226f0837b6f678afe6
5
5
  SHA512:
6
- metadata.gz: ca51fc8a16bac65cd5ecda5d92130ecf18e83870cacc3c422952846d61359f89ecb877151b4ff9ea93c0e1b25746dd9efe6f86d6790a363de0ede13e6727a9c3
7
- data.tar.gz: 7b380bb3b762c6acc39de20b4d0187c15623dc3141adda0bed62d0017a533ccbb546ba4352682d903dae04bf567f504f0a8eb27487b3ab2327d21f1fe973cb41
6
+ metadata.gz: 007ca00d0dea9a363b5042fa2d82ce42e430a53c7773682b92b74a6c77ce4024756eab6df5b919b08f7b0699b45450b0cb69cb63e1546c6d429f427af520efc9
7
+ data.tar.gz: d37cfd7ffc037cf80d119c366993d89a1d90a7291bd9a1fe4477b0d120c24e7f550baf948ea4bbdb1ec86c2e05f2644c34bdcf308625078c4b8c1498fc53a2a2
data/Changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.5.1 (2018-10-01)
2
+
3
+ * Allow statement_descriptor to be set on products - Thanks to @jeanmartin
4
+
5
+
1
6
  ## 1.5.0 (2018-09-27)
2
7
 
3
8
  * Add Webhook Signature Validation - Thanks to @wkirby
data/README.md CHANGED
@@ -177,9 +177,10 @@ end
177
177
  As are Products:
178
178
 
179
179
  ```ruby
180
- Stripe.products :primo do |products|
181
- products.name = 'PRIMO as a service'
182
- products.type = 'service'
180
+ Stripe.product :primo do |product|
181
+ product.name = 'PRIMO as a service'
182
+ product.type = 'service'
183
+ product.statement_descriptor = 'PRIMO'
183
184
  end
184
185
  ```
185
186
 
@@ -11,19 +11,27 @@ module Stripe
11
11
  :caption,
12
12
  :metadata,
13
13
  :shippable,
14
- :url
14
+ :url,
15
+ :statement_descriptor
15
16
 
16
17
  validates_presence_of :name, :type
17
18
 
19
+ validates :statement_descriptor, length: { maximum: 22 }
20
+
18
21
  validates :active, :shippable, inclusion: { in: [true, false] }, allow_nil: true
19
22
  validates :type, inclusion: { in: %w(service good) }
20
23
  validates :caption, :description, :shippable, :url, absence: true, unless: :good?
24
+ validates :statement_descriptor, absence: true, unless: :service?
21
25
 
22
26
  private
23
27
  def good?
24
28
  type == 'good'
25
29
  end
26
30
 
31
+ def service?
32
+ type == 'service'
33
+ end
34
+
27
35
  def create_options
28
36
  {
29
37
  name: name,
@@ -35,6 +43,7 @@ module Stripe
35
43
  metadata: metadata,
36
44
  shippable: shippable,
37
45
  url: url,
46
+ statement_descriptor: statement_descriptor
38
47
  }.delete_if{|_, v| v.nil? }
39
48
  end
40
49
  end
@@ -1,5 +1,5 @@
1
1
  module Stripe
2
2
  module Rails
3
- VERSION = '1.5.0'
3
+ VERSION = '1.5.1'
4
4
  end
5
5
  end
@@ -8,6 +8,7 @@ describe 'building products' do
8
8
  product.active = true
9
9
  product.attributes = ['size', 'gender']
10
10
  product.metadata = {:number_of_awesome_things => 5}
11
+ product.statement_descriptor = 'PRIMO'
11
12
  end
12
13
  end
13
14
 
@@ -32,12 +33,13 @@ describe 'building products' do
32
33
 
33
34
  it 'creates the plan online' do
34
35
  Stripe::Product.expects(:create).with(
35
- :id => :primo,
36
- :name => 'Acme as a service PRIMO',
37
- :type => 'service',
38
- :active => true,
39
- :attributes => ['size', 'gender'],
40
- :metadata => {:number_of_awesome_things => 5},
36
+ id: :primo,
37
+ name: 'Acme as a service PRIMO',
38
+ type: 'service',
39
+ active: true,
40
+ attributes: ['size', 'gender'],
41
+ metadata: {:number_of_awesome_things => 5},
42
+ statement_descriptor: 'PRIMO'
41
43
  )
42
44
  Stripe::Products::PRIMO.put!
43
45
  end
@@ -87,5 +89,17 @@ describe 'building products' do
87
89
  }.must_raise Stripe::InvalidConfigurationError
88
90
  end
89
91
  end
92
+
93
+ describe 'when using an attribute only for services' do
94
+ it 'raises an exception during configuration' do
95
+ lambda {
96
+ Stripe.product :broken do |product|
97
+ product.name = 'Broken Good'
98
+ product.type = 'good'
99
+ product.statement_descriptor = 'SERVICE'
100
+ end
101
+ }.must_raise Stripe::InvalidConfigurationError
102
+ end
103
+ end
90
104
  end
91
105
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Lowell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-09-27 00:00:00.000000000 Z
13
+ date: 2018-10-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails