stripe 8.6.0.pre.beta.3 → 8.6.0.pre.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/OPENAPI_VERSION +1 -1
  4. data/VERSION +1 -1
  5. data/lib/stripe/api_operations/request.rb +2 -0
  6. data/lib/stripe/api_version.rb +1 -0
  7. data/lib/stripe/resources/account_link.rb +1 -1
  8. data/lib/stripe/resources/account_session.rb +1 -1
  9. data/lib/stripe/resources/application_fee_refund.rb +1 -1
  10. data/lib/stripe/resources/apps/secret.rb +1 -1
  11. data/lib/stripe/resources/balance.rb +1 -1
  12. data/lib/stripe/resources/balance_transaction.rb +1 -1
  13. data/lib/stripe/resources/bank_account.rb +1 -1
  14. data/lib/stripe/resources/capability.rb +1 -1
  15. data/lib/stripe/resources/card.rb +1 -1
  16. data/lib/stripe/resources/charge.rb +1 -1
  17. data/lib/stripe/resources/checkout/session.rb +1 -1
  18. data/lib/stripe/resources/credit_note.rb +1 -1
  19. data/lib/stripe/resources/customer.rb +1 -1
  20. data/lib/stripe/resources/customer_balance_transaction.rb +2 -2
  21. data/lib/stripe/resources/discount.rb +1 -1
  22. data/lib/stripe/resources/dispute.rb +1 -1
  23. data/lib/stripe/resources/file.rb +1 -1
  24. data/lib/stripe/resources/financial_connections/account.rb +36 -0
  25. data/lib/stripe/resources/funding_instructions.rb +1 -1
  26. data/lib/stripe/resources/invoice.rb +1 -1
  27. data/lib/stripe/resources/issuing/authorization.rb +1 -1
  28. data/lib/stripe/resources/issuing/cardholder.rb +1 -1
  29. data/lib/stripe/resources/issuing/dispute.rb +1 -1
  30. data/lib/stripe/resources/issuing/transaction.rb +1 -1
  31. data/lib/stripe/resources/payment_intent.rb +1 -1
  32. data/lib/stripe/resources/payout.rb +1 -1
  33. data/lib/stripe/resources/person.rb +1 -1
  34. data/lib/stripe/resources/radar/early_fraud_warning.rb +1 -1
  35. data/lib/stripe/resources/radar/value_list.rb +1 -1
  36. data/lib/stripe/resources/radar/value_list_item.rb +1 -1
  37. data/lib/stripe/resources/refund.rb +1 -1
  38. data/lib/stripe/resources/reversal.rb +1 -1
  39. data/lib/stripe/resources/setup_intent.rb +1 -1
  40. data/lib/stripe/resources/subscription.rb +1 -1
  41. data/lib/stripe/resources/subscription_schedule.rb +1 -1
  42. data/lib/stripe/resources/tax/calculation.rb +1 -1
  43. data/lib/stripe/resources/tax/registration.rb +3 -1
  44. data/lib/stripe/resources/tax/settings.rb +1 -1
  45. data/lib/stripe/resources/tax/transaction.rb +1 -1
  46. data/lib/stripe/resources/tax_id.rb +1 -1
  47. data/lib/stripe/resources/tax_rate.rb +1 -1
  48. data/lib/stripe/resources/terminal/connection_token.rb +1 -1
  49. data/lib/stripe/resources/terminal/location.rb +1 -1
  50. data/lib/stripe/resources/terminal/reader.rb +1 -1
  51. data/lib/stripe/resources/token.rb +1 -1
  52. data/lib/stripe/resources/topup.rb +1 -1
  53. data/lib/stripe/resources/transfer.rb +1 -1
  54. data/lib/stripe/resources/usage_record.rb +1 -1
  55. data/lib/stripe/resources/webhook_endpoint.rb +1 -1
  56. data/lib/stripe/stripe_client.rb +35 -15
  57. data/lib/stripe/version.rb +1 -1
  58. data/lib/stripe.rb +43 -0
  59. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8329baf2324481281bac8a14057e933252bcc1fccbde79f4303fb1e84d113c9
4
- data.tar.gz: bce0345d4c34fb1b25278e55a5ca31db6303d7b5b69037d05e55b3aa8f68537e
3
+ metadata.gz: 8e7519c6f28a8327b6653a879c443e420d3939b228d3ce7e26d78fb5059d2508
4
+ data.tar.gz: ec5c5dab4ae100c4266cb7f482edb7428498896412ef03a5879e2f53ce86010d
5
5
  SHA512:
