stripe 5.1.0 → 5.55.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/CHANGELOG.md +241 -17
- data/CODE_OF_CONDUCT.md +77 -0
- data/Gemfile +9 -5
- data/Makefile +7 -0
- data/README.md +105 -37
- data/VERSION +1 -1
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +7 -3
- data/lib/stripe/api_operations/list.rb +1 -6
- data/lib/stripe/api_operations/nested_resource.rb +29 -26
- data/lib/stripe/api_operations/request.rb +82 -6
- data/lib/stripe/api_operations/save.rb +7 -4
- data/lib/stripe/api_operations/search.rb +19 -0
- data/lib/stripe/api_resource.rb +13 -19
- data/lib/stripe/api_resource_test_helpers.rb +47 -0
- data/lib/stripe/connection_manager.rb +85 -26
- data/lib/stripe/error_object.rb +2 -3
- data/lib/stripe/errors.rb +9 -1
- data/lib/stripe/instrumentation.rb +84 -0
- data/lib/stripe/list_object.rb +32 -4
- data/lib/stripe/oauth.rb +8 -6
- data/lib/stripe/object_types.rb +26 -1
- data/lib/stripe/resources/account.rb +5 -9
- data/lib/stripe/resources/account_link.rb +1 -0
- data/lib/stripe/resources/apple_pay_domain.rb +1 -0
- data/lib/stripe/resources/application_fee.rb +1 -0
- data/lib/stripe/resources/application_fee_refund.rb +2 -1
- data/lib/stripe/resources/balance.rb +1 -0
- data/lib/stripe/resources/balance_transaction.rb +1 -0
- data/lib/stripe/resources/bank_account.rb +2 -1
- data/lib/stripe/resources/billing_portal/configuration.rb +14 -0
- data/lib/stripe/resources/billing_portal/session.rb +12 -0
- data/lib/stripe/resources/bitcoin_receiver.rb +1 -0
- data/lib/stripe/resources/bitcoin_transaction.rb +3 -2
- data/lib/stripe/resources/capability.rb +2 -1
- data/lib/stripe/resources/card.rb +1 -0
- data/lib/stripe/resources/cash_balance.rb +22 -0
- data/lib/stripe/resources/charge.rb +10 -0
- data/lib/stripe/resources/checkout/session.rb +16 -0
- data/lib/stripe/resources/country_spec.rb +1 -0
- data/lib/stripe/resources/coupon.rb +1 -0
- data/lib/stripe/resources/credit_note.rb +11 -0
- data/lib/stripe/resources/credit_note_line_item.rb +8 -0
- data/lib/stripe/resources/customer.rb +41 -2
- data/lib/stripe/resources/customer_balance_transaction.rb +3 -2
- data/lib/stripe/resources/discount.rb +1 -0
- data/lib/stripe/resources/dispute.rb +1 -0
- data/lib/stripe/resources/ephemeral_key.rb +1 -0
- data/lib/stripe/resources/event.rb +1 -0
- data/lib/stripe/resources/exchange_rate.rb +1 -0
- data/lib/stripe/resources/file.rb +3 -1
- data/lib/stripe/resources/file_link.rb +1 -0
- data/lib/stripe/resources/financial_connections/account.rb +31 -0
- data/lib/stripe/resources/financial_connections/account_owner.rb +10 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +10 -0
- data/lib/stripe/resources/financial_connections/session.rb +12 -0
- data/lib/stripe/resources/funding_instructions.rb +16 -0
- data/lib/stripe/resources/identity/verification_report.rb +12 -0
- data/lib/stripe/resources/identity/verification_session.rb +35 -0
- data/lib/stripe/resources/invoice.rb +12 -2
- data/lib/stripe/resources/invoice_item.rb +1 -0
- data/lib/stripe/resources/invoice_line_item.rb +1 -0
- data/lib/stripe/resources/issuing/authorization.rb +1 -0
- data/lib/stripe/resources/issuing/card.rb +1 -0
- data/lib/stripe/resources/issuing/card_details.rb +2 -1
- data/lib/stripe/resources/issuing/cardholder.rb +1 -0
- data/lib/stripe/resources/issuing/dispute.rb +12 -0
- data/lib/stripe/resources/issuing/transaction.rb +1 -0
- data/lib/stripe/resources/line_item.rb +8 -0
- data/lib/stripe/resources/login_link.rb +1 -0
- data/lib/stripe/resources/mandate.rb +8 -0
- data/lib/stripe/resources/order.rb +1 -0
- data/lib/stripe/resources/order_return.rb +1 -0
- data/lib/stripe/resources/payment_intent.rb +40 -0
- data/lib/stripe/resources/payment_link.rb +23 -0
- data/lib/stripe/resources/payment_method.rb +1 -0
- data/lib/stripe/resources/payout.rb +11 -0
- data/lib/stripe/resources/person.rb +1 -0
- data/lib/stripe/resources/plan.rb +1 -0
- data/lib/stripe/resources/price.rb +21 -0
- data/lib/stripe/resources/product.rb +10 -0
- data/lib/stripe/resources/promotion_code.rb +12 -0
- data/lib/stripe/resources/quote.rb +105 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +1 -0
- data/lib/stripe/resources/radar/value_list.rb +1 -0
- data/lib/stripe/resources/radar/value_list_item.rb +1 -0
- data/lib/stripe/resources/recipient.rb +1 -0
- data/lib/stripe/resources/refund.rb +31 -0
- data/lib/stripe/resources/reporting/report_run.rb +1 -0
- data/lib/stripe/resources/reporting/report_type.rb +1 -0
- data/lib/stripe/resources/reversal.rb +3 -2
- data/lib/stripe/resources/review.rb +1 -0
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/resources/setup_intent.rb +11 -0
- data/lib/stripe/resources/shipping_rate.rb +12 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +1 -0
- data/lib/stripe/resources/sku.rb +1 -0
- data/lib/stripe/resources/source.rb +10 -3
- data/lib/stripe/resources/source_transaction.rb +1 -0
- data/lib/stripe/resources/subscription.rb +10 -0
- data/lib/stripe/resources/subscription_item.rb +7 -1
- data/lib/stripe/resources/subscription_schedule.rb +1 -0
- data/lib/stripe/resources/tax_code.rb +10 -0
- data/lib/stripe/resources/tax_id.rb +1 -0
- data/lib/stripe/resources/tax_rate.rb +1 -0
- data/lib/stripe/resources/terminal/configuration.rb +15 -0
- data/lib/stripe/resources/terminal/connection_token.rb +1 -0
- data/lib/stripe/resources/terminal/location.rb +1 -0
- data/lib/stripe/resources/terminal/reader.rb +61 -0
- data/lib/stripe/resources/test_helpers/test_clock.rb +25 -0
- data/lib/stripe/resources/three_d_secure.rb +1 -0
- data/lib/stripe/resources/token.rb +1 -0
- data/lib/stripe/resources/topup.rb +1 -0
- data/lib/stripe/resources/transfer.rb +1 -0
- data/lib/stripe/resources/usage_record.rb +1 -0
- data/lib/stripe/resources/usage_record_summary.rb +1 -0
- data/lib/stripe/resources/webhook_endpoint.rb +1 -0
- data/lib/stripe/resources.rb +23 -0
- data/lib/stripe/search_result_object.rb +86 -0
- data/lib/stripe/stripe_client.rb +412 -146
- data/lib/stripe/stripe_configuration.rb +194 -0
- data/lib/stripe/stripe_object.rb +26 -2
- data/lib/stripe/stripe_response.rb +80 -52
- data/lib/stripe/util.rb +74 -7
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +38 -7
- data/lib/stripe.rb +39 -168
- data/stripe.gemspec +12 -5
- metadata +36 -186
- data/.editorconfig +0 -10
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -56
- data/.rubocop_todo.yml +0 -39
- data/.travis.yml +0 -39
- data/.vscode/extensions.json +0 -7
- data/.vscode/settings.json +0 -8
- data/test/api_stub_helpers.rb +0 -1
- data/test/openapi/README.md +0 -9
- data/test/stripe/account_link_test.rb +0 -18
- data/test/stripe/account_test.rb +0 -412
- data/test/stripe/alipay_account_test.rb +0 -37
- data/test/stripe/api_operations_test.rb +0 -80
- data/test/stripe/api_resource_test.rb +0 -613
- data/test/stripe/apple_pay_domain_test.rb +0 -46
- data/test/stripe/application_fee_refund_test.rb +0 -37
- data/test/stripe/application_fee_test.rb +0 -58
- data/test/stripe/balance_test.rb +0 -13
- data/test/stripe/balance_transaction_test.rb +0 -20
- data/test/stripe/bank_account_test.rb +0 -36
- data/test/stripe/capability_test.rb +0 -45
- data/test/stripe/charge_test.rb +0 -64
- data/test/stripe/checkout/session_test.rb +0 -41
- data/test/stripe/connection_manager_test.rb +0 -138
- data/test/stripe/country_spec_test.rb +0 -20
- data/test/stripe/coupon_test.rb +0 -61
- data/test/stripe/credit_note_test.rb +0 -61
- data/test/stripe/customer_balance_transaction_test.rb +0 -37
- data/test/stripe/customer_card_test.rb +0 -42
- data/test/stripe/customer_test.rb +0 -226
- data/test/stripe/dispute_test.rb +0 -51
- data/test/stripe/ephemeral_key_test.rb +0 -93
- data/test/stripe/errors_test.rb +0 -41
- data/test/stripe/exchange_rate_test.rb +0 -20
- data/test/stripe/file_link_test.rb +0 -41
- data/test/stripe/file_test.rb +0 -87
- data/test/stripe/invoice_item_test.rb +0 -66
- data/test/stripe/invoice_line_item_test.rb +0 -8
- data/test/stripe/invoice_test.rb +0 -229
- data/test/stripe/issuing/authorization_test.rb +0 -72
- data/test/stripe/issuing/card_test.rb +0 -62
- data/test/stripe/issuing/cardholder_test.rb +0 -53
- data/test/stripe/issuing/dispute_test.rb +0 -45
- data/test/stripe/issuing/transaction_test.rb +0 -48
- data/test/stripe/list_object_test.rb +0 -140
- data/test/stripe/login_link_test.rb +0 -37
- data/test/stripe/multipart_encoder_test.rb +0 -130
- data/test/stripe/oauth_test.rb +0 -88
- data/test/stripe/order_return_test.rb +0 -21
- data/test/stripe/order_test.rb +0 -82
- data/test/stripe/payment_intent_test.rb +0 -107
- data/test/stripe/payment_method_test.rb +0 -84
- data/test/stripe/payout_test.rb +0 -57
- data/test/stripe/person_test.rb +0 -46
- data/test/stripe/plan_test.rb +0 -98
- data/test/stripe/product_test.rb +0 -59
- data/test/stripe/radar/early_fraud_warning_test.rb +0 -22
- data/test/stripe/radar/value_list_item_test.rb +0 -48
- data/test/stripe/radar/value_list_test.rb +0 -61
- data/test/stripe/recipient_test.rb +0 -62
- data/test/stripe/refund_test.rb +0 -39
- data/test/stripe/reporting/report_run_test.rb +0 -33
- data/test/stripe/reporting/report_type_test.rb +0 -22
- data/test/stripe/reversal_test.rb +0 -43
- data/test/stripe/review_test.rb +0 -27
- data/test/stripe/setup_intent_test.rb +0 -84
- data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
- data/test/stripe/sku_test.rb +0 -60
- data/test/stripe/source_test.rb +0 -81
- data/test/stripe/source_transaction_test.rb +0 -19
- data/test/stripe/stripe_client_test.rb +0 -1039
- data/test/stripe/stripe_object_test.rb +0 -497
- data/test/stripe/stripe_response_test.rb +0 -95
- data/test/stripe/subscription_item_test.rb +0 -75
- data/test/stripe/subscription_schedule_test.rb +0 -82
- data/test/stripe/subscription_test.rb +0 -80
- data/test/stripe/tax_id_test.rb +0 -31
- data/test/stripe/tax_rate_test.rb +0 -43
- data/test/stripe/terminal/connection_token_test.rb +0 -16
- data/test/stripe/terminal/location_test.rb +0 -68
- data/test/stripe/terminal/reader_test.rb +0 -62
- data/test/stripe/three_d_secure_test.rb +0 -23
- data/test/stripe/topup_test.rb +0 -62
- data/test/stripe/transfer_test.rb +0 -88
- data/test/stripe/usage_record_summary_test.rb +0 -19
- data/test/stripe/util_test.rb +0 -402
- data/test/stripe/webhook_endpoint_test.rb +0 -59
- data/test/stripe/webhook_test.rb +0 -96
- data/test/stripe_mock.rb +0 -78
- data/test/stripe_test.rb +0 -50
- data/test/test_data.rb +0 -61
- data/test/test_helper.rb +0 -76
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e81cc3af76a8942f879c1b312bbcc6ad27257cb9b68f9a63df76bd430ff9cf8
|
|
4
|
+
data.tar.gz: c83f7ae353941a10279ba76237f64e700f0e6bce06fe9475250b85308f72d57f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b4aff3650ae5933a0fae274bf1fe1e142f8361fbd0b3734502ce317a82492bda2124e155ff335b311abbda1d9751fdbc15e4a1754c94fe8b6d8a24e206b599e
|
|
7
|
+
data.tar.gz: f23307331d6ded3934361f9fff180a0ecda5df30bb3f5708e359d3b0712ed5262873b2220400d124544b113249a7ff5f1ae885cef381b9a8b3aa6388295527a7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,229 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.55.0 - 2022-05-05
|
|
4
|
+
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
|
|
5
|
+
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 5.54.0 - 2022-05-03
|
|
9
|
+
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
|
|
10
|
+
* Add support for new resource `CashBalance`
|
|
11
|
+
|
|
12
|
+
## 5.53.0 - 2022-04-21
|
|
13
|
+
* [#1050](https://github.com/stripe/stripe-ruby/pull/1050) API Updates
|
|
14
|
+
* Add support for `expire` test helper method on resource `Refund`
|
|
15
|
+
|
|
16
|
+
## 5.52.0 - 2022-04-18
|
|
17
|
+
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
|
|
18
|
+
* Add support for new resources `FundingInstructions` and `Terminal.Configuration`
|
|
19
|
+
|
|
20
|
+
## 5.51.0 - 2022-04-15
|
|
21
|
+
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) This release was incomplete and was yanked from RubyGems immediately after it was published.
|
|
22
|
+
|
|
23
|
+
## 5.50.0 - 2022-04-13
|
|
24
|
+
* [#1045](https://github.com/stripe/stripe-ruby/pull/1045) API Updates
|
|
25
|
+
* Add support for `increment_authorization` method on resource `PaymentIntent`
|
|
26
|
+
|
|
27
|
+
## 5.49.0 - 2022-04-08
|
|
28
|
+
* [#1043](https://github.com/stripe/stripe-ruby/pull/1043) API Updates
|
|
29
|
+
* Add support for `apply_customer_balance` method on resource `PaymentIntent`
|
|
30
|
+
|
|
31
|
+
## 5.48.0 - 2022-03-30
|
|
32
|
+
* [#1041](https://github.com/stripe/stripe-ruby/pull/1041) API Updates
|
|
33
|
+
* Add support for `cancel_action`, `process_payment_intent`, `process_setup_intent`, and `set_reader_display` methods on resource `Terminal.Reader`
|
|
34
|
+
|
|
35
|
+
## 5.47.0 - 2022-03-29
|
|
36
|
+
* [#1040](https://github.com/stripe/stripe-ruby/pull/1040) API Updates
|
|
37
|
+
* Add support for Search API
|
|
38
|
+
* Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
|
|
39
|
+
|
|
40
|
+
* [#1034](https://github.com/stripe/stripe-ruby/pull/1034) Add supporting classes for test helper generation
|
|
41
|
+
|
|
42
|
+
## 5.46.0 - 2022-03-23
|
|
43
|
+
* [#1039](https://github.com/stripe/stripe-ruby/pull/1039) API Updates
|
|
44
|
+
* Add support for `cancel` method on resource `Refund`
|
|
45
|
+
* [#992](https://github.com/stripe/stripe-ruby/pull/992) Add support for Search API
|
|
46
|
+
|
|
47
|
+
## 5.45.0 - 2022-03-01
|
|
48
|
+
* [#1035](https://github.com/stripe/stripe-ruby/pull/1035) API Updates
|
|
49
|
+
* Add support for new resource `TestHelpers.TestClock`
|
|
50
|
+
|
|
51
|
+
## 5.44.0 - 2022-02-16
|
|
52
|
+
* [#1032](https://github.com/stripe/stripe-ruby/pull/1032) API Updates
|
|
53
|
+
* Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent`
|
|
54
|
+
|
|
55
|
+
## 5.43.0 - 2022-01-20
|
|
56
|
+
* [#1031](https://github.com/stripe/stripe-ruby/pull/1031) API Updates
|
|
57
|
+
* Add support for new resource `PaymentLink`
|
|
58
|
+
|
|
59
|
+
## 5.42.0 - 2021-12-13
|
|
60
|
+
* [#1022](https://github.com/stripe/stripe-ruby/pull/1022) Add connection manager logging and include object IDs in logging.
|
|
61
|
+
|
|
62
|
+
## 5.41.0 - 2021-11-16
|
|
63
|
+
* [#1017](https://github.com/stripe/stripe-ruby/pull/1017) API Updates
|
|
64
|
+
* Add support for new resource `ShippingRate`
|
|
65
|
+
|
|
66
|
+
## 5.40.0 - 2021-11-11
|
|
67
|
+
* [#1015](https://github.com/stripe/stripe-ruby/pull/1015) API Updates
|
|
68
|
+
* Add support for `expire` method on resource `Checkout.Session`
|
|
69
|
+
* [#1013](https://github.com/stripe/stripe-ruby/pull/1013) Add tests for child resources.
|
|
70
|
+
* [#1012](https://github.com/stripe/stripe-ruby/pull/1012) Add tests for namespaced resources.
|
|
71
|
+
* [#1011](https://github.com/stripe/stripe-ruby/pull/1011) codegen: 3 more files
|
|
72
|
+
|
|
73
|
+
## 5.39.0 - 2021-10-11
|
|
74
|
+
* [#1010](https://github.com/stripe/stripe-ruby/pull/1010) API Updates
|
|
75
|
+
* Add support for `list_payment_methods` method on resource `Customer`
|
|
76
|
+
|
|
77
|
+
## 5.38.0 - 2021-08-10
|
|
78
|
+
* [#993](https://github.com/stripe/stripe-ruby/pull/993) Add `request_id` to RequestEndEvent
|
|
79
|
+
* [#991](https://github.com/stripe/stripe-ruby/pull/991) Codegen more files
|
|
80
|
+
* [#989](https://github.com/stripe/stripe-ruby/pull/989) Remove unused API error types from docs.
|
|
81
|
+
|
|
82
|
+
## 5.37.0 - 2021-07-14
|
|
83
|
+
* [#988](https://github.com/stripe/stripe-ruby/pull/988) API Updates
|
|
84
|
+
* Add support for `list_computed_upfront_line_items` method on resource `Quote`
|
|
85
|
+
|
|
86
|
+
## 5.36.0 - 2021-07-09
|
|
87
|
+
* [#987](https://github.com/stripe/stripe-ruby/pull/987) Add support for `Quote` API
|
|
88
|
+
|
|
89
|
+
## 5.35.0 - 2021-06-30
|
|
90
|
+
* [#985](https://github.com/stripe/stripe-ruby/pull/985) Update normalize_opts to use dup instead of clone.
|
|
91
|
+
* [#982](https://github.com/stripe/stripe-ruby/pull/982) Deprecate travis
|
|
92
|
+
* [#983](https://github.com/stripe/stripe-ruby/pull/983) Add support for making a request and receiving the response as a stream.
|
|
93
|
+
|
|
94
|
+
## 5.34.0 - 2021-06-04
|
|
95
|
+
* [#981](https://github.com/stripe/stripe-ruby/pull/981) API Updates
|
|
96
|
+
* Add support for `TaxCode` API.
|
|
97
|
+
|
|
98
|
+
## 5.33.0 - 2021-05-19
|
|
99
|
+
* [#979](https://github.com/stripe/stripe-ruby/pull/979) Add support for the Identify VerificationSession and VerificationReport APIs
|
|
100
|
+
|
|
101
|
+
## 5.32.1 - 2021-04-05
|
|
102
|
+
* Correct use of regexp `match` in gemspec for old versions of Ruby
|
|
103
|
+
|
|
104
|
+
## 5.32.0 - 2021-04-05
|
|
105
|
+
* [#973](https://github.com/stripe/stripe-ruby/pull/973) Reduce packed gem size
|
|
106
|
+
|
|
107
|
+
## 5.31.0 - 2021-04-02
|
|
108
|
+
* [#968](https://github.com/stripe/stripe-ruby/pull/968) Allow StripeClient to be configured per instance
|
|
109
|
+
* [#971](https://github.com/stripe/stripe-ruby/pull/971) On config change, only clear connection managers for changed config
|
|
110
|
+
* [#972](https://github.com/stripe/stripe-ruby/pull/972) Rename `Stripe.configuration` to `Stripe.config`
|
|
111
|
+
* [#970](https://github.com/stripe/stripe-ruby/pull/970) Reserve some critical field names when adding `StripeObject` accessors
|
|
112
|
+
* [#967](https://github.com/stripe/stripe-ruby/pull/967) CI: github actions
|
|
113
|
+
|
|
114
|
+
## 5.30.0 - 2021-02-22
|
|
115
|
+
* [#965](https://github.com/stripe/stripe-ruby/pull/965) Add support for the Billing Portal Configuration API
|
|
116
|
+
|
|
117
|
+
## 5.29.1 - 2021-02-09
|
|
118
|
+
* [#964](https://github.com/stripe/stripe-ruby/pull/964) Fix return value of `Customer#delete_discount`
|
|
119
|
+
|
|
120
|
+
## 5.29.0 - 2021-01-05
|
|
121
|
+
* [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
|
|
122
|
+
|
|
123
|
+
## 5.28.0 - 2020-10-14
|
|
124
|
+
* [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
|
|
125
|
+
|
|
126
|
+
## 5.27.0 - 2020-10-14
|
|
127
|
+
* [#951](https://github.com/stripe/stripe-ruby/pull/951) Add support for the Payout Reverse API
|
|
128
|
+
|
|
129
|
+
## 5.26.0 - 2020-09-29
|
|
130
|
+
* [#949](https://github.com/stripe/stripe-ruby/pull/949) Add support for the `SetupAttempt` resource and List API
|
|
131
|
+
|
|
132
|
+
## 5.25.0 - 2020-09-02
|
|
133
|
+
* [#944](https://github.com/stripe/stripe-ruby/pull/944) Add support for the Issuing Dispute Submit API
|
|
134
|
+
|
|
135
|
+
## 5.24.0 - 2020-08-26
|
|
136
|
+
* [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
|
|
137
|
+
* [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
|
|
138
|
+
|
|
139
|
+
## 5.23.1 - 2020-08-05
|
|
140
|
+
* [#936](https://github.com/stripe/stripe-ruby/pull/936) Rename API resource's `request` method
|
|
141
|
+
|
|
142
|
+
## 5.23.0 - 2020-08-05
|
|
143
|
+
* [#937](https://github.com/stripe/stripe-ruby/pull/937) Add support for the `PromotionCode` resource and APIs
|
|
144
|
+
|
|
145
|
+
## 5.22.0 - 2020-05-11
|
|
146
|
+
* [#918](https://github.com/stripe/stripe-ruby/pull/918) Add support for the `LineItem` resource and APIs
|
|
147
|
+
|
|
148
|
+
## 5.21.0 - 2020-04-29
|
|
149
|
+
* [#917](https://github.com/stripe/stripe-ruby/pull/917) Add support for the `Price` resource and APIs
|
|
150
|
+
|
|
151
|
+
## 5.20.0 - 2020-04-27
|
|
152
|
+
* [#916](https://github.com/stripe/stripe-ruby/pull/916) Add new `.generate_header` method for webhooks
|
|
153
|
+
|
|
154
|
+
## 5.19.0 - 2020-04-24
|
|
155
|
+
* [#915](https://github.com/stripe/stripe-ruby/pull/915) Expose `Stripe::Webhook.compute_signature` publicly
|
|
156
|
+
|
|
157
|
+
## 5.18.0 - 2020-04-22
|
|
158
|
+
* [#911](https://github.com/stripe/stripe-ruby/pull/911) Add support for `BillingPortal` namespace and `Session` resource and APIs
|
|
159
|
+
|
|
160
|
+
## 5.17.0 - 2020-02-26
|
|
161
|
+
* [#907](https://github.com/stripe/stripe-ruby/pull/907) Add `StripeError#idempotent_replayed?`
|
|
162
|
+
|
|
163
|
+
## 5.16.0 - 2020-02-26
|
|
164
|
+
* [#906](https://github.com/stripe/stripe-ruby/pull/906) Add support for listing Checkout sessions
|
|
165
|
+
* [#903](https://github.com/stripe/stripe-ruby/pull/903) Upgrade to Rubocop 0.80
|
|
166
|
+
|
|
167
|
+
## 5.15.0 - 2020-02-10
|
|
168
|
+
* [#902](https://github.com/stripe/stripe-ruby/pull/902) Add `request_begin` instrumentation callback
|
|
169
|
+
|
|
170
|
+
## 5.14.0 - 2020-01-14
|
|
171
|
+
* [#896](https://github.com/stripe/stripe-ruby/pull/896) Add support for `CreditNoteLineItem`
|
|
172
|
+
* [#894](https://github.com/stripe/stripe-ruby/pull/894) Clean up test output by capturing `$stderr` when we expect warnings
|
|
173
|
+
* [#892](https://github.com/stripe/stripe-ruby/pull/892) Explicitly pass a parameter as hash to be more ruby 2.7 friendly
|
|
174
|
+
* [#893](https://github.com/stripe/stripe-ruby/pull/893) Upgrade Rubocop to 0.79
|
|
175
|
+
|
|
176
|
+
## 5.13.0 - 2020-01-08
|
|
177
|
+
* [#891](https://github.com/stripe/stripe-ruby/pull/891) Fix most Ruby 2.7 warnings
|
|
178
|
+
|
|
179
|
+
## 5.12.1 - 2020-01-06
|
|
180
|
+
* [#890](https://github.com/stripe/stripe-ruby/pull/890) Override API key with `client_secret` in `OAuth.token`
|
|
181
|
+
|
|
182
|
+
## 5.12.0 - 2020-01-02
|
|
183
|
+
* [#889](https://github.com/stripe/stripe-ruby/pull/889) Add support for retrieve source transaction API method
|
|
184
|
+
|
|
185
|
+
## 5.11.0 - 2019-11-26
|
|
186
|
+
* [#885](https://github.com/stripe/stripe-ruby/pull/885) Add support for `CreditNote` preview
|
|
187
|
+
|
|
188
|
+
## 5.10.0 - 2019-11-08
|
|
189
|
+
* [#882](https://github.com/stripe/stripe-ruby/pull/882) Add list_usage_record_summaries and list_source_transactions
|
|
190
|
+
|
|
191
|
+
## 5.9.0 - 2019-11-07
|
|
192
|
+
* [#870](https://github.com/stripe/stripe-ruby/pull/870) Add request instrumentation callback (see `README.md` for usage example)
|
|
193
|
+
|
|
194
|
+
## 5.8.0 - 2019-11-05
|
|
195
|
+
* [#879](https://github.com/stripe/stripe-ruby/pull/879) Add support for `Mandate`
|
|
196
|
+
* [#876](https://github.com/stripe/stripe-ruby/pull/876) Add additional per-request configuration documentation
|
|
197
|
+
* [#874](https://github.com/stripe/stripe-ruby/pull/874) Raise an error when requests params are invalid
|
|
198
|
+
* [#873](https://github.com/stripe/stripe-ruby/pull/873) Contributor Covenant
|
|
199
|
+
|
|
200
|
+
## 5.7.1 - 2019-10-15
|
|
201
|
+
* [#869](https://github.com/stripe/stripe-ruby/pull/869) Fixes the misnamed `connection_base=` setter to be named `connect_base=`
|
|
202
|
+
|
|
203
|
+
## 5.7.0 - 2019-10-10
|
|
204
|
+
* [#865](https://github.com/stripe/stripe-ruby/pull/865) Support backwards pagination with list's `#auto_paging_each`
|
|
205
|
+
|
|
206
|
+
## 5.6.0 - 2019-10-04
|
|
207
|
+
* [#861](https://github.com/stripe/stripe-ruby/pull/861) Nicer error when specifying non-nil non-string opt value
|
|
208
|
+
|
|
209
|
+
## 5.5.0 - 2019-10-03
|
|
210
|
+
* [#859](https://github.com/stripe/stripe-ruby/pull/859) User-friendly messages and retries for `EOFError`, `Errno::ECONNRESET`, `Errno::ETIMEDOUT`, and `Errno::EHOSTUNREACH` network errors
|
|
211
|
+
|
|
212
|
+
## 5.4.1 - 2019-10-01
|
|
213
|
+
* [#858](https://github.com/stripe/stripe-ruby/pull/858) Drop Timecop dependency
|
|
214
|
+
|
|
215
|
+
## 5.4.0 - 2019-10-01
|
|
216
|
+
* [#857](https://github.com/stripe/stripe-ruby/pull/857) Move to monotonic time for duration calculations
|
|
217
|
+
|
|
218
|
+
## 5.3.0 - 2019-10-01
|
|
219
|
+
* [#853](https://github.com/stripe/stripe-ruby/pull/853) Support `Stripe-Should-Retry` header
|
|
220
|
+
|
|
221
|
+
## 5.2.0 - 2019-09-19
|
|
222
|
+
* [#851](https://github.com/stripe/stripe-ruby/pull/851) Introduce system for garbage collecting connection managers
|
|
223
|
+
|
|
224
|
+
## 5.1.1 - 2019-09-04
|
|
225
|
+
* [#845](https://github.com/stripe/stripe-ruby/pull/845) Transfer the request_id from the http_headers to error.
|
|
226
|
+
|
|
3
227
|
## 5.1.0 - 2019-08-27
|
|
4
228
|
* [#841](https://github.com/stripe/stripe-ruby/pull/841) Retry requests on a 429 that's a lock timeout
|
|
5
229
|
|
|
@@ -10,23 +234,23 @@
|
|
|
10
234
|
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.
|
|
11
235
|
|
|
12
236
|
Pull requests included in this release (cf. [#815](https://github.com/stripe/stripe-ruby/pull/815)) (⚠️ = breaking changes):
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* [
|
|
17
|
-
* [
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* [
|
|
23
|
-
* [
|
|
24
|
-
* [
|
|
25
|
-
* [
|
|
26
|
-
* [
|
|
27
|
-
* [
|
|
28
|
-
* [
|
|
29
|
-
* [
|
|
237
|
+
* ⚠️ [#813](https://github.com/stripe/stripe-ruby/pull/813): Convert library to use built-in `Net::HTTP`
|
|
238
|
+
* ⚠️ [#816](https://github.com/stripe/stripe-ruby/pull/816): Make `code` argument in `CardError` named instead of positional.
|
|
239
|
+
* ⚠️ [#817](https://github.com/stripe/stripe-ruby/pull/817): Drop support for very old Ruby versions.
|
|
240
|
+
* [#818](https://github.com/stripe/stripe-ruby/pull/818): Bump Rubocop to latest version
|
|
241
|
+
* [#819](https://github.com/stripe/stripe-ruby/pull/819): Ruby minimum version increase followup
|
|
242
|
+
* ⚠️ [#820](https://github.com/stripe/stripe-ruby/pull/820): Remove old deprecated methods
|
|
243
|
+
* ⚠️ [#823](https://github.com/stripe/stripe-ruby/pull/823): Remove all alias for list methods
|
|
244
|
+
* ⚠️ [#826](https://github.com/stripe/stripe-ruby/pull/826): Remove `UsageRecord.create` method
|
|
245
|
+
* ⚠️ [#827](https://github.com/stripe/stripe-ruby/pull/827): Remove `IssuerFraudRecord`
|
|
246
|
+
* [#811](https://github.com/stripe/stripe-ruby/pull/811): Add `ErrorObject` to `StripeError` exceptions
|
|
247
|
+
* [#828](https://github.com/stripe/stripe-ruby/pull/828): Tweak retry logic to be a little more like stripe-node
|
|
248
|
+
* [#829](https://github.com/stripe/stripe-ruby/pull/829): Reset connections when connection-changing configuration changes (optional)
|
|
249
|
+
* [#830](https://github.com/stripe/stripe-ruby/pull/830): Fix inverted sign for 500 retries
|
|
250
|
+
* ⚠️[#831](https://github.com/stripe/stripe-ruby/pull/831): Remove a few more very old deprecated methods
|
|
251
|
+
* [#832](https://github.com/stripe/stripe-ruby/pull/832): Minor cleanup in `StripeClient`
|
|
252
|
+
* [#833](https://github.com/stripe/stripe-ruby/pull/833): Do better bookkeeping when tracking state in `Thread.current`
|
|
253
|
+
* [#834](https://github.com/stripe/stripe-ruby/pull/834): Add `Invoice.list_upcoming_line_items` method
|
|
30
254
|
|
|
31
255
|
## 4.24.0 - 2019-08-12
|
|
32
256
|
* [#825](https://github.com/stripe/stripe-ruby/pull/825) Add `SubscriptionItem.create_usage_record` method
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to make participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies within all project spaces, and it also applies when
|
|
49
|
+
an individual is representing the project or its community in public spaces.
|
|
50
|
+
Examples of representing a project or community include using an official
|
|
51
|
+
project e-mail address, posting via an official social media account, or acting
|
|
52
|
+
as an appointed representative at an online or offline event. Representation of
|
|
53
|
+
a project may be further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at conduct@stripe.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
|
77
|
+
|
data/Gemfile
CHANGED
|
@@ -5,21 +5,25 @@ source "https://rubygems.org"
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
7
|
group :development do
|
|
8
|
-
gem "coveralls", require: false
|
|
9
8
|
gem "mocha", "~> 0.13.2"
|
|
10
9
|
gem "rack", ">= 2.0.6"
|
|
11
10
|
gem "rake"
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
# Update to 2.0.0 once it ships.
|
|
13
|
+
gem "shoulda-context", "2.0.0.rc4"
|
|
14
|
+
|
|
13
15
|
gem "test-unit"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
# Version doesn't matter that much, but this one contains some fixes for Ruby
|
|
18
|
+
# 2.7 warnings that add noise to the test suite.
|
|
19
|
+
gem "webmock", ">= 3.8.0"
|
|
16
20
|
|
|
17
21
|
# Rubocop changes pretty quickly: new cops get added and old cops change
|
|
18
22
|
# names or go into new namespaces. This is a library and we don't have
|
|
19
23
|
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
|
|
20
24
|
# bad, pin to a specific version number here. Try to keep this relatively
|
|
21
25
|
# up-to-date, but it's not the end of the world if it's not.
|
|
22
|
-
gem "rubocop", "0.
|
|
26
|
+
gem "rubocop", "0.80"
|
|
23
27
|
|
|
24
28
|
platforms :mri do
|
|
25
29
|
gem "byebug"
|
data/Makefile
ADDED
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Stripe Ruby Library
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/stripe)
|
|
3
4
|
[](https://travis-ci.org/stripe/stripe-ruby)
|
|
4
|
-
[](https://coveralls.io/github/stripe/stripe-ruby?branch=master)
|
|
5
5
|
|
|
6
6
|
The Stripe Ruby library provides convenient access to the Stripe API from
|
|
7
7
|
applications written in the Ruby language. It includes a pre-defined set of
|
|
@@ -13,14 +13,15 @@ The library also provides other features. For example:
|
|
|
13
13
|
|
|
14
14
|
- Easy configuration path for fast setup and use.
|
|
15
15
|
- Helpers for pagination.
|
|
16
|
-
- Tracking of "fresh" values in API resources so that partial updates can be
|
|
17
|
-
executed.
|
|
18
16
|
- Built-in mechanisms for the serialization of parameters according to the
|
|
19
17
|
expectations of Stripe's API.
|
|
20
18
|
|
|
21
19
|
## Documentation
|
|
22
20
|
|
|
23
|
-
See the [Ruby API docs](https://stripe.com/docs/api
|
|
21
|
+
See the [Ruby API docs](https://stripe.com/docs/api?lang=ruby).
|
|
22
|
+
|
|
23
|
+
See [video demonstrations][youtube-playlist] covering how to use the library.
|
|
24
|
+
|
|
24
25
|
|
|
25
26
|
## Installation
|
|
26
27
|
|
|
@@ -61,16 +62,14 @@ available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
|
|
|
61
62
|
value:
|
|
62
63
|
|
|
63
64
|
```ruby
|
|
64
|
-
require
|
|
65
|
-
Stripe.api_key =
|
|
65
|
+
require 'stripe'
|
|
66
|
+
Stripe.api_key = 'sk_test_...'
|
|
66
67
|
|
|
67
|
-
# list
|
|
68
|
-
Stripe::
|
|
68
|
+
# list customers
|
|
69
|
+
Stripe::Customer.list()
|
|
69
70
|
|
|
70
|
-
# retrieve single
|
|
71
|
-
Stripe::
|
|
72
|
-
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
|
73
|
-
)
|
|
71
|
+
# retrieve single customer
|
|
72
|
+
Stripe::Customer.retrieve('cus_123456789')
|
|
74
73
|
```
|
|
75
74
|
|
|
76
75
|
### Per-request Configuration
|
|
@@ -82,36 +81,55 @@ per-request key and/or account:
|
|
|
82
81
|
```ruby
|
|
83
82
|
require "stripe"
|
|
84
83
|
|
|
85
|
-
Stripe::
|
|
84
|
+
Stripe::Customer.list(
|
|
86
85
|
{},
|
|
87
86
|
{
|
|
88
|
-
api_key:
|
|
89
|
-
stripe_account:
|
|
90
|
-
stripe_version:
|
|
87
|
+
api_key: 'sk_test_...',
|
|
88
|
+
stripe_account: 'acct_...',
|
|
89
|
+
stripe_version: '2018-02-28',
|
|
91
90
|
}
|
|
92
91
|
)
|
|
93
92
|
|
|
94
|
-
Stripe::
|
|
95
|
-
|
|
93
|
+
Stripe::Customer.retrieve(
|
|
94
|
+
'cus_123456789',
|
|
96
95
|
{
|
|
97
|
-
api_key:
|
|
98
|
-
stripe_account:
|
|
99
|
-
stripe_version:
|
|
96
|
+
api_key: 'sk_test_...',
|
|
97
|
+
stripe_account: 'acct_...',
|
|
98
|
+
stripe_version: '2018-02-28',
|
|
100
99
|
}
|
|
101
100
|
)
|
|
102
101
|
|
|
103
|
-
Stripe::
|
|
102
|
+
Stripe::Customer.retrieve(
|
|
104
103
|
{
|
|
105
|
-
id:
|
|
104
|
+
id: 'cus_123456789',
|
|
106
105
|
expand: %w(balance_transaction)
|
|
107
106
|
},
|
|
108
107
|
{
|
|
109
|
-
stripe_version:
|
|
110
|
-
api_key:
|
|
108
|
+
stripe_version: '2018-02-28',
|
|
109
|
+
api_key: 'sk_test_...',
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
Stripe::Customer.capture(
|
|
114
|
+
'cus_123456789',
|
|
115
|
+
{},
|
|
116
|
+
{
|
|
117
|
+
stripe_version: '2018-02-28',
|
|
118
|
+
api_key: 'sk_test_...',
|
|
111
119
|
}
|
|
112
120
|
)
|
|
113
121
|
```
|
|
114
122
|
|
|
123
|
+
Keep in mind that there are different method signatures depending on the action:
|
|
124
|
+
|
|
125
|
+
- When operating on a collection (e.g. `.list`, `.create`) the method signature is
|
|
126
|
+
`method(params, opts)`.
|
|
127
|
+
- When operating on resource (e.g. `.capture`, `.update`) the method signature is
|
|
128
|
+
`method(id, params, opts)`.
|
|
129
|
+
- One exception is that `retrieve`, despite being an operation on a resource, has the signature
|
|
130
|
+
`retrieve(id, opts)`. In addition, it will accept a Hash for the `id` param but will extract the
|
|
131
|
+
`id` key out and use the others as options.
|
|
132
|
+
|
|
115
133
|
### Accessing a response object
|
|
116
134
|
|
|
117
135
|
Get access to response objects by initializing a client and using its `request`
|
|
@@ -119,10 +137,8 @@ method:
|
|
|
119
137
|
|
|
120
138
|
```ruby
|
|
121
139
|
client = Stripe::StripeClient.new
|
|
122
|
-
|
|
123
|
-
Stripe::
|
|
124
|
-
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
|
125
|
-
)
|
|
140
|
+
customer, resp = client.request do
|
|
141
|
+
Stripe::Customer.retrieve('cus_123456789',)
|
|
126
142
|
end
|
|
127
143
|
puts resp.request_id
|
|
128
144
|
```
|
|
@@ -132,7 +148,7 @@ puts resp.request_id
|
|
|
132
148
|
A proxy can be configured with `Stripe.proxy`:
|
|
133
149
|
|
|
134
150
|
```ruby
|
|
135
|
-
Stripe.proxy =
|
|
151
|
+
Stripe.proxy = 'https://user:pass@example.com:1234'
|
|
136
152
|
```
|
|
137
153
|
|
|
138
154
|
### Configuring an API Version
|
|
@@ -141,7 +157,7 @@ By default, the library will use the API version pinned to the account making
|
|
|
141
157
|
a request. This can be overridden with this global option:
|
|
142
158
|
|
|
143
159
|
```ruby
|
|
144
|
-
Stripe.api_version =
|
|
160
|
+
Stripe.api_version = '2018-02-28'
|
|
145
161
|
```
|
|
146
162
|
|
|
147
163
|
See [versioning in the API reference][versioning] for more information.
|
|
@@ -152,7 +168,7 @@ By default, the library will use its own internal bundle of known CA
|
|
|
152
168
|
certificates, but it's possible to configure your own:
|
|
153
169
|
|
|
154
170
|
```ruby
|
|
155
|
-
Stripe.ca_bundle_path =
|
|
171
|
+
Stripe.ca_bundle_path = 'path/to/ca/bundle'
|
|
156
172
|
```
|
|
157
173
|
|
|
158
174
|
### Configuring Automatic Retries
|
|
@@ -172,11 +188,12 @@ retries are safe.
|
|
|
172
188
|
|
|
173
189
|
### Configuring Timeouts
|
|
174
190
|
|
|
175
|
-
Open and
|
|
191
|
+
Open, read and write timeouts are configurable:
|
|
176
192
|
|
|
177
193
|
```ruby
|
|
178
|
-
Stripe.open_timeout = 30
|
|
194
|
+
Stripe.open_timeout = 30 # in seconds
|
|
179
195
|
Stripe.read_timeout = 80
|
|
196
|
+
Stripe.write_timeout = 30 # only supported on Ruby 2.6+
|
|
180
197
|
```
|
|
181
198
|
|
|
182
199
|
Please take care to set conservative read timeouts. Some API requests can take
|
|
@@ -203,13 +220,63 @@ There are a few options for enabling it:
|
|
|
203
220
|
Stripe.log_level = Stripe::LEVEL_INFO
|
|
204
221
|
```
|
|
205
222
|
|
|
223
|
+
### Instrumentation
|
|
224
|
+
|
|
225
|
+
The library has various hooks that user code can tie into by passing a block to
|
|
226
|
+
`Stripe::Instrumentation.subscribe` to be notified about specific events.
|
|
227
|
+
|
|
228
|
+
#### `request_begin`
|
|
229
|
+
|
|
230
|
+
Invoked when an HTTP request starts. Receives `RequestBeginEvent` with the
|
|
231
|
+
following properties:
|
|
232
|
+
|
|
233
|
+
- `method`: HTTP method. (`Symbol`)
|
|
234
|
+
- `path`: Request path. (`String`)
|
|
235
|
+
- `user_data`: A hash on which users can set arbitrary data, and which will be
|
|
236
|
+
passed through to `request_end` invocations. This could be used, for example,
|
|
237
|
+
to assign unique IDs to each request, and it'd work even if many requests are
|
|
238
|
+
running in parallel. All subscribers share the same object for any particular
|
|
239
|
+
request, so they must be careful to use unique keys that will not conflict
|
|
240
|
+
with other subscribers. (`Hash`)
|
|
241
|
+
|
|
242
|
+
#### `request_end`
|
|
243
|
+
|
|
244
|
+
Invoked when an HTTP request finishes, regardless of whether it terminated with
|
|
245
|
+
a success or error. Receives `RequestEndEvent` with the following properties:
|
|
246
|
+
|
|
247
|
+
- `duration`: Request duration in seconds. (`Float`)
|
|
248
|
+
- `http_status`: HTTP response code (`Integer`) if available, or `nil` in case
|
|
249
|
+
of a lower level network error.
|
|
250
|
+
- `method`: HTTP method. (`Symbol`)
|
|
251
|
+
- `num_retries`: The number of retries. (`Integer`)
|
|
252
|
+
- `path`: Request path. (`String`)
|
|
253
|
+
- `user_data`: A hash on which users may have set arbitrary data in
|
|
254
|
+
`request_begin`. See above for more information. (`Hash`)
|
|
255
|
+
- `request_id`. HTTP request identifier.
|
|
256
|
+
|
|
257
|
+
#### Example
|
|
258
|
+
|
|
259
|
+
For example:
|
|
260
|
+
|
|
261
|
+
```ruby
|
|
262
|
+
Stripe::Instrumentation.subscribe(:request_end) do |request_event|
|
|
263
|
+
tags = {
|
|
264
|
+
method: request_event.method,
|
|
265
|
+
resource: request_event.path.split('/')[2],
|
|
266
|
+
code: request_event.http_status,
|
|
267
|
+
retries: request_event.num_retries
|
|
268
|
+
}
|
|
269
|
+
StatsD.distribution('stripe_request', request_event.duration, tags: tags)
|
|
270
|
+
end
|
|
271
|
+
```
|
|
272
|
+
|
|
206
273
|
### Writing a Plugin
|
|
207
274
|
|
|
208
275
|
If you're writing a plugin that uses the library, we'd appreciate it if you
|
|
209
276
|
identified using `#set_app_info`:
|
|
210
277
|
|
|
211
278
|
```ruby
|
|
212
|
-
Stripe.set_app_info(
|
|
279
|
+
Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesomeplugin.info')
|
|
213
280
|
```
|
|
214
281
|
|
|
215
282
|
This information is passed along when the library makes calls to the Stripe
|
|
@@ -273,9 +340,10 @@ Update the bundled [stripe-mock] by editing the version number found in
|
|
|
273
340
|
[api-keys]: https://dashboard.stripe.com/account/apikeys
|
|
274
341
|
[connect]: https://stripe.com/connect
|
|
275
342
|
[curl]: http://curl.haxx.se/docs/caextract.html
|
|
276
|
-
[idempotency-keys]: https://stripe.com/docs/api/ruby
|
|
343
|
+
[idempotency-keys]: https://stripe.com/docs/api/idempotent_requests?lang=ruby
|
|
277
344
|
[stripe-mock]: https://github.com/stripe/stripe-mock
|
|
278
|
-
[versioning]: https://stripe.com/docs/api/ruby
|
|
345
|
+
[versioning]: https://stripe.com/docs/api/versioning?lang=ruby
|
|
346
|
+
[youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M50RmP6ie-gdcSnfOuQCRYk
|
|
279
347
|
|
|
280
348
|
<!--
|
|
281
349
|
# vim: set tw=79:
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.55.0
|
|
@@ -4,7 +4,7 @@ module Stripe
|
|
|
4
4
|
module APIOperations
|
|
5
5
|
module Create
|
|
6
6
|
def create(params = {}, opts = {})
|
|
7
|
-
resp, opts =
|
|
7
|
+
resp, opts = execute_resource_request(:post, resource_url, params, opts)
|
|
8
8
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
9
9
|
end
|
|
10
10
|
end
|