stripe 4.10.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/.rubocop.yml +28 -4
- data/.rubocop_todo.yml +11 -22
- data/.travis.yml +3 -6
- data/.vscode/extensions.json +7 -0
- data/.vscode/settings.json +8 -0
- data/CHANGELOG.md +86 -1
- data/Gemfile +2 -10
- data/README.md +96 -40
- data/Rakefile +8 -7
- data/VERSION +1 -1
- data/lib/stripe/api_operations/delete.rb +23 -1
- data/lib/stripe/api_operations/list.rb +0 -6
- data/lib/stripe/api_operations/nested_resource.rb +14 -7
- data/lib/stripe/api_operations/request.rb +3 -7
- data/lib/stripe/api_operations/save.rb +1 -3
- data/lib/stripe/api_resource.rb +50 -2
- data/lib/stripe/connection_manager.rb +131 -0
- data/lib/stripe/error_object.rb +94 -0
- data/lib/stripe/errors.rb +22 -9
- data/lib/stripe/list_object.rb +11 -5
- data/lib/stripe/multipart_encoder.rb +131 -0
- data/lib/stripe/object_types.rb +94 -0
- data/lib/stripe/{account.rb → resources/account.rb} +49 -27
- data/lib/stripe/{account_link.rb → resources/account_link.rb} +1 -1
- data/lib/stripe/resources/alipay_account.rb +34 -0
- data/lib/stripe/{apple_pay_domain.rb → resources/apple_pay_domain.rb} +1 -1
- data/lib/stripe/resources/application_fee.rb +13 -0
- data/lib/stripe/resources/application_fee_refund.rb +30 -0
- data/lib/stripe/{balance.rb → resources/balance.rb} +1 -1
- data/lib/stripe/{balance_transaction.rb → resources/balance_transaction.rb} +1 -5
- data/lib/stripe/{bank_account.rb → resources/bank_account.rb} +14 -4
- data/lib/stripe/{bitcoin_receiver.rb → resources/bitcoin_receiver.rb} +3 -3
- data/lib/stripe/{bitcoin_transaction.rb → resources/bitcoin_transaction.rb} +1 -1
- data/lib/stripe/resources/capability.rb +33 -0
- data/lib/stripe/{card.rb → resources/card.rb} +12 -4
- data/lib/stripe/resources/charge.rb +22 -0
- data/lib/stripe/{checkout → resources/checkout}/session.rb +2 -2
- data/lib/stripe/{country_spec.rb → resources/country_spec.rb} +1 -1
- data/lib/stripe/{coupon.rb → resources/coupon.rb} +2 -2
- data/lib/stripe/resources/credit_note.rb +22 -0
- data/lib/stripe/resources/customer.rb +35 -0
- data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
- data/lib/stripe/resources/discount.rb +7 -0
- data/lib/stripe/{dispute.rb → resources/dispute.rb} +9 -7
- data/lib/stripe/{ephemeral_key.rb → resources/ephemeral_key.rb} +5 -2
- data/lib/stripe/{event.rb → resources/event.rb} +1 -1
- data/lib/stripe/{exchange_rate.rb → resources/exchange_rate.rb} +1 -1
- data/lib/stripe/{file.rb → resources/file.rb} +8 -11
- data/lib/stripe/{file_link.rb → resources/file_link.rb} +2 -2
- data/lib/stripe/resources/invoice.rb +73 -0
- data/lib/stripe/{invoice_item.rb → resources/invoice_item.rb} +2 -2
- data/lib/stripe/{invoice_line_item.rb → resources/invoice_line_item.rb} +1 -1
- data/lib/stripe/resources/issuing/authorization.rb +33 -0
- data/lib/stripe/resources/issuing/card.rb +24 -0
- data/lib/stripe/{issuing → resources/issuing}/card_details.rb +1 -1
- data/lib/stripe/{issuing → resources/issuing}/cardholder.rb +2 -2
- data/lib/stripe/{issuing → resources/issuing}/dispute.rb +2 -2
- data/lib/stripe/{issuing → resources/issuing}/transaction.rb +2 -2
- data/lib/stripe/resources/login_link.rb +14 -0
- data/lib/stripe/resources/order.rb +32 -0
- data/lib/stripe/{order_return.rb → resources/order_return.rb} +1 -1
- data/lib/stripe/resources/payment_intent.rb +42 -0
- data/lib/stripe/resources/payment_method.rb +32 -0
- data/lib/stripe/resources/payout.rb +22 -0
- data/lib/stripe/{person.rb → resources/person.rb} +8 -3
- data/lib/stripe/{plan.rb → resources/plan.rb} +1 -1
- data/lib/stripe/{product.rb → resources/product.rb} +3 -3
- data/lib/stripe/resources/radar/early_fraud_warning.rb +11 -0
- data/lib/stripe/{radar → resources/radar}/value_list.rb +2 -2
- data/lib/stripe/{radar → resources/radar}/value_list_item.rb +2 -2
- data/lib/stripe/{recipient.rb → resources/recipient.rb} +2 -6
- data/lib/stripe/{recipient_transfer.rb → resources/recipient_transfer.rb} +1 -1
- data/lib/stripe/{refund.rb → resources/refund.rb} +1 -1
- data/lib/stripe/{reporting → resources/reporting}/report_run.rb +2 -2
- data/lib/stripe/{reporting → resources/reporting}/report_type.rb +2 -2
- data/lib/stripe/resources/reversal.rb +29 -0
- data/lib/stripe/resources/review.rb +20 -0
- data/lib/stripe/resources/setup_intent.rb +32 -0
- data/lib/stripe/{sigma → resources/sigma}/scheduled_query_run.rb +2 -2
- data/lib/stripe/{sku.rb → resources/sku.rb} +3 -3
- data/lib/stripe/{source.rb → resources/source.rb} +17 -15
- data/lib/stripe/{source_transaction.rb → resources/source_transaction.rb} +1 -1
- data/lib/stripe/resources/subscription.rb +25 -0
- data/lib/stripe/{subscription_item.rb → resources/subscription_item.rb} +5 -2
- data/lib/stripe/resources/subscription_schedule.rb +32 -0
- data/lib/stripe/resources/tax_id.rb +26 -0
- data/lib/stripe/resources/tax_rate.rb +11 -0
- data/lib/stripe/{terminal → resources/terminal}/connection_token.rb +2 -2
- data/lib/stripe/{terminal → resources/terminal}/location.rb +2 -2
- data/lib/stripe/{terminal → resources/terminal}/reader.rb +2 -2
- data/lib/stripe/{three_d_secure.rb → resources/three_d_secure.rb} +1 -1
- data/lib/stripe/{token.rb → resources/token.rb} +1 -1
- data/lib/stripe/resources/topup.rb +22 -0
- data/lib/stripe/resources/transfer.rb +26 -0
- data/lib/stripe/resources/usage_record.rb +7 -0
- data/lib/stripe/{usage_record_summary.rb → resources/usage_record_summary.rb} +1 -1
- data/lib/stripe/{webhook_endpoint.rb → resources/webhook_endpoint.rb} +2 -2
- data/lib/stripe/resources.rb +77 -0
- data/lib/stripe/singleton_api_resource.rb +3 -1
- data/lib/stripe/stripe_client.rb +337 -218
- data/lib/stripe/stripe_object.rb +54 -59
- data/lib/stripe/stripe_response.rb +53 -21
- data/lib/stripe/util.rb +54 -110
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +5 -3
- data/lib/stripe.rb +64 -86
- data/stripe.gemspec +14 -5
- data/test/stripe/account_link_test.rb +1 -1
- data/test/stripe/account_test.rb +186 -30
- data/test/stripe/alipay_account_test.rb +1 -1
- data/test/stripe/api_operations_test.rb +3 -4
- data/test/stripe/api_resource_test.rb +105 -18
- data/test/stripe/apple_pay_domain_test.rb +18 -5
- data/test/stripe/application_fee_refund_test.rb +1 -1
- data/test/stripe/application_fee_test.rb +45 -1
- data/test/stripe/balance_test.rb +1 -1
- data/test/stripe/balance_transaction_test.rb +20 -0
- data/test/stripe/bank_account_test.rb +1 -1
- data/test/stripe/capability_test.rb +45 -0
- data/test/stripe/charge_test.rb +13 -8
- data/test/stripe/checkout/session_test.rb +1 -1
- data/test/stripe/connection_manager_test.rb +138 -0
- data/test/stripe/country_spec_test.rb +1 -1
- data/test/stripe/coupon_test.rb +16 -6
- data/test/stripe/credit_note_test.rb +61 -0
- data/test/stripe/customer_balance_transaction_test.rb +37 -0
- data/test/stripe/customer_card_test.rb +1 -1
- data/test/stripe/customer_test.rb +151 -40
- data/test/stripe/dispute_test.rb +10 -1
- data/test/stripe/ephemeral_key_test.rb +8 -1
- data/test/stripe/errors_test.rb +30 -9
- data/test/stripe/exchange_rate_test.rb +1 -1
- data/test/stripe/file_link_test.rb +1 -1
- data/test/stripe/file_test.rb +19 -5
- data/test/stripe/invoice_item_test.rb +18 -7
- data/test/stripe/invoice_line_item_test.rb +1 -1
- data/test/stripe/invoice_test.rb +77 -9
- data/test/stripe/issuing/authorization_test.rb +33 -11
- data/test/stripe/issuing/card_test.rb +15 -6
- data/test/stripe/issuing/cardholder_test.rb +1 -1
- data/test/stripe/issuing/dispute_test.rb +1 -1
- data/test/stripe/issuing/transaction_test.rb +1 -1
- data/test/stripe/list_object_test.rb +1 -17
- data/test/stripe/login_link_test.rb +2 -2
- data/test/stripe/multipart_encoder_test.rb +130 -0
- data/test/stripe/oauth_test.rb +1 -1
- data/test/stripe/order_return_test.rb +1 -1
- data/test/stripe/order_test.rb +28 -3
- data/test/stripe/payment_intent_test.rb +31 -4
- data/test/stripe/payment_method_test.rb +19 -1
- data/test/stripe/payout_test.rb +8 -1
- data/test/stripe/person_test.rb +1 -1
- data/test/stripe/plan_test.rb +26 -20
- data/test/stripe/product_test.rb +16 -6
- data/test/stripe/radar/early_fraud_warning_test.rb +22 -0
- data/test/stripe/radar/value_list_item_test.rb +16 -6
- data/test/stripe/radar/value_list_test.rb +16 -6
- data/test/stripe/recipient_test.rb +18 -5
- data/test/stripe/refund_test.rb +1 -1
- data/test/stripe/reporting/report_run_test.rb +1 -1
- data/test/stripe/reporting/report_type_test.rb +1 -1
- data/test/stripe/reversal_test.rb +1 -1
- data/test/stripe/review_test.rb +1 -1
- data/test/stripe/setup_intent_test.rb +84 -0
- data/test/stripe/sigma/scheduled_query_run_test.rb +1 -1
- data/test/stripe/sku_test.rb +16 -6
- data/test/stripe/source_test.rb +14 -19
- data/test/stripe/source_transaction_test.rb +1 -1
- data/test/stripe/stripe_client_test.rb +230 -26
- data/test/stripe/stripe_object_test.rb +8 -36
- data/test/stripe/stripe_response_test.rb +71 -25
- data/test/stripe/subscription_item_test.rb +28 -6
- data/test/stripe/subscription_schedule_test.rb +19 -1
- data/test/stripe/subscription_test.rb +29 -9
- data/test/stripe/tax_id_test.rb +31 -0
- data/test/stripe/tax_rate_test.rb +43 -0
- data/test/stripe/terminal/connection_token_test.rb +1 -1
- data/test/stripe/terminal/location_test.rb +16 -6
- data/test/stripe/terminal/reader_test.rb +16 -6
- data/test/stripe/three_d_secure_test.rb +1 -1
- data/test/stripe/topup_test.rb +9 -1
- data/test/stripe/transfer_test.rb +46 -1
- data/test/stripe/usage_record_summary_test.rb +1 -1
- data/test/stripe/util_test.rb +1 -1
- data/test/stripe/webhook_endpoint_test.rb +18 -1
- data/test/stripe/webhook_test.rb +4 -4
- data/test/stripe_mock.rb +4 -3
- data/test/stripe_test.rb +1 -14
- data/test/test_helper.rb +14 -11
- metadata +114 -124
- data/lib/stripe/alipay_account.rb +0 -27
- data/lib/stripe/application_fee.rb +0 -23
- data/lib/stripe/application_fee_refund.rb +0 -22
- data/lib/stripe/charge.rb +0 -84
- data/lib/stripe/customer.rb +0 -90
- data/lib/stripe/invoice.rb +0 -48
- data/lib/stripe/issuer_fraud_record.rb +0 -9
- data/lib/stripe/issuing/authorization.rb +0 -22
- data/lib/stripe/issuing/card.rb +0 -18
- data/lib/stripe/login_link.rb +0 -11
- data/lib/stripe/order.rb +0 -31
- data/lib/stripe/payment_intent.rb +0 -26
- data/lib/stripe/payment_method.rb +0 -23
- data/lib/stripe/payout.rb +0 -20
- data/lib/stripe/reversal.rb +0 -22
- data/lib/stripe/review.rb +0 -14
- data/lib/stripe/subscription.rb +0 -25
- data/lib/stripe/subscription_schedule.rb +0 -32
- data/lib/stripe/subscription_schedule_revision.rb +0 -25
- data/lib/stripe/topup.rb +0 -16
- data/lib/stripe/transfer.rb +0 -23
- data/lib/stripe/usage_record.rb +0 -14
- data/test/stripe/account_external_accounts_operations_test.rb +0 -69
- data/test/stripe/account_login_links_operations_test.rb +0 -21
- data/test/stripe/account_persons_operations_test.rb +0 -70
- data/test/stripe/application_fee_refunds_operations_test.rb +0 -56
- data/test/stripe/customer_sources_operations_test.rb +0 -64
- data/test/stripe/file_upload_test.rb +0 -76
- data/test/stripe/issuer_fraud_record_test.rb +0 -20
- data/test/stripe/subscription_schedule_revision_test.rb +0 -37
- data/test/stripe/subscription_schedule_revisions_operations_test.rb +0 -35
- data/test/stripe/transfer_reversals_operations_test.rb +0 -57
- data/test/stripe/usage_record_test.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa015ad0ee6a063db43580f0234ec2738fe5670c82cfa4843ed3bc91d8eb4670
|
4
|
+
data.tar.gz: f987cba3323dbac56c0121fd0d89d5c282a2b3cab9d46f9284cae99b0093d534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b5d25d67c8ade84275d3187988de8660df98d1b2323fa231bc4e1a5ef6dfc9edb2ffcbe71bff404f7a473f4cdde0c5644ec379c625f9a45ea62606792f29871
|
7
|
+
data.tar.gz: ede395b847a59fba4fc3200f174d212c79fa0781222def2323d27cfdec626f3ff869147c2dfc3639206ce9b4d5ff0a282ec92059d04b8ff6b26d619d81655acd
|
data/.editorconfig
ADDED
data/.rubocop.yml
CHANGED
@@ -2,17 +2,32 @@ inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
3
3
|
AllCops:
|
4
4
|
DisplayCopNames: true
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.3
|
6
6
|
|
7
7
|
Layout/CaseIndentation:
|
8
8
|
EnforcedStyle: end
|
9
9
|
|
10
|
-
Layout/
|
10
|
+
Layout/IndentFirstArrayElement:
|
11
11
|
EnforcedStyle: consistent
|
12
12
|
|
13
|
-
Layout/
|
13
|
+
Layout/IndentFirstHashElement:
|
14
14
|
EnforcedStyle: consistent
|
15
15
|
|
16
|
+
# This can be re-enabled once we're 2.3+ only and can use the squiggly heredoc
|
17
|
+
# operator. Prior to that, Rubocop recommended bringing in a library like
|
18
|
+
# ActiveSupport to get heredoc indentation, which is just terrible.
|
19
|
+
Layout/IndentHeredoc:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/ClassLength:
|
23
|
+
Exclude:
|
24
|
+
- "test/**/*.rb"
|
25
|
+
|
26
|
+
Metrics/LineLength:
|
27
|
+
Exclude:
|
28
|
+
- "lib/stripe/resources/**/*.rb"
|
29
|
+
- "test/**/*.rb"
|
30
|
+
|
16
31
|
Metrics/MethodLength:
|
17
32
|
# There's ~2 long methods in `StripeClient`. If we want to truncate those a
|
18
33
|
# little, we could move this to be closer to ~30 (but the default of 10 is
|
@@ -22,11 +37,20 @@ Metrics/MethodLength:
|
|
22
37
|
Metrics/ModuleLength:
|
23
38
|
Enabled: false
|
24
39
|
|
40
|
+
Style/AccessModifierDeclarations:
|
41
|
+
EnforcedStyle: inline
|
42
|
+
|
25
43
|
Style/FrozenStringLiteralComment:
|
26
44
|
EnforcedStyle: always
|
27
45
|
|
46
|
+
Style/NumericPredicate:
|
47
|
+
Enabled: false
|
48
|
+
|
28
49
|
Style/StringLiterals:
|
29
50
|
EnforcedStyle: double_quotes
|
30
51
|
|
31
|
-
Style/
|
52
|
+
Style/TrailingCommaInArrayLiteral:
|
53
|
+
EnforcedStyleForMultiline: consistent_comma
|
54
|
+
|
55
|
+
Style/TrailingCommaInHashLiteral:
|
32
56
|
EnforcedStyleForMultiline: consistent_comma
|
data/.rubocop_todo.yml
CHANGED
@@ -1,50 +1,39 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2019-07-30 09:56:31 +0800 using RuboCop version 0.73.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 23
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 51
|
12
12
|
|
13
|
-
# Offense count:
|
13
|
+
# Offense count: 33
|
14
14
|
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
+
# ExcludedMethods: refine
|
15
16
|
Metrics/BlockLength:
|
16
|
-
Max:
|
17
|
+
Max: 509
|
17
18
|
|
18
|
-
# Offense count:
|
19
|
+
# Offense count: 12
|
19
20
|
# Configuration parameters: CountComments.
|
20
21
|
Metrics/ClassLength:
|
21
|
-
Max:
|
22
|
+
Max: 694
|
22
23
|
|
23
|
-
# Offense count:
|
24
|
+
# Offense count: 12
|
24
25
|
Metrics/CyclomaticComplexity:
|
25
26
|
Max: 15
|
26
27
|
|
27
|
-
# Offense count: 278
|
28
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
-
# URISchemes: http, https
|
30
|
-
Metrics/LineLength:
|
31
|
-
Max: 310
|
32
|
-
|
33
28
|
# Offense count: 6
|
34
29
|
# Configuration parameters: CountKeywordArgs.
|
35
30
|
Metrics/ParameterLists:
|
36
31
|
Max: 7
|
37
32
|
|
38
|
-
# Offense count:
|
33
|
+
# Offense count: 8
|
39
34
|
Metrics/PerceivedComplexity:
|
40
35
|
Max: 17
|
41
36
|
|
42
|
-
# Offense count:
|
43
|
-
Style/ClassVars:
|
44
|
-
Exclude:
|
45
|
-
- 'lib/stripe/stripe_object.rb'
|
46
|
-
- 'test/stripe/api_resource_test.rb'
|
47
|
-
|
48
|
-
# Offense count: 56
|
37
|
+
# Offense count: 86
|
49
38
|
Style/Documentation:
|
50
39
|
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.1
|
5
|
-
- 2.2
|
6
4
|
- 2.3
|
7
5
|
- 2.4
|
8
6
|
- 2.5
|
9
|
-
-
|
7
|
+
- 2.6
|
8
|
+
- jruby-9.2.7.0
|
10
9
|
|
11
10
|
notifications:
|
12
11
|
email:
|
@@ -17,15 +16,13 @@ sudo: false
|
|
17
16
|
env:
|
18
17
|
global:
|
19
18
|
# If changing this number, please also change it in `test/test_helper.rb`.
|
20
|
-
- STRIPE_MOCK_VERSION=0.
|
19
|
+
- STRIPE_MOCK_VERSION=0.63.0
|
21
20
|
|
22
21
|
cache:
|
23
22
|
directories:
|
24
23
|
- stripe-mock
|
25
24
|
|
26
25
|
before_install:
|
27
|
-
# Install bundler 1.x, because we need to support Ruby 2.1 for now
|
28
|
-
- gem install bundler -v "~> 1.0"
|
29
26
|
# Unpack and start stripe-mock so that the test suite can talk to it
|
30
27
|
- |
|
31
28
|
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,90 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.0.0 - 2019-08-20
|
4
|
+
Major version release. The [migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v5) contains a detailed list of backwards-incompatible changes with upgrade instructions.
|
5
|
+
|
6
|
+
Pull requests included in this release (cf. [#815](https://github.com/stripe/stripe-ruby/pull/815)) (⚠️ = breaking changes):
|
7
|
+
* [x] ⚠️ #813: Convert library to use built-in `Net::HTTP`
|
8
|
+
* [x] ⚠️ #816: Make `code` argument in `CardError` named instead of positional.
|
9
|
+
* [x] ⚠️ #817: Drop support for very old Ruby versions.
|
10
|
+
* [x] #818: Bump Rubocop to latest version
|
11
|
+
* [x] #819: Ruby minimum version increase followup
|
12
|
+
* [x] ⚠️ #820: Remove old deprecated methods
|
13
|
+
* [x] ⚠️ #823: Remove all alias for list methods
|
14
|
+
* [x] ⚠️ #826: Remove `UsageRecord.create` method
|
15
|
+
* [x] ⚠️ #827: Remove `IssuerFraudRecord`
|
16
|
+
* [x] #811: Add `ErrorObject` to `StripeError` exceptions
|
17
|
+
* [x] #828: Tweak retry logic to be a little more like stripe-node
|
18
|
+
* [x] #829: Reset connections when connection-changing configuration changes (optional)
|
19
|
+
* [x] #830: Fix inverted sign for 500 retries
|
20
|
+
* [x] ⚠️#831: Remove a few more very old deprecated methods
|
21
|
+
* [x] #832: Minor cleanup in `StripeClient`
|
22
|
+
* [x] #833: Do better bookkeeping when tracking state in `Thread.current`
|
23
|
+
* [x] #834: Add `Invoice.list_upcoming_line_items` method
|
24
|
+
|
25
|
+
## 4.24.0 - 2019-08-12
|
26
|
+
* [#825](https://github.com/stripe/stripe-ruby/pull/825) Add `SubscriptionItem.create_usage_record` method
|
27
|
+
- This release also removed the `SubscriptionSchedule.revisions` method. This should have been included in the previous release (4.23.0)
|
28
|
+
|
29
|
+
## 4.23.0 - 2019-08-09
|
30
|
+
* [#824](https://github.com/stripe/stripe-ruby/pull/824) Remove SubscriptionScheduleRevision
|
31
|
+
- This is technically a breaking change. We've chosen to release it as a minor vesion bump because the associated API is unused.
|
32
|
+
|
33
|
+
## 4.22.1 - 2019-08-09
|
34
|
+
* [#808](https://github.com/stripe/stripe-ruby/pull/808) Unify request/response handling
|
35
|
+
|
36
|
+
## 4.22.0 - 2019-07-30
|
37
|
+
* [#821](https://github.com/stripe/stripe-ruby/pull/821) Listing `BalanceTransaction` objects now uses `/v1/balance_transactions` instead of `/v1/balance/history`
|
38
|
+
|
39
|
+
## 4.21.3 - 2019-07-15
|
40
|
+
* [#810](https://github.com/stripe/stripe-ruby/pull/810) Better error message when passing non-string to custom method
|
41
|
+
|
42
|
+
## 4.21.2 - 2019-07-05
|
43
|
+
* [#806](https://github.com/stripe/stripe-ruby/pull/806) Revert back to `initialize_from` from `Util.convert_to_stripe_object`
|
44
|
+
|
45
|
+
## 4.21.1 - 2019-07-04
|
46
|
+
* [#807](https://github.com/stripe/stripe-ruby/pull/807) Add gem metadata
|
47
|
+
|
48
|
+
## 4.21.0 - 2019-06-28
|
49
|
+
* [#803](https://github.com/stripe/stripe-ruby/pull/803) Add support for the `SetupIntent` resource and APIs
|
50
|
+
|
51
|
+
## 4.20.1 - 2019-06-28
|
52
|
+
* [#805](https://github.com/stripe/stripe-ruby/pull/805) Fix formatting in `ConnectionFailed` error message
|
53
|
+
|
54
|
+
## 4.20.0 - 2019-06-24
|
55
|
+
* [#800](https://github.com/stripe/stripe-ruby/pull/800) Enable request latency telemetry by default
|
56
|
+
|
57
|
+
## 4.19.0 - 2019-06-17
|
58
|
+
* [#770](https://github.com/stripe/stripe-ruby/pull/770) Add support for `CustomerBalanceTransaction` resource and APIs
|
59
|
+
|
60
|
+
## 4.18.1 - 2019-05-27
|
61
|
+
* [#789](https://github.com/stripe/stripe-ruby/pull/789) Allow `Order#pay` to be called without arguments
|
62
|
+
|
63
|
+
## 4.18.0 - 2019-05-23
|
64
|
+
* [#783](https://github.com/stripe/stripe-ruby/pull/783) Add support for `radar.early_fraud_warning` resource
|
65
|
+
|
66
|
+
## 4.17.0 - 2019-05-14
|
67
|
+
* [#779](https://github.com/stripe/stripe-ruby/pull/779) Add support for the Capability resource and APIs
|
68
|
+
|
69
|
+
## 4.16.0 - 2019-04-24
|
70
|
+
* [#760](https://github.com/stripe/stripe-ruby/pull/760) Add support for the `TaxRate` resource and APIs
|
71
|
+
|
72
|
+
## 4.15.0 - 2019-04-22
|
73
|
+
* [#762](https://github.com/stripe/stripe-ruby/pull/762) Add support for the `TaxId` resource and APIs
|
74
|
+
|
75
|
+
## 4.14.0 - 2019-04-18
|
76
|
+
* [#758](https://github.com/stripe/stripe-ruby/pull/758) Add support for the `CreditNote` resource and APIs
|
77
|
+
|
78
|
+
## 4.13.0 - 2019-04-16
|
79
|
+
* [#766](https://github.com/stripe/stripe-ruby/pull/766) Relax constraints on objects that we'll accept as a file (now they just need to respond to `#read`)
|
80
|
+
|
81
|
+
## 4.12.0 - 2019-04-02
|
82
|
+
* [#752](https://github.com/stripe/stripe-ruby/pull/752) Add `.delete` class method on deletable API resources
|
83
|
+
* [#754](https://github.com/stripe/stripe-ruby/pull/754) Add class methods for all custom API requests (e.g. `Charge.capture`)
|
84
|
+
|
85
|
+
## 4.11.0 - 2019-03-26
|
86
|
+
* [#753](https://github.com/stripe/stripe-ruby/pull/753) Add a global proxy configuration parameter
|
87
|
+
|
3
88
|
## 4.10.0 - 2019-03-18
|
4
89
|
* [#745](https://github.com/stripe/stripe-ruby/pull/745) Add support for the `PaymentMethod` resource and APIs
|
5
90
|
* [#747](https://github.com/stripe/stripe-ruby/pull/747) Add support for retrieving a Checkout `Session`
|
@@ -33,7 +118,7 @@
|
|
33
118
|
* [#718](https://github.com/stripe/stripe-ruby/pull/718) Fix an error message typo
|
34
119
|
|
35
120
|
## 4.4.0 - 2018-12-21
|
36
|
-
* [#716](https://github.com/stripe/stripe-ruby/pull/716) Add support for the `CheckoutSession` resource
|
121
|
+
* [#716](https://github.com/stripe/stripe-ruby/pull/716) Add support for the `CheckoutSession` resource
|
37
122
|
|
38
123
|
## 4.3.0 - 2018-12-10
|
39
124
|
* [#711](https://github.com/stripe/stripe-ruby/pull/711) Add support for account links
|
data/Gemfile
CHANGED
@@ -7,6 +7,7 @@ gemspec
|
|
7
7
|
group :development do
|
8
8
|
gem "coveralls", require: false
|
9
9
|
gem "mocha", "~> 0.13.2"
|
10
|
+
gem "rack", ">= 2.0.6"
|
10
11
|
gem "rake"
|
11
12
|
gem "shoulda-context"
|
12
13
|
gem "test-unit"
|
@@ -18,16 +19,7 @@ group :development do
|
|
18
19
|
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
|
19
20
|
# bad, pin to a specific version number here. Try to keep this relatively
|
20
21
|
# up-to-date, but it's not the end of the world if it's not.
|
21
|
-
gem "rubocop", "0.
|
22
|
-
|
23
|
-
# Rack 2.0+ requires Ruby >= 2.2.2 which is problematic for the test suite on
|
24
|
-
# older Ruby versions. Check Ruby the version here and put a maximum
|
25
|
-
# constraint on Rack if necessary.
|
26
|
-
if RUBY_VERSION >= "2.2.2"
|
27
|
-
gem "rack", ">= 2.0.6"
|
28
|
-
else
|
29
|
-
gem "rack", ">= 1.6.11", "< 2.0" # rubocop:disable Bundler/DuplicatedGem
|
30
|
-
end
|
22
|
+
gem "rubocop", "0.73"
|
31
23
|
|
32
24
|
platforms :mri do
|
33
25
|
gem "byebug"
|
data/README.md
CHANGED
@@ -11,11 +11,11 @@ API.
|
|
11
11
|
|
12
12
|
The library also provides other features. For example:
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
- Easy configuration path for fast setup and use.
|
15
|
+
- Helpers for pagination.
|
16
|
+
- Tracking of "fresh" values in API resources so that partial updates can be
|
17
17
|
executed.
|
18
|
-
|
18
|
+
- Built-in mechanisms for the serialization of parameters according to the
|
19
19
|
expectations of Stripe's API.
|
20
20
|
|
21
21
|
## Documentation
|
@@ -27,15 +27,19 @@ See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
|
|
27
27
|
You don't need this source code unless you want to modify the gem. If you just
|
28
28
|
want to use the package, just run:
|
29
29
|
|
30
|
-
|
30
|
+
```sh
|
31
|
+
gem install stripe
|
32
|
+
```
|
31
33
|
|
32
34
|
If you want to build the gem from source:
|
33
35
|
|
34
|
-
|
36
|
+
```sh
|
37
|
+
gem build stripe.gemspec
|
38
|
+
```
|
35
39
|
|
36
40
|
### Requirements
|
37
41
|
|
38
|
-
|
42
|
+
- Ruby 2.3+.
|
39
43
|
|
40
44
|
### Bundler
|
41
45
|
|
@@ -43,7 +47,7 @@ If you are installing via bundler, you should be sure to use the https rubygems
|
|
43
47
|
source in your Gemfile, as any gems fetched over http could potentially be
|
44
48
|
compromised in transit and alter the code of gems fetched securely over https:
|
45
49
|
|
46
|
-
```
|
50
|
+
```ruby
|
47
51
|
source 'https://rubygems.org'
|
48
52
|
|
49
53
|
gem 'rails'
|
@@ -56,7 +60,7 @@ The library needs to be configured with your account's secret key which is
|
|
56
60
|
available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
|
57
61
|
value:
|
58
62
|
|
59
|
-
```
|
63
|
+
```ruby
|
60
64
|
require "stripe"
|
61
65
|
Stripe.api_key = "sk_test_..."
|
62
66
|
|
@@ -75,37 +79,46 @@ For apps that need to use multiple keys during the lifetime of a process, like
|
|
75
79
|
one that uses [Stripe Connect][connect], it's also possible to set a
|
76
80
|
per-request key and/or account:
|
77
81
|
|
78
|
-
```
|
82
|
+
```ruby
|
79
83
|
require "stripe"
|
80
84
|
|
81
85
|
Stripe::Charge.list(
|
82
86
|
{},
|
83
87
|
{
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
88
|
+
api_key: "sk_test_...",
|
89
|
+
stripe_account: "acct_...",
|
90
|
+
stripe_version: "2018-02-28",
|
87
91
|
}
|
88
92
|
)
|
89
93
|
|
90
94
|
Stripe::Charge.retrieve(
|
91
95
|
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
92
96
|
{
|
93
|
-
:
|
94
|
-
:
|
95
|
-
:
|
97
|
+
api_key: "sk_test_...",
|
98
|
+
stripe_account: "acct_...",
|
99
|
+
stripe_version: "2018-02-28",
|
100
|
+
}
|
101
|
+
)
|
102
|
+
|
103
|
+
Stripe::Charge.retrieve(
|
104
|
+
{
|
105
|
+
id: "ch_18atAXCdGbJFKhCuBAa4532Z",
|
106
|
+
expand: %w(balance_transaction)
|
107
|
+
},
|
108
|
+
{
|
109
|
+
stripe_version: "2018-02-28",
|
110
|
+
api_key: "sk_test_...",
|
96
111
|
}
|
97
112
|
)
|
98
113
|
```
|
99
114
|
|
100
|
-
###
|
115
|
+
### Accessing a response object
|
101
116
|
|
102
|
-
|
103
|
-
|
104
|
-
`Stripe::StripeClient` object and giving it a connection:
|
117
|
+
Get access to response objects by initializing a client and using its `request`
|
118
|
+
method:
|
105
119
|
|
106
|
-
```
|
107
|
-
|
108
|
-
client = Stripe::StripeClient.new(conn)
|
120
|
+
```ruby
|
121
|
+
client = Stripe::StripeClient.new
|
109
122
|
charge, resp = client.request do
|
110
123
|
Stripe::Charge.retrieve(
|
111
124
|
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
@@ -114,12 +127,22 @@ end
|
|
114
127
|
puts resp.request_id
|
115
128
|
```
|
116
129
|
|
130
|
+
### Configuring a proxy
|
131
|
+
|
132
|
+
A proxy can be configured with `Stripe.proxy`:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
Stripe.proxy = "https://user:pass@example.com:1234"
|
136
|
+
```
|
137
|
+
|
117
138
|
### Configuring an API Version
|
118
139
|
|
119
140
|
By default, the library will use the API version pinned to the account making
|
120
141
|
a request. This can be overridden with this global option:
|
121
142
|
|
122
|
-
|
143
|
+
```ruby
|
144
|
+
Stripe.api_version = "2018-02-28"
|
145
|
+
```
|
123
146
|
|
124
147
|
See [versioning in the API reference][versioning] for more information.
|
125
148
|
|
@@ -128,14 +151,21 @@ See [versioning in the API reference][versioning] for more information.
|
|
128
151
|
By default, the library will use its own internal bundle of known CA
|
129
152
|
certificates, but it's possible to configure your own:
|
130
153
|
|
131
|
-
|
154
|
+
```ruby
|
155
|
+
Stripe.ca_bundle_path = "path/to/ca/bundle"
|
156
|
+
```
|
132
157
|
|
133
158
|
### Configuring Automatic Retries
|
134
159
|
|
135
|
-
|
136
|
-
|
160
|
+
You can enable automatic retries on requests that fail due to a transient
|
161
|
+
problem by configuring the maximum number of retries:
|
162
|
+
|
163
|
+
```ruby
|
164
|
+
Stripe.max_network_retries = 2
|
165
|
+
```
|
137
166
|
|
138
|
-
|
167
|
+
Various errors can trigger a retry, like a connection error or a timeout, and
|
168
|
+
also certain API responses like HTTP status `409 Conflict`.
|
139
169
|
|
140
170
|
[Idempotency keys][idempotency-keys] are added to requests to guarantee that
|
141
171
|
retries are safe.
|
@@ -144,7 +174,7 @@ retries are safe.
|
|
144
174
|
|
145
175
|
Open and read timeouts are configurable:
|
146
176
|
|
147
|
-
```
|
177
|
+
```ruby
|
148
178
|
Stripe.open_timeout = 30 // in seconds
|
149
179
|
Stripe.read_timeout = 80
|
150
180
|
```
|
@@ -162,12 +192,14 @@ production use, but `debug` is also available for more verbosity.
|
|
162
192
|
There are a few options for enabling it:
|
163
193
|
|
164
194
|
1. Set the environment variable `STRIPE_LOG` to the value `debug` or `info`:
|
165
|
-
|
195
|
+
|
196
|
+
```sh
|
166
197
|
$ export STRIPE_LOG=info
|
167
198
|
```
|
168
199
|
|
169
200
|
2. Set `Stripe.log_level`:
|
170
|
-
|
201
|
+
|
202
|
+
```ruby
|
171
203
|
Stripe.log_level = Stripe::LEVEL_INFO
|
172
204
|
```
|
173
205
|
|
@@ -176,39 +208,64 @@ There are a few options for enabling it:
|
|
176
208
|
If you're writing a plugin that uses the library, we'd appreciate it if you
|
177
209
|
identified using `#set_app_info`:
|
178
210
|
|
179
|
-
|
211
|
+
```ruby
|
212
|
+
Stripe.set_app_info("MyAwesomePlugin", version: "1.2.34", url: "https://myawesomeplugin.info");
|
213
|
+
```
|
180
214
|
|
181
215
|
This information is passed along when the library makes calls to the Stripe
|
182
216
|
API.
|
183
217
|
|
218
|
+
### Request latency telemetry
|
219
|
+
|
220
|
+
By default, the library sends request latency telemetry to Stripe. These
|
221
|
+
numbers help Stripe improve the overall latency of its API for all users.
|
222
|
+
|
223
|
+
You can disable this behavior if you prefer:
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
Stripe.enable_telemetry = false
|
227
|
+
```
|
228
|
+
|
184
229
|
## Development
|
185
230
|
|
186
231
|
The test suite depends on [stripe-mock], so make sure to fetch and run it from a
|
187
232
|
background terminal ([stripe-mock's README][stripe-mock] also contains
|
188
233
|
instructions for installing via Homebrew and other methods):
|
189
234
|
|
190
|
-
|
191
|
-
|
235
|
+
```sh
|
236
|
+
go get -u github.com/stripe/stripe-mock
|
237
|
+
stripe-mock
|
238
|
+
```
|
192
239
|
|
193
240
|
Run all tests:
|
194
241
|
|
195
|
-
|
242
|
+
```sh
|
243
|
+
bundle exec rake test
|
244
|
+
```
|
196
245
|
|
197
246
|
Run a single test suite:
|
198
247
|
|
199
|
-
|
248
|
+
```sh
|
249
|
+
bundle exec ruby -Ilib/ test/stripe/util_test.rb
|
250
|
+
```
|
200
251
|
|
201
252
|
Run a single test:
|
202
253
|
|
203
|
-
|
254
|
+
```sh
|
255
|
+
bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
|
256
|
+
```
|
204
257
|
|
205
258
|
Run the linter:
|
206
259
|
|
207
|
-
|
260
|
+
```sh
|
261
|
+
bundle exec rake rubocop
|
262
|
+
```
|
208
263
|
|
209
264
|
Update bundled CA certificates from the [Mozilla cURL release][curl]:
|
210
265
|
|
211
|
-
|
266
|
+
```sh
|
267
|
+
bundle exec rake update_certs
|
268
|
+
```
|
212
269
|
|
213
270
|
Update the bundled [stripe-mock] by editing the version number found in
|
214
271
|
`.travis.yml`.
|
@@ -216,7 +273,6 @@ Update the bundled [stripe-mock] by editing the version number found in
|
|
216
273
|
[api-keys]: https://dashboard.stripe.com/account/apikeys
|
217
274
|
[connect]: https://stripe.com/connect
|
218
275
|
[curl]: http://curl.haxx.se/docs/caextract.html
|
219
|
-
[faraday]: https://github.com/lostisland/faraday
|
220
276
|
[idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
|
221
277
|
[stripe-mock]: https://github.com/stripe/stripe-mock
|
222
278
|
[versioning]: https://stripe.com/docs/api/ruby#versioning
|
data/Rakefile
CHANGED
@@ -13,7 +13,8 @@ RuboCop::RakeTask.new
|
|
13
13
|
|
14
14
|
desc "Update bundled certs"
|
15
15
|
task :update_certs do
|
16
|
-
require "
|
16
|
+
require "net/http"
|
17
|
+
require "uri"
|
17
18
|
|
18
19
|
fetch_file "https://curl.haxx.se/ca/cacert.pem",
|
19
20
|
::File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
|
@@ -23,14 +24,14 @@ end
|
|
23
24
|
# helpers
|
24
25
|
#
|
25
26
|
|
26
|
-
def fetch_file(
|
27
|
+
def fetch_file(uri, dest)
|
27
28
|
::File.open(dest, "w") do |file|
|
28
|
-
resp =
|
29
|
-
unless resp.
|
30
|
-
abort("bad response when fetching: #{
|
31
|
-
"Status #{resp.
|
29
|
+
resp = Net::HTTP.get_response(URI.parse(uri))
|
30
|
+
unless resp.code.to_i == 200
|
31
|
+
abort("bad response when fetching: #{uri}\n" \
|
32
|
+
"Status #{resp.code}: #{resp.body}")
|
32
33
|
end
|
33
34
|
file.write(resp.body)
|
34
|
-
puts "Successfully fetched: #{
|
35
|
+
puts "Successfully fetched: #{uri}"
|
35
36
|
end
|
36
37
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5.0.0
|
@@ -3,11 +3,33 @@
|
|
3
3
|
module Stripe
|
4
4
|
module APIOperations
|
5
5
|
module Delete
|
6
|
+
module ClassMethods
|
7
|
+
# Deletes an API resource
|
8
|
+
#
|
9
|
+
# Deletes the identified resource with the passed in parameters.
|
10
|
+
#
|
11
|
+
# ==== Attributes
|
12
|
+
#
|
13
|
+
# * +id+ - ID of the resource to delete.
|
14
|
+
# * +params+ - A hash of parameters to pass to the API
|
15
|
+
# * +opts+ - A Hash of additional options (separate from the params /
|
16
|
+
# object values) to be added to the request. E.g. to allow for an
|
17
|
+
# idempotency_key to be passed in the request headers, or for the
|
18
|
+
# api_key to be overwritten. See {APIOperations::Request.request}.
|
19
|
+
def delete(id, params = {}, opts = {})
|
20
|
+
resp, opts = request(:delete, "#{resource_url}/#{id}", params, opts)
|
21
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
6
25
|
def delete(params = {}, opts = {})
|
7
|
-
opts = Util.normalize_opts(opts)
|
8
26
|
resp, opts = request(:delete, resource_url, params, opts)
|
9
27
|
initialize_from(resp.data, opts)
|
10
28
|
end
|
29
|
+
|
30
|
+
def self.included(base)
|
31
|
+
base.extend(ClassMethods)
|
32
|
+
end
|
11
33
|
end
|
12
34
|
end
|
13
35
|
end
|
@@ -19,12 +19,6 @@ module Stripe
|
|
19
19
|
|
20
20
|
obj
|
21
21
|
end
|
22
|
-
|
23
|
-
# The original version of #list was given the somewhat unfortunate name of
|
24
|
-
# #all, and this alias allows us to maintain backward compatibility (the
|
25
|
-
# choice was somewhat misleading in the way that it only returned a single
|
26
|
-
# page rather than all objects).
|
27
|
-
alias all list
|
28
22
|
end
|
29
23
|
end
|
30
24
|
end
|