6
- metadata.gz: 7055e66eae45c2a9e3cf0d3dd6f65c1da2e7ef6a0189feb9a7cbf04de25b857a37e7888c7cfe8f391004192c9cbce4f3f30ee25236fa2f94bd4b7d4263ae696a
7
- data.tar.gz: 47077ba02bc7c0c73071d92500333e84bce73cae25ea88ec0ff5c47b378bc5b2e0473cb5bc8cdc9d65d9151b6f74f5361df674685af2ce194d452ae0fe6d5df7
6
+ metadata.gz: f96ccd66620b95fc1727bce8d8bab15b5749049e21aa5276f6733c596aea93ab66074d03df67c118ef07cb598f625655fbb513d2288b6a517b300f2fb215aaef
7
+ data.tar.gz: 8163d80485ac0adc4797a52f22c832121cb690e0f7a07f35706be90bd2818be4ad3eb15bb464397defa9cca30b701f7c62d52ca8f48c6055eff3778bf29b4406
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.6.0-beta.4 - 2023-05-19
4
+ * [#1220](https://github.com/stripe/stripe-ruby/pull/1220) Update generated code for beta
5
+ * Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
6
+ * [#1217](https://github.com/stripe/stripe-ruby/pull/1217) Add raw_request
7
+ * [#1216](https://github.com/stripe/stripe-ruby/pull/1216) Update generated code for beta
8
+ * [#1214](https://github.com/stripe/stripe-ruby/pull/1214) Update generated code for beta
9
+
10
+
3
11
  ## 8.6.0-beta.3 - 2023-04-17
4
12
  * [#1211](https://github.com/stripe/stripe-ruby/pull/1211) Update generated code for beta
5
13
  * [#1210](https://github.com/stripe/stripe-ruby/pull/1210), [#1212](https://github.com/stripe/stripe-ruby/pull/1212), [#1213](https://github.com/stripe/stripe-ruby/pull/1213) Add support for request signing
data/OPENAPI_VERSION CHANGED
@@ -1 +1 @@
1
- v299
1
+ v351
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.6.0-beta.3
1
+ 8.6.0-beta.4
@@ -47,6 +47,7 @@ module Stripe
47
47
  api_key = headers.delete(:api_key)
48
48
  api_base = headers.delete(:api_base)
49
49
  client = headers.delete(:client)
50
+ api_mode = headers.delete(:api_mode)
50
51
  # Assume all remaining opts must be headers
51
52
 
52
53
  resp, opts[:api_key] = client.send(
@@ -54,6 +55,7 @@ module Stripe
54
55
  method, url,
55
56
  api_base: api_base, api_key: api_key,
56
57
  headers: headers, params: params,
58
+ api_mode: api_mode,
57
59
  &read_body_chunk_block
58
60
  )
59
61
 
@@ -4,5 +4,6 @@
4
4
  module Stripe
5
5
  module ApiVersion
6
6
  CURRENT = "2022-11-15"
7
+ PREVIEW = "2023-05-16.preview-v2"
7
8
  end
8
9
  end
@@ -5,7 +5,7 @@ module Stripe
5
5
  # Account Links are the means by which a Connect platform grants a connected account permission to access
6
6
  # Stripe-hosted applications, such as Connect Onboarding.
7
7
  #
8
- # Related guide: [Connect Onboarding](https://stripe.com/docs/connect/connect-onboarding).
8
+ # Related guide: [Connect Onboarding](https://stripe.com/docs/connect/connect-onboarding)
9
9
  class AccountLink < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
 
@@ -8,7 +8,7 @@ module Stripe
8
8
  # to your user. Do not save AccountSessions to your database as they expire relatively
9
9
  # quickly, and cannot be used more than once.
10
10
  #
11
- # Related guide: [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components).
11
+ # Related guide: [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components)
12
12
  class AccountSession < APIResource
13
13
  extend Stripe::APIOperations::Create
14
14
 
@@ -6,7 +6,7 @@ module Stripe
6
6
  # has previously been created but not yet refunded. Funds will be refunded to
7
7
  # the Stripe account from which the fee was originally collected.
8
8
  #
9
- # Related guide: [Refunding Application Fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee).
9
+ # Related guide: [Refunding application fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee)
10
10
  class ApplicationFeeRefund < APIResource
11
11
  extend Stripe::APIOperations::List
12
12
  include Stripe::APIOperations::Save
@@ -11,7 +11,7 @@ module Stripe
11
11
  #
12
12
  # A `user` scoped secret is accessible by the app backend and one specific Dashboard user. Use the `user` scope for per-user secrets like per-user OAuth tokens, where different users might have different permissions.
13
13
  #
14
- # Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects).
14
+ # Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects)
15
15
  class Secret < APIResource
16
16
  extend Stripe::APIOperations::Create
17
17
  extend Stripe::APIOperations::List
@@ -12,7 +12,7 @@ module Stripe
12
12
  # The available and pending amounts for each currency are broken down further by
13
13
  # payment source types.
14
14
  #
15
- # Related guide: [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances).
15
+ # Related guide: [Understanding Connect account balances](https://stripe.com/docs/connect/account-balances)
16
16
  class Balance < SingletonAPIResource
17
17
  OBJECT_NAME = "balance"
18
18
  end
@@ -5,7 +5,7 @@ module Stripe
5
5
  # Balance transactions represent funds moving through your Stripe account.
6
6
  # They're created for every type of transaction that comes into or flows out of your Stripe account balance.
7
7
  #
8
- # Related guide: [Balance Transaction Types](https://stripe.com/docs/reports/balance-transaction-types).
8
+ # Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types)
9
9
  class BalanceTransaction < APIResource
10
10
  extend Stripe::APIOperations::List
11
11
 
@@ -8,7 +8,7 @@ module Stripe
8
8
  # destinations on `Account` objects for [Custom accounts](https://stripe.com/docs/connect/custom-accounts).
9
9
  # They can be bank accounts or debit cards as well, and are documented in the links above.
10
10
  #
11
- # Related guide: [Bank Debits and Transfers](https://stripe.com/docs/payments/bank-debits-transfers).
11
+ # Related guide: [Bank debits and transfers](https://stripe.com/docs/payments/bank-debits-transfers)
12
12
  class BankAccount < APIResource
13
13
  include Stripe::APIOperations::Delete
14
14
  extend Stripe::APIOperations::List
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  # This is an object representing a capability for a Stripe account.
6
6
  #
7
- # Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities).
7
+ # Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities)
8
8
  class Capability < APIResource
9
9
  extend Stripe::APIOperations::List
10
10
  include Stripe::APIOperations::Save
@@ -6,7 +6,7 @@ module Stripe
6
6
  # later. You can also store multiple debit cards on a recipient in order to
7
7
  # transfer to those cards later.
8
8
  #
9
- # Related guide: [Card Payments with Sources](https://stripe.com/docs/sources/cards).
9
+ # Related guide: [Card payments with Sources](https://stripe.com/docs/sources/cards)
10
10
  class Card < APIResource
11
11
  include Stripe::APIOperations::Delete
12
12
  extend Stripe::APIOperations::List
@@ -6,7 +6,7 @@ module Stripe
6
6
  # retrieve and refund individual charges as well as list all charges. Charges
7
7
  # are identified by a unique, random ID.
8
8
  #
9
- # Related guide: [Accept a payment with the Charges API](https://stripe.com/docs/payments/accept-a-payment-charges).
9
+ # Related guide: [Accept a payment with the Charges API](https://stripe.com/docs/payments/accept-a-payment-charges)
10
10
  class Charge < APIResource
11
11
  extend Stripe::APIOperations::Create
12
12
  extend Stripe::APIOperations::List
@@ -16,7 +16,7 @@ module Stripe
16
16
  # You can create a Checkout Session on your server and redirect to its URL
17
17
  # to begin Checkout.
18
18
  #
19
- # Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart).
19
+ # Related guide: [Checkout quickstart](https://stripe.com/docs/checkout/quickstart)
20
20
  class Session < APIResource
21
21
  extend Stripe::APIOperations::Create
22
22
  extend Stripe::APIOperations::List
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  # Issue a credit note to adjust an invoice's amount after the invoice is finalized.
6
6
  #
7
- # Related guide: [Credit Notes](https://stripe.com/docs/billing/invoices/credit-notes).
7
+ # Related guide: [Credit notes](https://stripe.com/docs/billing/invoices/credit-notes)
8
8
  class CreditNote < APIResource
9
9
  extend Stripe::APIOperations::Create
10
10
  extend Stripe::APIOperations::List
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  # This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.
6
6
  #
7
- # Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment).
7
+ # Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment)
8
8
  class Customer < APIResource
9
9
  extend Stripe::APIOperations::Create
10
10
  include Stripe::APIOperations::Delete
@@ -2,12 +2,12 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
- # Each customer has a [`balance`](https://stripe.com/docs/api/customers/object#customer_object-balance) value,
5
+ # Each customer has a [Balance](https://stripe.com/docs/api/customers/object#customer_object-balance) value,
6
6
  # which denotes a debit or credit that's automatically applied to their next invoice upon finalization.
7
7
  # You may modify the value directly by using the [update customer API](https://stripe.com/docs/api/customers/update),
8
8
  # or by creating a Customer Balance Transaction, which increments or decrements the customer's `balance` by the specified `amount`.
9
9
  #
10
- # Related guide: [Customer Balance](https://stripe.com/docs/billing/customer/balance) to learn more.
10
+ # Related guide: [Customer balance](https://stripe.com/docs/billing/customer/balance)
11
11
  class CustomerBalanceTransaction < APIResource
12
12
  extend Stripe::APIOperations::List
13
13
  include Stripe::APIOperations::Save
@@ -5,7 +5,7 @@ module Stripe
5
5
  # A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes).
6
6
  # It contains information about when the discount began, when it will end, and what it is applied to.
7
7
  #
8
- # Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
8
+ # Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts)
9
9
  class Discount < StripeObject
10
10
  OBJECT_NAME = "discount"
11
11
  end
@@ -8,7 +8,7 @@ module Stripe
8
8
  # information about the dispute process in our [Disputes and
9
9
  # Fraud](https://stripe.com/docs/disputes) documentation.
10
10
  #
11
- # Related guide: [Disputes and Fraud](https://stripe.com/docs/disputes).
11
+ # Related guide: [Disputes and fraud](https://stripe.com/docs/disputes)
12
12
  class Dispute < APIResource
13
13
  extend Stripe::APIOperations::List
14
14
  include Stripe::APIOperations::Save
@@ -8,7 +8,7 @@ module Stripe
8
8
  # been created by Stripe (for example, the results of a [Sigma scheduled
9
9
  # query](https://stripe.com/docs/api#scheduled_queries)).
10
10
  #
11
- # Related guide: [File Upload Guide](https://stripe.com/docs/file-upload).
11
+ # Related guide: [File upload guide](https://stripe.com/docs/file-upload)
12
12
  class File < APIResource
13
13
  extend Stripe::APIOperations::Create
14
14
  extend Stripe::APIOperations::List
@@ -39,6 +39,24 @@ module Stripe
39
39
  )
40
40
  end
41
41
 
42
+ def subscribe(params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/financial_connections/accounts/%<account>s/subscribe", { account: CGI.escape(self["id"]) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+
51
+ def unsubscribe(params = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(self["id"]) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
59
+
42
60
  def self.disconnect(account, params = {}, opts = {})
43
61
  request_stripe_object(
44
62
  method: :post,
@@ -65,6 +83,24 @@ module Stripe
65
83
  opts: opts
66
84
  )
67
85
  end
86
+
87
+ def self.subscribe(account, params = {}, opts = {})
88
+ request_stripe_object(
89
+ method: :post,
90
+ path: format("/v1/financial_connections/accounts/%<account>s/subscribe", { account: CGI.escape(account) }),
91
+ params: params,
92
+ opts: opts
93
+ )
94
+ end
95
+
96
+ def self.unsubscribe(account, params = {}, opts = {})
97
+ request_stripe_object(
98
+ method: :post,
99
+ path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(account) }),
100
+ params: params,
101
+ opts: opts
102
+ )
103
+ end
68
104
  end
69
105
  end
70
106
  end
@@ -6,7 +6,7 @@ module Stripe
6
6
  # automatically applied to future invoices and payments using the `customer_balance` payment method.
7
7
  # Customers can fund this balance by initiating a bank transfer to any account in the
8
8
  # `financial_addresses` field.
9
- # Related guide: [Customer Balance - Funding Instructions](https://stripe.com/docs/payments/customer-balance/funding-instructions) to learn more
9
+ # Related guide: [Customer balance funding instructions](https://stripe.com/docs/payments/customer-balance/funding-instructions)
10
10
  class FundingInstructions < APIResource
11
11
  OBJECT_NAME = "funding_instructions"
12
12
 
@@ -33,7 +33,7 @@ module Stripe
33
33
  # More details on the customer's credit balance are
34
34
  # [here](https://stripe.com/docs/billing/customer/balance).
35
35
  #
36
- # Related guide: [Send Invoices to Customers](https://stripe.com/docs/billing/invoices/sending).
36
+ # Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)
37
37
  class Invoice < APIResource
38
38
  extend Stripe::APIOperations::Create
39
39
  include Stripe::APIOperations::Delete
@@ -7,7 +7,7 @@ module Stripe
7
7
  # object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the
8
8
  # purchase to be completed successfully.
9
9
  #
10
- # Related guide: [Issued Card Authorizations](https://stripe.com/docs/issuing/purchases/authorizations).
10
+ # Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations)
11
11
  class Authorization < APIResource
12
12
  extend Stripe::APIOperations::List
13
13
  include Stripe::APIOperations::Save
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Issuing
6
6
  # An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards.
7
7
  #
8
- # Related guide: [How to create a Cardholder](https://stripe.com/docs/issuing/cards#create-cardholder)
8
+ # Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder)
9
9
  class Cardholder < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  extend Stripe::APIOperations::List
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Issuing
6
6
  # As a [card issuer](https://stripe.com/docs/issuing), you can dispute transactions that the cardholder does not recognize, suspects to be fraudulent, or has other issues with.
7
7
  #
8
- # Related guide: [Disputing Transactions](https://stripe.com/docs/issuing/purchases/disputes)
8
+ # Related guide: [Issuing disputes](https://stripe.com/docs/issuing/purchases/disputes)
9
9
  class Dispute < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  extend Stripe::APIOperations::List
@@ -7,7 +7,7 @@ module Stripe
7
7
  # your Stripe account, such as a completed purchase or refund, is represented by an Issuing
8
8
  # `Transaction` object.
9
9
  #
10
- # Related guide: [Issued Card Transactions](https://stripe.com/docs/issuing/purchases/transactions).
10
+ # Related guide: [Issued card transactions](https://stripe.com/docs/issuing/purchases/transactions)
11
11
  class Transaction < APIResource
12
12
  extend Stripe::APIOperations::List
13
13
  include Stripe::APIOperations::Save
@@ -12,7 +12,7 @@ module Stripe
12
12
  # throughout its lifetime as it interfaces with Stripe.js to perform
13
13
  # authentication flows and ultimately creates at most one successful charge.
14
14
  #
15
- # Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents).
15
+ # Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents)
16
16
  class PaymentIntent < APIResource
17
17
  extend Stripe::APIOperations::Create
18
18
  extend Stripe::APIOperations::List
@@ -9,7 +9,7 @@ module Stripe
9
9
  # schedules](https://stripe.com/docs/connect/manage-payout-schedule), depending on your country and
10
10
  # industry.
11
11
  #
12
- # Related guide: [Receiving Payouts](https://stripe.com/docs/payouts).
12
+ # Related guide: [Receiving payouts](https://stripe.com/docs/payouts)
13
13
  class Payout < APIResource
14
14
  extend Stripe::APIOperations::Create
15
15
  extend Stripe::APIOperations::List
@@ -7,7 +7,7 @@ module Stripe
7
7
  # A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.
8
8
  # See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform pre-filling and account onboarding steps.
9
9
  #
10
- # Related guide: [Handling Identity Verification with the API](https://stripe.com/docs/connect/identity-verification-api#person-information).
10
+ # Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/identity-verification-api#person-information)
11
11
  class Person < APIResource
12
12
  extend Stripe::APIOperations::List
13
13
  include Stripe::APIOperations::Save
@@ -6,7 +6,7 @@ module Stripe
6
6
  # An early fraud warning indicates that the card issuer has notified us that a
7
7
  # charge may be fraudulent.
8
8
  #
9
- # Related guide: [Early Fraud Warnings](https://stripe.com/docs/disputes/measuring#early-fraud-warnings).
9
+ # Related guide: [Early fraud warnings](https://stripe.com/docs/disputes/measuring#early-fraud-warnings)
10
10
  class EarlyFraudWarning < APIResource
11
11
  extend Stripe::APIOperations::List
12
12
 
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Radar
6
6
  # Value lists allow you to group values together which can then be referenced in rules.
7
7
  #
8
- # Related guide: [Default Stripe Lists](https://stripe.com/docs/radar/lists#managing-list-items).
8
+ # Related guide: [Default Stripe lists](https://stripe.com/docs/radar/lists#managing-list-items)
9
9
  class ValueList < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  include Stripe::APIOperations::Delete
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Radar
6
6
  # Value list items allow you to add specific values to a given Radar value list, which can then be used in rules.
7
7
  #
8
- # Related guide: [Managing List Items](https://stripe.com/docs/radar/lists#managing-list-items).
8
+ # Related guide: [Managing list items](https://stripe.com/docs/radar/lists#managing-list-items)
9
9
  class ValueListItem < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  include Stripe::APIOperations::Delete
@@ -6,7 +6,7 @@ module Stripe
6
6
  # but not yet refunded. Funds will be refunded to the credit or debit card that
7
7
  # was originally charged.
8
8
  #
9
- # Related guide: [Refunds](https://stripe.com/docs/refunds).
9
+ # Related guide: [Refunds](https://stripe.com/docs/refunds)
10
10
  class Refund < APIResource
11
11
  extend Stripe::APIOperations::Create
12
12
  extend Stripe::APIOperations::List
@@ -14,7 +14,7 @@ module Stripe
14
14
  # transfer only if the destination account has enough balance to cover the
15
15
  # reversal.
16
16
  #
17
- # Related guide: [Reversing Transfers](https://stripe.com/docs/connect/charges-transfers#reversing-transfers).
17
+ # Related guide: [Reversing transfers](https://stripe.com/docs/connect/charges-transfers#reversing-transfers)
18
18
  class Reversal < APIResource
19
19
  extend Stripe::APIOperations::List
20
20
  include Stripe::APIOperations::Save
@@ -23,7 +23,7 @@ module Stripe
23
23
  # By using SetupIntents, you ensure that your customers experience the minimum set of required friction,
24
24
  # even as regulations change over time.
25
25
  #
26
- # Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents).
26
+ # Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents)
27
27
  class SetupIntent < APIResource
28
28
  extend Stripe::APIOperations::Create
29
29
  extend Stripe::APIOperations::List
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  # Subscriptions allow you to charge a customer on a recurring basis.
6
6
  #
7
- # Related guide: [Creating Subscriptions](https://stripe.com/docs/billing/subscriptions/creating).
7
+ # Related guide: [Creating subscriptions](https://stripe.com/docs/billing/subscriptions/creating)
8
8
  class Subscription < APIResource
9
9
  extend Stripe::APIOperations::Create
10
10
  extend Stripe::APIOperations::List
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  # A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.
6
6
  #
7
- # Related guide: [Subscription Schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules).
7
+ # Related guide: [Subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules)
8
8
  class SubscriptionSchedule < APIResource
9
9
  extend Stripe::APIOperations::Create
10
10
  extend Stripe::APIOperations::List
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Tax
6
6
  # A Tax Calculation allows you to calculate the tax to collect from your customer.
7
7
  #
8
- # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom).
8
+ # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom)
9
9
  class Calculation < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
 
@@ -5,7 +5,9 @@ module Stripe
5
5
  module Tax
6
6
  # A Tax `Registration` lets us know that your business is registered to collect tax on payments within a region, enabling you to [automatically collect tax](https://stripe.com/docs/tax).
7
7
  #
8
- # Stripe will not register on your behalf with the relevant authorities when you create a Tax `Registration` object. For more information on how to register to collect tax, see [our guide](https://stripe.com/docs/tax/registering).
8
+ # Stripe doesn't register on your behalf with the relevant authorities when you create a Tax `Registration` object. For more information on how to register to collect tax, see [our guide](https://stripe.com/docs/tax/registering).
9
+ #
10
+ # Related guide: [Using the Registrations API](https://stripe.com/docs/tax/registrations-api)
9
11
  class Registration < APIResource
10
12
  extend Stripe::APIOperations::Create
11
13
  extend Stripe::APIOperations::List
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Tax
6
6
  # You can use Tax `Settings` to manage configurations used by Stripe Tax calculations.
7
7
  #
8
- # Related guide: [Account settings](https://stripe.com/docs/tax/connect/settings).
8
+ # Related guide: [Using the Settings API](https://stripe.com/docs/tax/settings-api)
9
9
  class Settings < SingletonAPIResource
10
10
  include Stripe::APIOperations::Save
11
11
 
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Tax
6
6
  # A Tax Transaction records the tax collected from or refunded to your customer.
7
7
  #
8
- # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom#tax-transaction).
8
+ # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom#tax-transaction)
9
9
  class Transaction < APIResource
10
10
  OBJECT_NAME = "tax.transaction"
11
11
 
@@ -5,7 +5,7 @@ module Stripe
5
5
  # You can add one or multiple tax IDs to a [customer](https://stripe.com/docs/api/customers).
6
6
  # A customer's tax IDs are displayed on invoices and credit notes issued for the customer.
7
7
  #
8
- # Related guide: [Customer Tax Identification Numbers](https://stripe.com/docs/billing/taxes/tax-ids).
8
+ # Related guide: [Customer tax identification numbers](https://stripe.com/docs/billing/taxes/tax-ids)
9
9
  class TaxId < APIResource
10
10
  include Stripe::APIOperations::Delete
11
11
  extend Stripe::APIOperations::List
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  # Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.
6
6
  #
7
- # Related guide: [Tax Rates](https://stripe.com/docs/billing/taxes/tax-rates).
7
+ # Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates)
8
8
  class TaxRate < APIResource
9
9
  extend Stripe::APIOperations::Create
10
10
  extend Stripe::APIOperations::List
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Terminal
6
6
  # A Connection Token is used by the Stripe Terminal SDK to connect to a reader.
7
7
  #
8
- # Related guide: [Fleet Management](https://stripe.com/docs/terminal/fleet/locations).
8
+ # Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations)
9
9
  class ConnectionToken < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
 
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Terminal
6
6
  # A Location represents a grouping of readers.
7
7
  #
8
- # Related guide: [Fleet Management](https://stripe.com/docs/terminal/fleet/locations).
8
+ # Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations)
9
9
  class Location < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  include Stripe::APIOperations::Delete
@@ -5,7 +5,7 @@ module Stripe
5
5
  module Terminal
6
6
  # A Reader represents a physical device for accepting payment details.
7
7
  #
8
- # Related guide: [Connecting to a Reader](https://stripe.com/docs/terminal/payments/connect-reader).
8
+ # Related guide: [Connecting to a reader](https://stripe.com/docs/terminal/payments/connect-reader)
9
9
  class Reader < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  include Stripe::APIOperations::Delete
@@ -23,7 +23,7 @@ module Stripe
23
23
  # [Radar](https://stripe.com/docs/radar), our integrated solution for automatic fraud protection,
24
24
  # performs best with integrations that use client-side tokenization.
25
25
  #
26
- # Related guide: [Accept a payment](https://stripe.com/docs/payments/accept-a-payment-charges#web-create-token)
26
+ # Related guide: [Accept a payment with Charges and Tokens](https://stripe.com/docs/payments/accept-a-payment-charges#web-create-token)
27
27
  class Token < APIResource
28
28
  extend Stripe::APIOperations::Create
29
29
 
@@ -6,7 +6,7 @@ module Stripe
6
6
  # individual top-ups, as well as list all top-ups. Top-ups are identified by a
7
7
  # unique, random ID.
8
8
  #
9
- # Related guide: [Topping Up your Platform Account](https://stripe.com/docs/connect/top-ups).
9
+ # Related guide: [Topping up your platform account](https://stripe.com/docs/connect/top-ups)
10
10
  class Topup < APIResource
11
11
  extend Stripe::APIOperations::Create
12
12
  extend Stripe::APIOperations::List
@@ -11,7 +11,7 @@ module Stripe
11
11
  # information, read about the
12
12
  # [transfer/payout split](https://stripe.com/docs/transfer-payout-split).
13
13
  #
14
- # Related guide: [Creating Separate Charges and Transfers](https://stripe.com/docs/connect/charges-transfers).
14
+ # Related guide: [Creating separate charges and transfers](https://stripe.com/docs/connect/charges-transfers)
15
15
  class Transfer < APIResource
16
16
  extend Stripe::APIOperations::Create
17
17
  extend Stripe::APIOperations::List
@@ -5,7 +5,7 @@ module Stripe
5
5
  # Usage records allow you to report customer usage and metrics to Stripe for
6
6
  # metered billing of subscription prices.
7
7
  #
8
- # Related guide: [Metered Billing](https://stripe.com/docs/billing/subscriptions/metered-billing).
8
+ # Related guide: [Metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing)
9
9
  class UsageRecord < APIResource
10
10
  OBJECT_NAME = "usage_record"
11
11
  end
@@ -8,7 +8,7 @@ module Stripe
8
8
  #
9
9
  # Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.
10
10
  #
11
- # Related guide: [Setting up Webhooks](https://stripe.com/docs/webhooks/configure).
11
+ # Related guide: [Setting up webhooks](https://stripe.com/docs/webhooks/configure)
12
12
  class WebhookEndpoint < APIResource
13
13
  extend Stripe::APIOperations::Create
14
14
  include Stripe::APIOperations::Delete
@@ -212,9 +212,10 @@ module Stripe
212
212
  end
213
213
 
214
214
  def execute_request(method, path,
215
- api_base: nil, api_key: nil, headers: {}, params: {})
215
+ api_base: nil, api_key: nil,
216
+ headers: {}, params: {}, api_mode: nil)
216
217
  http_resp, api_key = execute_request_internal(
217
- method, path, api_base, api_key, headers, params
218
+ method, path, api_base, api_key, headers, params, api_mode
218
219
  )
219
220
 
220
221
  begin
@@ -245,6 +246,7 @@ module Stripe
245
246
  def execute_request_stream(method, path,
246
247
  api_base: nil, api_key: nil,
247
248
  headers: {}, params: {},
249
+ api_mode: nil,
248
250
  &read_body_chunk_block)
249
251
  unless block_given?
250
252
  raise ArgumentError,
@@ -252,7 +254,8 @@ module Stripe
252
254
  end
253
255
 
254
256
  http_resp, api_key = execute_request_internal(
255
- method, path, api_base, api_key, headers, params, &read_body_chunk_block
257
+ method, path, api_base, api_key,
258
+ headers, params, api_mode, &read_body_chunk_block
256
259
  )
257
260
 
258
261
  # When the read_body_chunk_block is given, we no longer have access to the
@@ -432,7 +435,7 @@ module Stripe
432
435
 
433
436
  private def execute_request_internal(method, path,
434
437
  api_base, api_key, headers, params,
435
- &read_body_chunk_block)
438
+ api_mode, &read_body_chunk_block)
436
439
  raise ArgumentError, "method should be a symbol" \
437
440
  unless method.is_a?(Symbol)
438
441
  raise ArgumentError, "path should be a string" \
@@ -456,8 +459,9 @@ module Stripe
456
459
 
457
460
  query_params, path = merge_query_params(query_params, path)
458
461
 
459
- headers = request_headers(api_key, method)
462
+ headers = request_headers(api_key, method, api_mode)
460
463
  .update(Util.normalize_headers(headers))
464
+
461
465
  url = api_url(path, api_base)
462
466
 
463
467
  # Merge given query parameters with any already encoded in the path.
@@ -468,7 +472,7 @@ module Stripe
468
472
  # a log-friendly variant of the encoded form. File objects are displayed
469
473
  # as such instead of as their file contents.
470
474
  body, body_log =
471
- body_params ? encode_body(body_params, headers) : [nil, nil]
475
+ body_params ? encode_body(body_params, headers, api_mode) : [nil, nil]
472
476
 
473
477
  authenticator.authenticate(method, headers, body) unless api_key
474
478
 
@@ -544,7 +548,7 @@ module Stripe
544
548
  # Encodes a set of body parameters using multipart if `Content-Type` is set
545
549
  # for that, or standard form-encoding otherwise. Returns the encoded body
546
550
  # and a version of the encoded body that's safe to be logged.
547
- private def encode_body(body_params, headers)
551
+ private def encode_body(body_params, headers, api_mode)
548
552
  body = nil
549
553
  flattened_params = Util.flatten_params(body_params)
550
554
 
@@ -560,15 +564,22 @@ module Stripe
560
564
  flattened_params =
561
565
  flattened_params.map { |k, v| [k, v.is_a?(String) ? v : v.to_s] }.to_h
562
566
 
567
+ elsif api_mode == :preview
568
+ body = JSON.generate(body_params)
569
+ headers["Content-Type"] = "application/json"
563
570
  else
564
571
  body = Util.encode_parameters(body_params)
565
572
  end
566
573
 
567
- # We don't use `Util.encode_parameters` partly as an optimization (to not
568
- # redo work we've already done), and partly because the encoded forms of
569
- # certain characters introduce a lot of visual noise and it's nice to
570
- # have a clearer format for logs.
571
- body_log = flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
574
+ if api_mode == :preview
575
+ body_log = body
576
+ else
577
+ # We don't use `Util.encode_parameters` partly as an optimization (to
578
+ # not redo work we've already done), and partly because the encoded
579
+ # forms of certain characters introduce a lot of visual noise and it's
580
+ # nice to have a clearer format for logs.
581
+ body_log = flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
582
+ end
572
583
 
573
584
  [body, body_log]
574
585
  end
@@ -868,7 +879,7 @@ module Stripe
868
879
  message + "\n\n(Network error: #{error.message})"
869
880
  end
870
881
 
871
- private def request_headers(api_key, method)
882
+ private def request_headers(api_key, method, api_mode)
872
883
  user_agent = "Stripe/v1 RubyBindings/#{Stripe::VERSION}"
873
884
  unless Stripe.app_info.nil?
874
885
  user_agent += " " + format_app_info(Stripe.app_info)
@@ -877,9 +888,13 @@ module Stripe
877
888
  headers = {
878
889
  "User-Agent" => user_agent,
879
890
  "Authorization" => "Bearer #{api_key}",
880
- "Content-Type" => "application/x-www-form-urlencoded",
881
891
  }
882
892
 
893
+ if api_mode != :preview
894
+ # TODO: (major) don't set Content-Type if method is not post
895
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
896
+ end
897
+
883
898
  if config.enable_telemetry? && !@last_request_metrics.nil?
884
899
  headers["X-Stripe-Client-Telemetry"] = JSON.generate(
885
900
  last_request_metrics: @last_request_metrics.payload
@@ -892,7 +907,12 @@ module Stripe
892
907
  headers["Idempotency-Key"] ||= SecureRandom.uuid
893
908
  end
894
909
 
895
- headers["Stripe-Version"] = config.api_version if config.api_version
910
+ if api_mode == :preview
911
+ headers["Stripe-Version"] = ApiVersion::PREVIEW
912
+ elsif config.api_version
913
+ headers["Stripe-Version"] = config.api_version
914
+ end
915
+
896
916
  headers["Stripe-Account"] = config.stripe_account if config.stripe_account
897
917
 
898
918
  user_agent = @system_profiler.user_agent
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "8.6.0-beta.3"
4
+ VERSION = "8.6.0-beta.4"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -119,6 +119,49 @@ module Stripe
119
119
  version: version,
120
120
  }
121
121
  end
122
+
123
+ class Preview
124
+ def self._get_default_opts(opts)
125
+ { api_mode: :preview }.merge(opts)
126
+ end
127
+
128
+ def self.get(url, opts = {})
129
+ Stripe.raw_request(:get, url, {}, _get_default_opts(opts))
130
+ end
131
+
132
+ def self.post(url, params = {}, opts = {})
133
+ Stripe.raw_request(:post, url, params, _get_default_opts(opts))
134
+ end
135
+
136
+ def self.delete(url, opts = {})
137
+ Stripe.raw_request(:delete, url, {}, _get_default_opts(opts))
138
+ end
139
+ end
140
+
141
+ class RawRequest
142
+ include Stripe::APIOperations::Request
143
+
144
+ def initialize
145
+ @opts = {}
146
+ end
147
+
148
+ def execute(method, url, params = {}, opts = {})
149
+ resp, = execute_resource_request(method, url, params, opts)
150
+
151
+ resp
152
+ end
153
+ end
154
+
155
+ # Sends a request to Stripe REST API
156
+ def self.raw_request(method, url, params = {}, opts = {})
157
+ req = RawRequest.new
158
+ req.execute(method, url, params, opts)
159
+ end
160
+
161
+ def self.deserialize(data)
162
+ data = JSON.parse(data) if data.is_a?(String)
163
+ Util.convert_to_stripe_object(data, {})
164
+ end
122
165
  end
123
166
 
124
167
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.6.0.pre.beta.3
4
+ version: 8.6.0.pre.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2023-05-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.