stripe 4.17.0 → 5.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +193 -1
  3. data/CODE_OF_CONDUCT.md +77 -0
  4. data/Gemfile +10 -14
  5. data/README.md +167 -63
  6. data/Rakefile +8 -7
  7. data/VERSION +1 -1
  8. data/lib/stripe/api_operations/create.rb +1 -1
  9. data/lib/stripe/api_operations/delete.rb +7 -3
  10. data/lib/stripe/api_operations/list.rb +1 -12
  11. data/lib/stripe/api_operations/nested_resource.rb +36 -27
  12. data/lib/stripe/api_operations/request.rb +47 -8
  13. data/lib/stripe/api_operations/save.rb +8 -7
  14. data/lib/stripe/api_resource.rb +30 -5
  15. data/lib/stripe/connection_manager.rb +164 -0
  16. data/lib/stripe/error_object.rb +94 -0
  17. data/lib/stripe/errors.rb +31 -10
  18. data/lib/stripe/instrumentation.rb +82 -0
  19. data/lib/stripe/list_object.rb +41 -7
  20. data/lib/stripe/multipart_encoder.rb +131 -0
  21. data/lib/stripe/oauth.rb +8 -6
  22. data/lib/stripe/object_types.rb +102 -0
  23. data/lib/stripe/{account.rb → resources/account.rb} +44 -33
  24. data/lib/stripe/{account_link.rb → resources/account_link.rb} +2 -1
  25. data/lib/stripe/resources/alipay_account.rb +34 -0
  26. data/lib/stripe/{apple_pay_domain.rb → resources/apple_pay_domain.rb} +2 -1
  27. data/lib/stripe/resources/application_fee.rb +14 -0
  28. data/lib/stripe/resources/application_fee_refund.rb +30 -0
  29. data/lib/stripe/{balance.rb → resources/balance.rb} +2 -1
  30. data/lib/stripe/{balance_transaction.rb → resources/balance_transaction.rb} +2 -5
  31. data/lib/stripe/resources/bank_account.rb +43 -0
  32. data/lib/stripe/{issuing/dispute.rb → resources/billing_portal/configuration.rb} +4 -3
  33. data/lib/stripe/{checkout → resources/billing_portal}/session.rb +3 -2
  34. data/lib/stripe/{bitcoin_receiver.rb → resources/bitcoin_receiver.rb} +4 -3
  35. data/lib/stripe/{bitcoin_transaction.rb → resources/bitcoin_transaction.rb} +1 -1
  36. data/lib/stripe/{capability.rb → resources/capability.rb} +11 -4
  37. data/lib/stripe/{card.rb → resources/card.rb} +12 -3
  38. data/lib/stripe/resources/charge.rb +23 -0
  39. data/lib/stripe/resources/checkout/session.rb +16 -0
  40. data/lib/stripe/{country_spec.rb → resources/country_spec.rb} +2 -1
  41. data/lib/stripe/{coupon.rb → resources/coupon.rb} +2 -1
  42. data/lib/stripe/resources/credit_note.rb +33 -0
  43. data/lib/stripe/resources/credit_note_line_item.rb +7 -0
  44. data/lib/stripe/resources/customer.rb +41 -0
  45. data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
  46. data/lib/stripe/{discount.rb → resources/discount.rb} +1 -1
  47. data/lib/stripe/resources/dispute.rb +22 -0
  48. data/lib/stripe/{ephemeral_key.rb → resources/ephemeral_key.rb} +6 -2
  49. data/lib/stripe/{event.rb → resources/event.rb} +2 -1
  50. data/lib/stripe/{exchange_rate.rb → resources/exchange_rate.rb} +2 -1
  51. data/lib/stripe/{file.rb → resources/file.rb} +7 -12
  52. data/lib/stripe/{file_link.rb → resources/file_link.rb} +2 -1
  53. data/lib/stripe/resources/invoice.rb +74 -0
  54. data/lib/stripe/{invoice_item.rb → resources/invoice_item.rb} +2 -1
  55. data/lib/stripe/{invoice_line_item.rb → resources/invoice_line_item.rb} +1 -1
  56. data/lib/stripe/{issuing → resources/issuing}/authorization.rb +14 -5
  57. data/lib/stripe/{issuing → resources/issuing}/card.rb +8 -3
  58. data/lib/stripe/{issuing → resources/issuing}/card_details.rb +1 -1
  59. data/lib/stripe/{issuing → resources/issuing}/cardholder.rb +2 -1
  60. data/lib/stripe/resources/issuing/dispute.rb +25 -0
  61. data/lib/stripe/{issuing → resources/issuing}/transaction.rb +2 -1
  62. data/lib/stripe/resources/line_item.rb +7 -0
  63. data/lib/stripe/resources/login_link.rb +14 -0
  64. data/lib/stripe/resources/mandate.rb +8 -0
  65. data/lib/stripe/resources/order.rb +33 -0
  66. data/lib/stripe/{order_return.rb → resources/order_return.rb} +2 -1
  67. data/lib/stripe/resources/payment_intent.rb +43 -0
  68. data/lib/stripe/{payment_method.rb → resources/payment_method.rb} +14 -5
  69. data/lib/stripe/resources/payout.rb +33 -0
  70. data/lib/stripe/{person.rb → resources/person.rb} +8 -3
  71. data/lib/stripe/{plan.rb → resources/plan.rb} +2 -1
  72. data/lib/stripe/resources/price.rb +12 -0
  73. data/lib/stripe/{product.rb → resources/product.rb} +2 -1
  74. data/lib/stripe/resources/promotion_code.rb +12 -0
  75. data/lib/stripe/resources/radar/early_fraud_warning.rb +12 -0
  76. data/lib/stripe/{radar → resources/radar}/value_list.rb +2 -1
  77. data/lib/stripe/{radar → resources/radar}/value_list_item.rb +2 -1
  78. data/lib/stripe/{recipient.rb → resources/recipient.rb} +2 -5
  79. data/lib/stripe/{recipient_transfer.rb → resources/recipient_transfer.rb} +1 -1
  80. data/lib/stripe/{refund.rb → resources/refund.rb} +2 -1
  81. data/lib/stripe/{reporting → resources/reporting}/report_run.rb +2 -1
  82. data/lib/stripe/{reporting → resources/reporting}/report_type.rb +2 -1
  83. data/lib/stripe/resources/reversal.rb +29 -0
  84. data/lib/stripe/{review.rb → resources/review.rb} +8 -3
  85. data/lib/stripe/resources/setup_attempt.rb +10 -0
  86. data/lib/stripe/resources/setup_intent.rb +33 -0
  87. data/lib/stripe/{sigma → resources/sigma}/scheduled_query_run.rb +2 -1
  88. data/lib/stripe/{sku.rb → resources/sku.rb} +2 -1
  89. data/lib/stripe/{source.rb → resources/source.rb} +22 -15
  90. data/lib/stripe/{source_transaction.rb → resources/source_transaction.rb} +1 -1
  91. data/lib/stripe/{subscription.rb → resources/subscription.rb} +12 -13
  92. data/lib/stripe/resources/subscription_item.rb +26 -0
  93. data/lib/stripe/resources/subscription_schedule.rb +33 -0
  94. data/lib/stripe/resources/tax_id.rb +26 -0
  95. data/lib/stripe/{tax_rate.rb → resources/tax_rate.rb} +2 -1
  96. data/lib/stripe/{terminal → resources/terminal}/connection_token.rb +2 -1
  97. data/lib/stripe/{terminal → resources/terminal}/location.rb +2 -1
  98. data/lib/stripe/{terminal → resources/terminal}/reader.rb +2 -1
  99. data/lib/stripe/{three_d_secure.rb → resources/three_d_secure.rb} +2 -1
  100. data/lib/stripe/{token.rb → resources/token.rb} +2 -1
  101. data/lib/stripe/{topup.rb → resources/topup.rb} +8 -3
  102. data/lib/stripe/resources/transfer.rb +27 -0
  103. data/lib/stripe/resources/usage_record.rb +7 -0
  104. data/lib/stripe/{usage_record_summary.rb → resources/usage_record_summary.rb} +1 -1
  105. data/lib/stripe/{webhook_endpoint.rb → resources/webhook_endpoint.rb} +2 -1
  106. data/lib/stripe/resources.rb +85 -0
  107. data/lib/stripe/singleton_api_resource.rb +3 -1
  108. data/lib/stripe/stripe_client.rb +576 -254
  109. data/lib/stripe/stripe_configuration.rb +194 -0
  110. data/lib/stripe/stripe_object.rb +80 -61
  111. data/lib/stripe/stripe_response.rb +53 -21
  112. data/lib/stripe/util.rb +76 -121
  113. data/lib/stripe/version.rb +1 -1
  114. data/lib/stripe/webhook.rb +43 -10
  115. data/lib/stripe.rb +42 -203
  116. data/stripe.gemspec +23 -7
  117. metadata +107 -284
  118. data/.gitattributes +0 -4
  119. data/.github/ISSUE_TEMPLATE.md +0 -5
  120. data/.gitignore +0 -8
  121. data/.rubocop.yml +0 -32
  122. data/.rubocop_todo.yml +0 -50
  123. data/.travis.yml +0 -42
  124. data/lib/stripe/alipay_account.rb +0 -27
  125. data/lib/stripe/application_fee.rb +0 -23
  126. data/lib/stripe/application_fee_refund.rb +0 -22
  127. data/lib/stripe/bank_account.rb +0 -32
  128. data/lib/stripe/charge.rb +0 -86
  129. data/lib/stripe/credit_note.rb +0 -18
  130. data/lib/stripe/customer.rb +0 -95
  131. data/lib/stripe/dispute.rb +0 -23
  132. data/lib/stripe/invoice.rb +0 -48
  133. data/lib/stripe/issuer_fraud_record.rb +0 -9
  134. data/lib/stripe/login_link.rb +0 -11
  135. data/lib/stripe/order.rb +0 -34
  136. data/lib/stripe/payment_intent.rb +0 -30
  137. data/lib/stripe/payout.rb +0 -24
  138. data/lib/stripe/reversal.rb +0 -22
  139. data/lib/stripe/subscription_item.rb +0 -17
  140. data/lib/stripe/subscription_schedule.rb +0 -35
  141. data/lib/stripe/subscription_schedule_revision.rb +0 -25
  142. data/lib/stripe/tax_id.rb +0 -22
  143. data/lib/stripe/transfer.rb +0 -25
  144. data/lib/stripe/usage_record.rb +0 -14
  145. data/test/api_stub_helpers.rb +0 -1
  146. data/test/openapi/README.md +0 -9
  147. data/test/stripe/account_link_test.rb +0 -18
  148. data/test/stripe/account_test.rb +0 -428
  149. data/test/stripe/alipay_account_test.rb +0 -37
  150. data/test/stripe/api_operations_test.rb +0 -81
  151. data/test/stripe/api_resource_test.rb +0 -526
  152. data/test/stripe/apple_pay_domain_test.rb +0 -46
  153. data/test/stripe/application_fee_refund_test.rb +0 -37
  154. data/test/stripe/application_fee_test.rb +0 -58
  155. data/test/stripe/balance_test.rb +0 -13
  156. data/test/stripe/bank_account_test.rb +0 -36
  157. data/test/stripe/capability_test.rb +0 -45
  158. data/test/stripe/charge_test.rb +0 -80
  159. data/test/stripe/checkout/session_test.rb +0 -41
  160. data/test/stripe/country_spec_test.rb +0 -20
  161. data/test/stripe/coupon_test.rb +0 -61
  162. data/test/stripe/credit_note_test.rb +0 -61
  163. data/test/stripe/customer_card_test.rb +0 -42
  164. data/test/stripe/customer_test.rb +0 -226
  165. data/test/stripe/dispute_test.rb +0 -51
  166. data/test/stripe/ephemeral_key_test.rb +0 -93
  167. data/test/stripe/errors_test.rb +0 -20
  168. data/test/stripe/exchange_rate_test.rb +0 -20
  169. data/test/stripe/file_link_test.rb +0 -41
  170. data/test/stripe/file_test.rb +0 -97
  171. data/test/stripe/file_upload_test.rb +0 -79
  172. data/test/stripe/invoice_item_test.rb +0 -66
  173. data/test/stripe/invoice_line_item_test.rb +0 -8
  174. data/test/stripe/invoice_test.rb +0 -213
  175. data/test/stripe/issuer_fraud_record_test.rb +0 -20
  176. data/test/stripe/issuing/authorization_test.rb +0 -72
  177. data/test/stripe/issuing/card_test.rb +0 -62
  178. data/test/stripe/issuing/cardholder_test.rb +0 -53
  179. data/test/stripe/issuing/dispute_test.rb +0 -45
  180. data/test/stripe/issuing/transaction_test.rb +0 -48
  181. data/test/stripe/list_object_test.rb +0 -156
  182. data/test/stripe/login_link_test.rb +0 -37
  183. data/test/stripe/oauth_test.rb +0 -88
  184. data/test/stripe/order_return_test.rb +0 -21
  185. data/test/stripe/order_test.rb +0 -75
  186. data/test/stripe/payment_intent_test.rb +0 -107
  187. data/test/stripe/payment_method_test.rb +0 -84
  188. data/test/stripe/payout_test.rb +0 -57
  189. data/test/stripe/person_test.rb +0 -46
  190. data/test/stripe/plan_test.rb +0 -98
  191. data/test/stripe/product_test.rb +0 -59
  192. data/test/stripe/radar/value_list_item_test.rb +0 -48
  193. data/test/stripe/radar/value_list_test.rb +0 -61
  194. data/test/stripe/recipient_test.rb +0 -62
  195. data/test/stripe/refund_test.rb +0 -39
  196. data/test/stripe/reporting/report_run_test.rb +0 -33
  197. data/test/stripe/reporting/report_type_test.rb +0 -22
  198. data/test/stripe/reversal_test.rb +0 -43
  199. data/test/stripe/review_test.rb +0 -27
  200. data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
  201. data/test/stripe/sku_test.rb +0 -60
  202. data/test/stripe/source_test.rb +0 -99
  203. data/test/stripe/source_transaction_test.rb +0 -19
  204. data/test/stripe/stripe_client_test.rb +0 -842
  205. data/test/stripe/stripe_object_test.rb +0 -525
  206. data/test/stripe/stripe_response_test.rb +0 -49
  207. data/test/stripe/subscription_item_test.rb +0 -63
  208. data/test/stripe/subscription_schedule_revision_test.rb +0 -37
  209. data/test/stripe/subscription_schedule_test.rb +0 -116
  210. data/test/stripe/subscription_test.rb +0 -80
  211. data/test/stripe/tax_id_test.rb +0 -31
  212. data/test/stripe/tax_rate_test.rb +0 -43
  213. data/test/stripe/terminal/connection_token_test.rb +0 -16
  214. data/test/stripe/terminal/location_test.rb +0 -68
  215. data/test/stripe/terminal/reader_test.rb +0 -62
  216. data/test/stripe/three_d_secure_test.rb +0 -23
  217. data/test/stripe/topup_test.rb +0 -62
  218. data/test/stripe/transfer_test.rb +0 -88
  219. data/test/stripe/usage_record_summary_test.rb +0 -19
  220. data/test/stripe/usage_record_test.rb +0 -28
  221. data/test/stripe/util_test.rb +0 -402
  222. data/test/stripe/webhook_endpoint_test.rb +0 -59
  223. data/test/stripe/webhook_test.rb +0 -96
  224. data/test/stripe_mock.rb +0 -77
  225. data/test/stripe_test.rb +0 -63
  226. data/test/test_data.rb +0 -61
  227. data/test/test_helper.rb +0 -73
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d3a140d2d3cb343cb427df5438201a04e82a8eb71cb352241955e4ae70ca6c3
4
- data.tar.gz: d6bac1ffd1f4b9b5210bdd684b443fd6c12f1cc8084a854e728c8893f1dc768f
3
+ metadata.gz: e600b7741930b12c7ffaa1b6cfdcf6a540d5d57f8955a2c0be38a37d6f5ff556
4
+ data.tar.gz: dfd0a97aff35a0e38a4818a1c239da46b3d47d741cf1fb3c7608d7d5c7c182b9
5
5
  SHA512:
