stripe 5.13.0 → 5.14.0
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 +4 -4
- data/.rubocop.yml +8 -8
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/stripe/object_types.rb +1 -0
- data/lib/stripe/resources.rb +1 -0
- data/lib/stripe/resources/credit_note.rb +5 -0
- data/lib/stripe/resources/credit_note_line_item.rb +7 -0
- data/lib/stripe/stripe_object.rb +2 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/credit_note_test.rb +14 -0
- data/test/stripe/source_test.rb +14 -4
- data/test/stripe/stripe_object_test.rb +8 -5
- data/test/stripe/usage_record_summary_test.rb +14 -4
- data/test/test_helper.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a1fda0057d116729cd70477218913ecf097898f633952d287327ecfaf99133
|
4
|
+
data.tar.gz: ed37e7cb7f025d48a11d075bc507cb6e84f92a36fc542f8d8bcff1bc8729dc50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84dda96e1a4da56d9643b13ae8bb6c6352f90baae770de860834461c73f3489501a81a03c3f98e4f0d0da9e6284c66111df743b9c907fbc82774979ab4f009d0
|
7
|
+
data.tar.gz: 4d166d7eded67674487f2f1e678e86d11a6cb54f88848e185a55a4bca93831307f2dca9f8cc2b8608f1305d7193715ddba48e3bbe3baa0e5245b582fe3bd9090
|
data/.rubocop.yml
CHANGED
@@ -13,18 +13,23 @@ AllCops:
|
|
13
13
|
Layout/CaseIndentation:
|
14
14
|
EnforcedStyle: end
|
15
15
|
|
16
|
-
Layout/
|
16
|
+
Layout/FirstArrayElementIndentation:
|
17
17
|
EnforcedStyle: consistent
|
18
18
|
|
19
|
-
Layout/
|
19
|
+
Layout/FirstHashElementIndentation:
|
20
20
|
EnforcedStyle: consistent
|
21
21
|
|
22
22
|
# This can be re-enabled once we're 2.3+ only and can use the squiggly heredoc
|
23
23
|
# operator. Prior to that, Rubocop recommended bringing in a library like
|
24
24
|
# ActiveSupport to get heredoc indentation, which is just terrible.
|
25
|
-
Layout/
|
25
|
+
Layout/HeredocIndentation:
|
26
26
|
Enabled: false
|
27
27
|
|
28
|
+
Layout/LineLength:
|
29
|
+
Exclude:
|
30
|
+
- "lib/stripe/resources/**/*.rb"
|
31
|
+
- "test/**/*.rb"
|
32
|
+
|
28
33
|
Metrics/BlockLength:
|
29
34
|
Max: 40
|
30
35
|
Exclude:
|
@@ -38,11 +43,6 @@ Metrics/ClassLength:
|
|
38
43
|
# to adhere to this rule.
|
39
44
|
- "test/**/*.rb"
|
40
45
|
|
41
|
-
Metrics/LineLength:
|
42
|
-
Exclude:
|
43
|
-
- "lib/stripe/resources/**/*.rb"
|
44
|
-
- "test/**/*.rb"
|
45
|
-
|
46
46
|
Metrics/MethodLength:
|
47
47
|
# There's ~2 long methods in `StripeClient`. If we want to truncate those a
|
48
48
|
# little, we could move this to be closer to ~30 (but the default of 10 is
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.14.0 - 2020-01-14
|
4
|
+
* [#896](https://github.com/stripe/stripe-ruby/pull/896) Add support for `CreditNoteLineItem`
|
5
|
+
* [#894](https://github.com/stripe/stripe-ruby/pull/894) Clean up test output by capturing `$stderr` when we expect warnings
|
6
|
+
* [#892](https://github.com/stripe/stripe-ruby/pull/892) Explicitly pass a parameter as hash to be more ruby 2.7 friendly
|
7
|
+
* [#893](https://github.com/stripe/stripe-ruby/pull/893) Upgrade Rubocop to 0.79
|
8
|
+
|
3
9
|
## 5.13.0 - 2020-01-08
|
4
10
|
* [#891](https://github.com/stripe/stripe-ruby/pull/891) Fix most Ruby 2.7 warnings
|
5
11
|
|
data/Gemfile
CHANGED
@@ -18,7 +18,7 @@ group :development do
|
|
18
18
|
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
|
19
19
|
# bad, pin to a specific version number here. Try to keep this relatively
|
20
20
|
# up-to-date, but it's not the end of the world if it's not.
|
21
|
-
gem "rubocop", "0.
|
21
|
+
gem "rubocop", "0.79"
|
22
22
|
|
23
23
|
platforms :mri do
|
24
24
|
gem "byebug"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.14.0
|
data/lib/stripe/object_types.rb
CHANGED
@@ -28,6 +28,7 @@ module Stripe
|
|
28
28
|
CountrySpec::OBJECT_NAME => CountrySpec,
|
29
29
|
Coupon::OBJECT_NAME => Coupon,
|
30
30
|
CreditNote::OBJECT_NAME => CreditNote,
|
31
|
+
CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
|
31
32
|
Customer::OBJECT_NAME => Customer,
|
32
33
|
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
|
33
34
|
Discount::OBJECT_NAME => Discount,
|
data/lib/stripe/resources.rb
CHANGED
@@ -18,6 +18,7 @@ require "stripe/resources/checkout/session"
|
|
18
18
|
require "stripe/resources/country_spec"
|
19
19
|
require "stripe/resources/coupon"
|
20
20
|
require "stripe/resources/credit_note"
|
21
|
+
require "stripe/resources/credit_note_line_item"
|
21
22
|
require "stripe/resources/customer"
|
22
23
|
require "stripe/resources/customer_balance_transaction"
|
23
24
|
require "stripe/resources/discount"
|
@@ -23,5 +23,10 @@ module Stripe
|
|
23
23
|
resp, opts = request(:get, resource_url + "/preview", params, opts)
|
24
24
|
Util.convert_to_stripe_object(resp.data, opts)
|
25
25
|
end
|
26
|
+
|
27
|
+
def self.list_preview_line_items(params, opts = {})
|
28
|
+
resp, opts = request(:get, resource_url + "/preview/lines", params, opts)
|
29
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
data/lib/stripe/stripe_object.rb
CHANGED
@@ -135,7 +135,8 @@ module Stripe
|
|
135
135
|
# ==== Attributes
|
136
136
|
#
|
137
137
|
# * +values+ - Hash of values to use to update the current attributes of
|
138
|
-
# the object.
|
138
|
+
# the object. If you are on ruby 2.7 or higher make sure to wrap in curly
|
139
|
+
# braces to be ruby 3 compatible.
|
139
140
|
# * +opts+ - Options for +StripeObject+ like an API key that will be reused
|
140
141
|
# on subsequent API calls.
|
141
142
|
#
|
data/lib/stripe/version.rb
CHANGED
@@ -72,5 +72,19 @@ module Stripe
|
|
72
72
|
assert credit_note.is_a?(Stripe::CreditNote)
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
context ".list_preview_line_items" do
|
77
|
+
should "list_preview_line_items" do
|
78
|
+
line_items = Stripe::CreditNote.list_preview_line_items(
|
79
|
+
invoice: "in_123"
|
80
|
+
)
|
81
|
+
assert_requested :get, "#{Stripe.api_base}/v1/credit_notes/preview/lines",
|
82
|
+
query: {
|
83
|
+
invoice: "in_123",
|
84
|
+
}
|
85
|
+
assert line_items.data.is_a?(Array)
|
86
|
+
assert line_items.data[0].is_a?(Stripe::CreditNoteLineItem)
|
87
|
+
end
|
88
|
+
end
|
75
89
|
end
|
76
90
|
end
|
data/test/stripe/source_test.rb
CHANGED
@@ -99,10 +99,20 @@ module Stripe
|
|
99
99
|
|
100
100
|
context "#source_transactions" do
|
101
101
|
should "list source transactions" do
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
old_stderr = $stderr
|
103
|
+
$stderr = StringIO.new
|
104
|
+
|
105
|
+
begin
|
106
|
+
source = Stripe::Source.construct_from(id: "src_123",
|
107
|
+
object: "source")
|
108
|
+
source.source_transactions
|
109
|
+
assert_requested :get, "#{Stripe.api_base}/v1/sources/src_123/source_transactions"
|
110
|
+
|
111
|
+
assert_include $stderr.string,
|
112
|
+
"use Source.list_source_transactions instead"
|
113
|
+
ensure
|
114
|
+
$stderr = old_stderr
|
115
|
+
end
|
106
116
|
end
|
107
117
|
end
|
108
118
|
end
|
@@ -212,26 +212,29 @@ module Stripe
|
|
212
212
|
|
213
213
|
should "mass assign values with #update_attributes" do
|
214
214
|
obj = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
|
215
|
-
|
215
|
+
|
216
|
+
obj.update_attributes({ name: "STRIPE" }) # rubocop:disable Style/BracesAroundHashParameters
|
217
|
+
|
216
218
|
assert_equal "STRIPE", obj.name
|
217
219
|
|
218
220
|
# unfortunately, we even assign unknown properties to duplicate the
|
219
221
|
# behavior that we currently have via magic accessors with
|
220
222
|
# method_missing
|
221
|
-
obj.update_attributes(unknown: "foo")
|
223
|
+
obj.update_attributes({ unknown: "foo" }) # rubocop:disable Style/BracesAroundHashParameters
|
224
|
+
|
222
225
|
assert_equal "foo", obj.unknown
|
223
226
|
end
|
224
227
|
|
225
228
|
should "#update_attributes with a hash" do
|
226
229
|
obj = Stripe::StripeObject.construct_from({})
|
227
|
-
obj.update_attributes(metadata: { foo: "bar" })
|
230
|
+
obj.update_attributes({ metadata: { foo: "bar" } }) # rubocop:disable Style/BracesAroundHashParameters
|
228
231
|
assert_equal Stripe::StripeObject, obj.metadata.class
|
229
232
|
end
|
230
233
|
|
231
234
|
should "create accessors when #update_attributes is called" do
|
232
235
|
obj = Stripe::StripeObject.construct_from({})
|
233
236
|
assert_equal false, obj.send(:metaclass).method_defined?(:foo)
|
234
|
-
obj.update_attributes(foo: "bar")
|
237
|
+
obj.update_attributes({ foo: "bar" }) # rubocop:disable Style/BracesAroundHashParameters
|
235
238
|
assert_equal true, obj.send(:metaclass).method_defined?(:foo)
|
236
239
|
end
|
237
240
|
|
@@ -268,7 +271,7 @@ module Stripe
|
|
268
271
|
|
269
272
|
should "#serialize_params on a basic object" do
|
270
273
|
obj = Stripe::StripeObject.construct_from(foo: nil)
|
271
|
-
obj.update_attributes(foo: "bar")
|
274
|
+
obj.update_attributes({ foo: "bar" }) # rubocop:disable Style/BracesAroundHashParameters
|
272
275
|
assert_equal({ foo: "bar" }, obj.serialize_params)
|
273
276
|
end
|
274
277
|
|
@@ -9,11 +9,21 @@ module Stripe
|
|
9
9
|
end
|
10
10
|
|
11
11
|
should "be listable" do
|
12
|
-
|
12
|
+
old_stderr = $stderr
|
13
|
+
$stderr = StringIO.new
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
begin
|
16
|
+
transactions = @sub_item.usage_record_summaries
|
17
|
+
|
18
|
+
assert_requested :get, "#{Stripe.api_base}/v1/subscription_items/#{@sub_item.id}/usage_record_summaries"
|
19
|
+
assert transactions.data.is_a?(Array)
|
20
|
+
assert transactions.first.is_a?(Stripe::UsageRecordSummary)
|
21
|
+
|
22
|
+
assert_include $stderr.string,
|
23
|
+
"use SubscriptionItem.list_usage_record_summaries instead"
|
24
|
+
ensure
|
25
|
+
$stderr = old_stderr
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
19
29
|
end
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__)
|
|
16
16
|
require ::File.expand_path("stripe_mock", __dir__)
|
17
17
|
|
18
18
|
# If changing this number, please also change it in `.travis.yml`.
|
19
|
-
MOCK_MINIMUM_VERSION = "0.
|
19
|
+
MOCK_MINIMUM_VERSION = "0.79.0"
|
20
20
|
MOCK_PORT = Stripe::StripeMock.start
|
21
21
|
|
22
22
|
# Disable all real network connections except those that are outgoing to
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
14
14
|
for details.
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/stripe/resources/country_spec.rb
|
74
74
|
- lib/stripe/resources/coupon.rb
|
75
75
|
- lib/stripe/resources/credit_note.rb
|
76
|
+
- lib/stripe/resources/credit_note_line_item.rb
|
76
77
|
- lib/stripe/resources/customer.rb
|
77
78
|
- lib/stripe/resources/customer_balance_transaction.rb
|
78
79
|
- lib/stripe/resources/discount.rb
|