6
- metadata.gz: 2d88469f61576501ebe5e9795381aba16fa4452eae217c4721abe8159468a8489ad54a18e09384c337f3fdebae4a3e5e5d0ae100f3587c491c880472d4cdd7f3
7
- data.tar.gz: 575ab9b320e2dd5642964ad6a0b125d6c28cac9cfaa98260bb86b4489369e5413531bf26a285b85dd68f2d5afbace0beabd754f967b4aaa9c295d6644bcab058
6
+ metadata.gz: 7fe07169d17aa534beffca79063fdc9c48ebebc48176aed097220a183c0d305d696b97bba255f6c3633755e92c96bbbacb5cb1865c66c99754ca28c4f23e7c84
7
+ data.tar.gz: 9b06b7398144207f98d74bb270777fdf5b8a54f454c776891d95401cae9a86edd487aeebfe44d1b38744ff17e3f8d952b34415308241597f3351720936791504
data/CHANGELOG.md CHANGED
@@ -1,5 +1,197 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.32.0 - 2021-04-05
4
+ * [#973](https://github.com/stripe/stripe-ruby/pull/973) Reduce packed gem size
5
+
6
+ ## 5.31.0 - 2021-04-02
7
+ * [#968](https://github.com/stripe/stripe-ruby/pull/968) Allow StripeClient to be configured per instance
8
+ * [#971](https://github.com/stripe/stripe-ruby/pull/971) On config change, only clear connection managers for changed config
9
+ * [#972](https://github.com/stripe/stripe-ruby/pull/972) Rename `Stripe.configuration` to `Stripe.config`
10
+ * [#970](https://github.com/stripe/stripe-ruby/pull/970) Reserve some critical field names when adding `StripeObject` accessors
11
+ * [#967](https://github.com/stripe/stripe-ruby/pull/967) CI: github actions
12
+
13
+ ## 5.30.0 - 2021-02-22
14
+ * [#965](https://github.com/stripe/stripe-ruby/pull/965) Add support for the Billing Portal Configuration API
15
+
16
+ ## 5.29.1 - 2021-02-09
17
+ * [#964](https://github.com/stripe/stripe-ruby/pull/964) Fix return value of `Customer#delete_discount`
18
+
19
+ ## 5.29.0 - 2021-01-05
20
+ * [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
21
+
22
+ ## 5.28.0 - 2020-10-14
23
+ * [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
24
+
25
+ ## 5.27.0 - 2020-10-14
26
+ * [#951](https://github.com/stripe/stripe-ruby/pull/951) Add support for the Payout Reverse API
27
+
28
+ ## 5.26.0 - 2020-09-29
29
+ * [#949](https://github.com/stripe/stripe-ruby/pull/949) Add support for the `SetupAttempt` resource and List API
30
+
31
+ ## 5.25.0 - 2020-09-02
32
+ * [#944](https://github.com/stripe/stripe-ruby/pull/944) Add support for the Issuing Dispute Submit API
33
+
34
+ ## 5.24.0 - 2020-08-26
35
+ * [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
36
+ * [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
37
+
38
+ ## 5.23.1 - 2020-08-05
39
+ * [#936](https://github.com/stripe/stripe-ruby/pull/936) Rename API resource's `request` method
40
+
41
+ ## 5.23.0 - 2020-08-05
42
+ * [#937](https://github.com/stripe/stripe-ruby/pull/937) Add support for the `PromotionCode` resource and APIs
43
+
44
+ ## 5.22.0 - 2020-05-11
45
+ * [#918](https://github.com/stripe/stripe-ruby/pull/918) Add support for the `LineItem` resource and APIs
46
+
47
+ ## 5.21.0 - 2020-04-29
48
+ * [#917](https://github.com/stripe/stripe-ruby/pull/917) Add support for the `Price` resource and APIs
49
+
50
+ ## 5.20.0 - 2020-04-27
51
+ * [#916](https://github.com/stripe/stripe-ruby/pull/916) Add new `.generate_header` method for webhooks
52
+
53
+ ## 5.19.0 - 2020-04-24
54
+ * [#915](https://github.com/stripe/stripe-ruby/pull/915) Expose `Stripe::Webhook.compute_signature` publicly
55
+
56
+ ## 5.18.0 - 2020-04-22
57
+ * [#911](https://github.com/stripe/stripe-ruby/pull/911) Add support for `BillingPortal` namespace and `Session` resource and APIs
58
+
59
+ ## 5.17.0 - 2020-02-26
60
+ * [#907](https://github.com/stripe/stripe-ruby/pull/907) Add `StripeError#idempotent_replayed?`
61
+
62
+ ## 5.16.0 - 2020-02-26
63
+ * [#906](https://github.com/stripe/stripe-ruby/pull/906) Add support for listing Checkout sessions
64
+ * [#903](https://github.com/stripe/stripe-ruby/pull/903) Upgrade to Rubocop 0.80
65
+
66
+ ## 5.15.0 - 2020-02-10
67
+ * [#902](https://github.com/stripe/stripe-ruby/pull/902) Add `request_begin` instrumentation callback
68
+
69
+ ## 5.14.0 - 2020-01-14
70
+ * [#896](https://github.com/stripe/stripe-ruby/pull/896) Add support for `CreditNoteLineItem`
71
+ * [#894](https://github.com/stripe/stripe-ruby/pull/894) Clean up test output by capturing `$stderr` when we expect warnings
72
+ * [#892](https://github.com/stripe/stripe-ruby/pull/892) Explicitly pass a parameter as hash to be more ruby 2.7 friendly
73
+ * [#893](https://github.com/stripe/stripe-ruby/pull/893) Upgrade Rubocop to 0.79
74
+
75
+ ## 5.13.0 - 2020-01-08
76
+ * [#891](https://github.com/stripe/stripe-ruby/pull/891) Fix most Ruby 2.7 warnings
77
+
78
+ ## 5.12.1 - 2020-01-06
79
+ * [#890](https://github.com/stripe/stripe-ruby/pull/890) Override API key with `client_secret` in `OAuth.token`
80
+
81
+ ## 5.12.0 - 2020-01-02
82
+ * [#889](https://github.com/stripe/stripe-ruby/pull/889) Add support for retrieve source transaction API method
83
+
84
+ ## 5.11.0 - 2019-11-26
85
+ * [#885](https://github.com/stripe/stripe-ruby/pull/885) Add support for `CreditNote` preview
86
+
87
+ ## 5.10.0 - 2019-11-08
88
+ * [#882](https://github.com/stripe/stripe-ruby/pull/882) Add list_usage_record_summaries and list_source_transactions
89
+
90
+ ## 5.9.0 - 2019-11-07
91
+ * [#870](https://github.com/stripe/stripe-ruby/pull/870) Add request instrumentation callback (see `README.md` for usage example)
92
+
93
+ ## 5.8.0 - 2019-11-05
94
+ * [#879](https://github.com/stripe/stripe-ruby/pull/879) Add support for `Mandate`
95
+ * [#876](https://github.com/stripe/stripe-ruby/pull/876) Add additional per-request configuration documentation
96
+ * [#874](https://github.com/stripe/stripe-ruby/pull/874) Raise an error when requests params are invalid
97
+ * [#873](https://github.com/stripe/stripe-ruby/pull/873) Contributor Covenant
98
+
99
+ ## 5.7.1 - 2019-10-15
100
+ * [#869](https://github.com/stripe/stripe-ruby/pull/869) Fixes the misnamed `connection_base=` setter to be named `connect_base=`
101
+
102
+ ## 5.7.0 - 2019-10-10
103
+ * [#865](https://github.com/stripe/stripe-ruby/pull/865) Support backwards pagination with list's `#auto_paging_each`
104
+
105
+ ## 5.6.0 - 2019-10-04
106
+ * [#861](https://github.com/stripe/stripe-ruby/pull/861) Nicer error when specifying non-nil non-string opt value
107
+
108
+ ## 5.5.0 - 2019-10-03
109
+ * [#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
110
+
111
+ ## 5.4.1 - 2019-10-01
112
+ * [#858](https://github.com/stripe/stripe-ruby/pull/858) Drop Timecop dependency
113
+
114
+ ## 5.4.0 - 2019-10-01
115
+ * [#857](https://github.com/stripe/stripe-ruby/pull/857) Move to monotonic time for duration calculations
116
+
117
+ ## 5.3.0 - 2019-10-01
118
+ * [#853](https://github.com/stripe/stripe-ruby/pull/853) Support `Stripe-Should-Retry` header
119
+
120
+ ## 5.2.0 - 2019-09-19
121
+ * [#851](https://github.com/stripe/stripe-ruby/pull/851) Introduce system for garbage collecting connection managers
122
+
123
+ ## 5.1.1 - 2019-09-04
124
+ * [#845](https://github.com/stripe/stripe-ruby/pull/845) Transfer the request_id from the http_headers to error.
125
+
126
+ ## 5.1.0 - 2019-08-27
127
+ * [#841](https://github.com/stripe/stripe-ruby/pull/841) Retry requests on a 429 that's a lock timeout
128
+
129
+ ## 5.0.1 - 2019-08-20
130
+ * [#836](https://github.com/stripe/stripe-ruby/pull/836) Increase connection keep alive timeout to 30 seconds
131
+
132
+ ## 5.0.0 - 2019-08-20
133
+ 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.
134
+
135
+ Pull requests included in this release (cf. [#815](https://github.com/stripe/stripe-ruby/pull/815)) (⚠️ = breaking changes):
136
+ * ⚠️ [#813](https://github.com/stripe/stripe-ruby/pull/813): Convert library to use built-in `Net::HTTP`
137
+ * ⚠️ [#816](https://github.com/stripe/stripe-ruby/pull/816): Make `code` argument in `CardError` named instead of positional.
138
+ * ⚠️ [#817](https://github.com/stripe/stripe-ruby/pull/817): Drop support for very old Ruby versions.
139
+ * [#818](https://github.com/stripe/stripe-ruby/pull/818): Bump Rubocop to latest version
140
+ * [#819](https://github.com/stripe/stripe-ruby/pull/819): Ruby minimum version increase followup
141
+ * ⚠️ [#820](https://github.com/stripe/stripe-ruby/pull/820): Remove old deprecated methods
142
+ * ⚠️ [#823](https://github.com/stripe/stripe-ruby/pull/823): Remove all alias for list methods
143
+ * ⚠️ [#826](https://github.com/stripe/stripe-ruby/pull/826): Remove `UsageRecord.create` method
144
+ * ⚠️ [#827](https://github.com/stripe/stripe-ruby/pull/827): Remove `IssuerFraudRecord`
145
+ * [#811](https://github.com/stripe/stripe-ruby/pull/811): Add `ErrorObject` to `StripeError` exceptions
146
+ * [#828](https://github.com/stripe/stripe-ruby/pull/828): Tweak retry logic to be a little more like stripe-node
147
+ * [#829](https://github.com/stripe/stripe-ruby/pull/829): Reset connections when connection-changing configuration changes (optional)
148
+ * [#830](https://github.com/stripe/stripe-ruby/pull/830): Fix inverted sign for 500 retries
149
+ * ⚠️[#831](https://github.com/stripe/stripe-ruby/pull/831): Remove a few more very old deprecated methods
150
+ * [#832](https://github.com/stripe/stripe-ruby/pull/832): Minor cleanup in `StripeClient`
151
+ * [#833](https://github.com/stripe/stripe-ruby/pull/833): Do better bookkeeping when tracking state in `Thread.current`
152
+ * [#834](https://github.com/stripe/stripe-ruby/pull/834): Add `Invoice.list_upcoming_line_items` method
153
+
154
+ ## 4.24.0 - 2019-08-12
155
+ * [#825](https://github.com/stripe/stripe-ruby/pull/825) Add `SubscriptionItem.create_usage_record` method
156
+ - This release also removed the `SubscriptionSchedule.revisions` method. This should have been included in the previous release (4.23.0)
157
+
158
+ ## 4.23.0 - 2019-08-09
159
+ * [#824](https://github.com/stripe/stripe-ruby/pull/824) Remove SubscriptionScheduleRevision
160
+ - This is technically a breaking change. We've chosen to release it as a minor vesion bump because the associated API is unused.
161
+
162
+ ## 4.22.1 - 2019-08-09
163
+ * [#808](https://github.com/stripe/stripe-ruby/pull/808) Unify request/response handling
164
+
165
+ ## 4.22.0 - 2019-07-30
166
+ * [#821](https://github.com/stripe/stripe-ruby/pull/821) Listing `BalanceTransaction` objects now uses `/v1/balance_transactions` instead of `/v1/balance/history`
167
+
168
+ ## 4.21.3 - 2019-07-15
169
+ * [#810](https://github.com/stripe/stripe-ruby/pull/810) Better error message when passing non-string to custom method
170
+
171
+ ## 4.21.2 - 2019-07-05
172
+ * [#806](https://github.com/stripe/stripe-ruby/pull/806) Revert back to `initialize_from` from `Util.convert_to_stripe_object`
173
+
174
+ ## 4.21.1 - 2019-07-04
175
+ * [#807](https://github.com/stripe/stripe-ruby/pull/807) Add gem metadata
176
+
177
+ ## 4.21.0 - 2019-06-28
178
+ * [#803](https://github.com/stripe/stripe-ruby/pull/803) Add support for the `SetupIntent` resource and APIs
179
+
180
+ ## 4.20.1 - 2019-06-28
181
+ * [#805](https://github.com/stripe/stripe-ruby/pull/805) Fix formatting in `ConnectionFailed` error message
182
+
183
+ ## 4.20.0 - 2019-06-24
184
+ * [#800](https://github.com/stripe/stripe-ruby/pull/800) Enable request latency telemetry by default
185
+
186
+ ## 4.19.0 - 2019-06-17
187
+ * [#770](https://github.com/stripe/stripe-ruby/pull/770) Add support for `CustomerBalanceTransaction` resource and APIs
188
+
189
+ ## 4.18.1 - 2019-05-27
190
+ * [#789](https://github.com/stripe/stripe-ruby/pull/789) Allow `Order#pay` to be called without arguments
191
+
192
+ ## 4.18.0 - 2019-05-23
193
+ * [#783](https://github.com/stripe/stripe-ruby/pull/783) Add support for `radar.early_fraud_warning` resource
194
+
3
195
  ## 4.17.0 - 2019-05-14
4
196
  * [#779](https://github.com/stripe/stripe-ruby/pull/779) Add support for the Capability resource and APIs
5
197
 
@@ -55,7 +247,7 @@
55
247
  * [#718](https://github.com/stripe/stripe-ruby/pull/718) Fix an error message typo
56
248
 
57
249
  ## 4.4.0 - 2018-12-21
58
- * [#716](https://github.com/stripe/stripe-ruby/pull/716) Add support for the `CheckoutSession` resource
250
+ * [#716](https://github.com/stripe/stripe-ruby/pull/716) Add support for the `CheckoutSession` resource
59
251
 
60
252
  ## 4.3.0 - 2018-12-10
61
253
  * [#711](https://github.com/stripe/stripe-ruby/pull/711) Add support for account links
@@ -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,29 +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"
9
+ gem "rack", ">= 2.0.6"
10
10
  gem "rake"
11
- gem "shoulda-context"
11
+
12
+ # Update to 2.0.0 once it ships.
13
+ gem "shoulda-context", "2.0.0.rc4"
14
+
12
15
  gem "test-unit"
13
- gem "timecop"
14
- gem "webmock"
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"
15
20
 
16
21
  # Rubocop changes pretty quickly: new cops get added and old cops change
17
22
  # names or go into new namespaces. This is a library and we don't have
18
23
  # `Gemfile.lock` checked in, so to prevent good builds from suddenly going
19
24
  # bad, pin to a specific version number here. Try to keep this relatively
20
25
  # up-to-date, but it's not the end of the world if it's not.
21
- gem "rubocop", "0.50.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
26
+ gem "rubocop", "0.80"
31
27
 
32
28
  platforms :mri do
33
29
  gem "byebug"
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Stripe Ruby Library
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe)
3
4
  [![Build Status](https://travis-ci.org/stripe/stripe-ruby.svg?branch=master)](https://travis-ci.org/stripe/stripe-ruby)
4
- [![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](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
@@ -11,31 +11,36 @@ API.
11
11
 
12
12
  The library also provides other features. For example:
13
13
 
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
- executed.
18
- * Built-in mechanisms for the serialization of parameters according to the
14
+ - Easy configuration path for fast setup and use.
15
+ - Helpers for pagination.
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
21
  See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
24
22
 
23
+ See [video demonstrations][youtube-playlist] covering how to use the library.
24
+
25
+
25
26
  ## Installation
26
27
 
27
28
  You don't need this source code unless you want to modify the gem. If you just
28
29
  want to use the package, just run:
29
30
 
30
- gem install stripe
31
+ ```sh
32
+ gem install stripe
33
+ ```
31
34
 
32
35
  If you want to build the gem from source:
33
36
 
34
- gem build stripe.gemspec
37
+ ```sh
38
+ gem build stripe.gemspec
39
+ ```
35
40
 
36
41
  ### Requirements
37
42
 
38
- * Ruby 2.1+.
43
+ - Ruby 2.3+.
39
44
 
40
45
  ### Bundler
41
46
 
@@ -43,7 +48,7 @@ If you are installing via bundler, you should be sure to use the https rubygems
43
48
  source in your Gemfile, as any gems fetched over http could potentially be
44
49
  compromised in transit and alter the code of gems fetched securely over https:
45
50
 
46
- ``` ruby
51
+ ```ruby
47
52
  source 'https://rubygems.org'
48
53
 
49
54
  gem 'rails'
@@ -56,17 +61,15 @@ The library needs to be configured with your account's secret key which is
56
61
  available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
57
62
  value:
58
63
 
59
- ``` ruby
60
- require "stripe"
61
- Stripe.api_key = "sk_test_..."
64
+ ```ruby
65
+ require 'stripe'
66
+ Stripe.api_key = 'sk_test_...'
62
67
 
63
- # list charges
64
- Stripe::Charge.list()
68
+ # list customers
69
+ Stripe::Customer.list()
65
70
 
66
- # retrieve single charge
67
- Stripe::Charge.retrieve(
68
- "ch_18atAXCdGbJFKhCuBAa4532Z",
69
- )
71
+ # retrieve single customer
72
+ Stripe::Customer.retrieve('cus_123456789')
70
73
  ```
71
74
 
72
75
  ### Per-request Configuration
@@ -75,52 +78,67 @@ For apps that need to use multiple keys during the lifetime of a process, like
75
78
  one that uses [Stripe Connect][connect], it's also possible to set a
76
79
  per-request key and/or account:
77
80
 
78
- ``` ruby
81
+ ```ruby
79
82
  require "stripe"
80
83
 
81
- Stripe::Charge.list(
84
+ Stripe::Customer.list(
82
85
  {},
83
86
  {
84
- :api_key => "sk_test_...",
85
- :stripe_account => "acct_...",
86
- :stripe_version => "2018-02-28"
87
+ api_key: 'sk_test_...',
88
+ stripe_account: 'acct_...',
89
+ stripe_version: '2018-02-28',
87
90
  }
88
91
  )
89
92
 
90
- Stripe::Charge.retrieve(
91
- "ch_18atAXCdGbJFKhCuBAa4532Z",
93
+ Stripe::Customer.retrieve(
94
+ 'cus_123456789',
92
95
  {
93
- :api_key => "sk_test_...",
94
- :stripe_account => "acct_...",
95
- :stripe_version => "2018-02-28"
96
+ api_key: 'sk_test_...',
97
+ stripe_account: 'acct_...',
98
+ stripe_version: '2018-02-28',
96
99
  }
97
100
  )
98
101
 
99
- Stripe::Charge.retrieve(
102
+ Stripe::Customer.retrieve(
100
103
  {
101
- id: 'ch_18atAXCdGbJFKhCuBAa4532Z',
104
+ id: 'cus_123456789',
102
105
  expand: %w(balance_transaction)
103
106
  },
104
107
  {
105
108
  stripe_version: '2018-02-28',
106
- api_key: 'sk_test_...'
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_...',
107
119
  }
108
120
  )
109
121
  ```
110
122
 
111
- ### Configuring a Client
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
+
133
+ ### Accessing a response object
112
134
 
113
- While a default HTTP client is used by default, it's also possible to have the
114
- library use any client supported by [Faraday][faraday] by initializing a
115
- `Stripe::StripeClient` object and giving it a connection:
135
+ Get access to response objects by initializing a client and using its `request`
136
+ method:
116
137
 
117
- ``` ruby
118
- conn = Faraday.new
119
- client = Stripe::StripeClient.new(conn)
120
- charge, resp = client.request do
121
- Stripe::Charge.retrieve(
122
- "ch_18atAXCdGbJFKhCuBAa4532Z",
123
- )
138
+ ```ruby
139
+ client = Stripe::StripeClient.new
140
+ customer, resp = client.request do
141
+ Stripe::Customer.retrieve('cus_123456789',)
124
142
  end
125
143
  puts resp.request_id
126
144
  ```
@@ -130,7 +148,7 @@ puts resp.request_id
130
148
  A proxy can be configured with `Stripe.proxy`:
131
149
 
132
150
  ```ruby
133
- Stripe.proxy = "https://user:pass@example.com:1234"
151
+ Stripe.proxy = 'https://user:pass@example.com:1234'
134
152
  ```
135
153
 
136
154
  ### Configuring an API Version
@@ -138,7 +156,9 @@ Stripe.proxy = "https://user:pass@example.com:1234"
138
156
  By default, the library will use the API version pinned to the account making
139
157
  a request. This can be overridden with this global option:
140
158
 
141
- Stripe.api_version = "2018-02-28"
159
+ ```ruby
160
+ Stripe.api_version = '2018-02-28'
161
+ ```
142
162
 
143
163
  See [versioning in the API reference][versioning] for more information.
144
164
 
@@ -147,25 +167,33 @@ See [versioning in the API reference][versioning] for more information.
147
167
  By default, the library will use its own internal bundle of known CA
148
168
  certificates, but it's possible to configure your own:
149
169
 
150
- Stripe.ca_bundle_path = "path/to/ca/bundle"
170
+ ```ruby
171
+ Stripe.ca_bundle_path = 'path/to/ca/bundle'
172
+ ```
151
173
 
152
174
  ### Configuring Automatic Retries
153
175
 
154
- The library can be configured to automatically retry requests that fail due to
155
- an intermittent network problem:
176
+ You can enable automatic retries on requests that fail due to a transient
177
+ problem by configuring the maximum number of retries:
178
+
179
+ ```ruby
180
+ Stripe.max_network_retries = 2
181
+ ```
156
182
 
157
- Stripe.max_network_retries = 2
183
+ Various errors can trigger a retry, like a connection error or a timeout, and
184
+ also certain API responses like HTTP status `409 Conflict`.
158
185
 
159
186
  [Idempotency keys][idempotency-keys] are added to requests to guarantee that
160
187
  retries are safe.
161
188
 
162
189
  ### Configuring Timeouts
163
190
 
164
- Open and read timeouts are configurable:
191
+ Open, read and write timeouts are configurable:
165
192
 
166
- ```java
167
- Stripe.open_timeout = 30 // in seconds
193
+ ```ruby
194
+ Stripe.open_timeout = 30 # in seconds
168
195
  Stripe.read_timeout = 80
196
+ Stripe.write_timeout = 30 # only supported on Ruby 2.6+
169
197
  ```
170
198
 
171
199
  Please take care to set conservative read timeouts. Some API requests can take
@@ -181,53 +209,129 @@ production use, but `debug` is also available for more verbosity.
181
209
  There are a few options for enabling it:
182
210
 
183
211
  1. Set the environment variable `STRIPE_LOG` to the value `debug` or `info`:
184
- ```
212
+
213
+ ```sh
185
214
  $ export STRIPE_LOG=info
186
215
  ```
187
216
 
188
217
  2. Set `Stripe.log_level`:
189
- ``` ruby
218
+
219
+ ```ruby
190
220
  Stripe.log_level = Stripe::LEVEL_INFO
191
221
  ```
192
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
+
256
+ #### Example
257
+
258
+ For example:
259
+
260
+ ```ruby
261
+ Stripe::Instrumentation.subscribe(:request_end) do |request_event|
262
+ tags = {
263
+ method: request_event.method,
264
+ resource: request_event.path.split('/')[2],
265
+ code: request_event.http_status,
266
+ retries: request_event.num_retries
267
+ }
268
+ StatsD.distribution('stripe_request', request_event.duration, tags: tags)
269
+ end
270
+ ```
271
+
193
272
  ### Writing a Plugin
194
273
 
195
274
  If you're writing a plugin that uses the library, we'd appreciate it if you
196
275
  identified using `#set_app_info`:
197
276
 
198
- Stripe.set_app_info("MyAwesomePlugin", version: "1.2.34", url: "https://myawesomeplugin.info");
277
+ ```ruby
278
+ Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesomeplugin.info')
279
+ ```
199
280
 
200
281
  This information is passed along when the library makes calls to the Stripe
201
282
  API.
202
283
 
284
+ ### Request latency telemetry
285
+
286
+ By default, the library sends request latency telemetry to Stripe. These
287
+ numbers help Stripe improve the overall latency of its API for all users.
288
+
289
+ You can disable this behavior if you prefer:
290
+
291
+ ```ruby
292
+ Stripe.enable_telemetry = false
293
+ ```
294
+
203
295
  ## Development
204
296
 
205
297
  The test suite depends on [stripe-mock], so make sure to fetch and run it from a
206
298
  background terminal ([stripe-mock's README][stripe-mock] also contains
207
299
  instructions for installing via Homebrew and other methods):
208
300
 
209
- go get -u github.com/stripe/stripe-mock
210
- stripe-mock
301
+ ```sh
302
+ go get -u github.com/stripe/stripe-mock
303
+ stripe-mock
304
+ ```
211
305
 
212
306
  Run all tests:
213
307
 
214
- bundle exec rake test
308
+ ```sh
309
+ bundle exec rake test
310
+ ```
215
311
 
216
312
  Run a single test suite:
217
313
 
218
- bundle exec ruby -Ilib/ test/stripe/util_test.rb
314
+ ```sh
315
+ bundle exec ruby -Ilib/ test/stripe/util_test.rb
316
+ ```
219
317
 
220
318
  Run a single test:
221
319
 
222
- bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
320
+ ```sh
321
+ bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
322
+ ```
223
323
 
224
324
  Run the linter:
225
325
 
226
- bundle exec rake rubocop
326
+ ```sh
327
+ bundle exec rake rubocop
328
+ ```
227
329
 
228
330
  Update bundled CA certificates from the [Mozilla cURL release][curl]:
229
331
 
230
- bundle exec rake update_certs
332
+ ```sh
333
+ bundle exec rake update_certs
334
+ ```
231
335
 
232
336
  Update the bundled [stripe-mock] by editing the version number found in
233
337
  `.travis.yml`.
@@ -235,10 +339,10 @@ Update the bundled [stripe-mock] by editing the version number found in
235
339
  [api-keys]: https://dashboard.stripe.com/account/apikeys
236
340
  [connect]: https://stripe.com/connect
237
341
  [curl]: http://curl.haxx.se/docs/caextract.html
238
- [faraday]: https://github.com/lostisland/faraday
239
342
  [idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
240
343
  [stripe-mock]: https://github.com/stripe/stripe-mock
241
344
  [versioning]: https://stripe.com/docs/api/ruby#versioning
345
+ [youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M50RmP6ie-gdcSnfOuQCRYk
242
346
 
243
347
  <!--
244
348
  # vim: set tw=79: