Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #1441

Merged
merged 19 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 12.5.0 - 2024-08-08
* [#1440](https://github.com/stripe/stripe-ruby/pull/1440) Update generated code
* Add support for new resources `Billing.AlertTriggered` and `Billing.Alert`
* Add support for `activate`, `archive`, `create`, `deactivate`, `list`, and `retrieve` methods on resource `Alert`
* Add support for `retrieve` method on resource `Tax.Calculation`

## 12.5.0-beta.2 - 2024-08-01
* [#1439](https://github.com/stripe/stripe-ruby/pull/1439) Update generated code for beta
* Add support for `attach_payment` method on resource `Invoice`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1165
v1247
2 changes: 1 addition & 1 deletion lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
module Stripe
module ApiVersion
CURRENT = "2024-06-20"
PREVIEW = "2024-07-16.preview-v2"
PREVIEW = "2024-09-05.preview-v2"
end
end
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def self.object_names_to_classes
Terminal::ConnectionToken.object_name => Terminal::ConnectionToken,
Terminal::Location.object_name => Terminal::Location,
Terminal::Reader.object_name => Terminal::Reader,
Terminal::ReaderCollectedData.object_name => Terminal::ReaderCollectedData,
TestHelpers::TestClock.object_name => TestHelpers::TestClock,
Token.object_name => Token,
Topup.object_name => Topup,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
require "stripe/resources/terminal/connection_token"
require "stripe/resources/terminal/location"
require "stripe/resources/terminal/reader"
require "stripe/resources/terminal/reader_collected_data"
require "stripe/resources/test_helpers/test_clock"
require "stripe/resources/token"
require "stripe/resources/topup"
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def self.create(params = {}, opts = {})
#
# Test-mode accounts can be deleted at any time.
#
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balanace_object) are zero.
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balance_object) are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def self.delete(id, params = {}, opts = {})
Expand All @@ -64,7 +64,7 @@ def self.delete(id, params = {}, opts = {})
#
# Test-mode accounts can be deleted at any time.
#
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balanace_object) are zero.
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balance_object) are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def delete(params = {}, opts = {})
Expand Down
4 changes: 4 additions & 0 deletions lib/stripe/resources/customer_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
module Stripe
# A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access
# control over a Customer.
#
# Related guides: [Customer Session with the Payment Element](https://stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#save-payment-methods),
# [Customer Session with the Pricing Table](https://stripe.com/payments/checkout/pricing-table#customer-session),
# [Customer Session with the Buy Button](https://stripe.com/payment-links/buy-button#pass-an-existing-customer).
class CustomerSession < APIResource
extend Stripe::APIOperations::Create

Expand Down
30 changes: 17 additions & 13 deletions lib/stripe/resources/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ def self.object_name
"file"
end

# To upload a file to Stripe, you need to send a request of type multipart/form-data. Include the file you want to upload in the request, and the parameters for creating a file.
#
# All of Stripe's officially supported Client libraries support sending multipart/form-data.
def self.create(params = {}, opts = {})
config = opts[:client]&.config || Stripe.config
upload_base = config.uploads_base
opts = { api_base: upload_base }.merge(Util.normalize_opts(opts))

if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
raise ArgumentError, "file must respond to `#read`"
end

opts = { content_type: MultipartEncoder::MULTIPART_FORM_DATA }.merge(Util.normalize_opts(opts))

request_stripe_object(method: :post, path: "/v1/files", params: params, opts: opts)
end

# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
Expand All @@ -35,18 +52,5 @@ def self.object_name_alt
def self.resource_url
"/v1/files"
end

def self.create(params = {}, opts = {})
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
raise ArgumentError, "file must respond to `#read`"
end

config = opts[:client]&.config || Stripe.config
opts = {
api_base: config.uploads_base,
content_type: MultipartEncoder::MULTIPART_FORM_DATA,
}.merge(Util.normalize_opts(opts))
super
end
end
end
3 changes: 3 additions & 0 deletions lib/stripe/resources/invoice_line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

module Stripe
# Invoice Line Items represent the individual lines within an [invoice](https://stripe.com/docs/api/invoices) and only exist within the context of an invoice.
#
# Each line item is backed by either an [invoice item](https://stripe.com/docs/api/invoiceitems) or a [subscription item](https://stripe.com/docs/api/subscription_items).
class InvoiceLineItem < StripeObject
include Stripe::APIOperations::Save

Expand Down
6 changes: 6 additions & 0 deletions lib/stripe/resources/payment_intent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def self.capture(intent, params = {}, opts = {})
# after those actions are completed. Your server needs to then
# explicitly re-confirm the PaymentIntent to initiate the next payment
# attempt.
# There is a variable upper limit on how many times a PaymentIntent can be confirmed.
# After this limit is reached, any further calls to this endpoint will
# transition the PaymentIntent to the canceled state.
def confirm(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down Expand Up @@ -153,6 +156,9 @@ def confirm(params = {}, opts = {})
# after those actions are completed. Your server needs to then
# explicitly re-confirm the PaymentIntent to initiate the next payment
# attempt.
# There is a variable upper limit on how many times a PaymentIntent can be confirmed.
# After this limit is reached, any further calls to this endpoint will
# transition the PaymentIntent to the canceled state.
def self.confirm(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/resources/quote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def self.mark_stale(quote, params = {}, opts = {})
)
end

# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf)
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
def pdf(params = {}, opts = {}, &read_body_chunk_block)
config = opts[:client]&.config || Stripe.config
opts = { api_base: config.uploads_base }.merge(opts)
Expand All @@ -221,7 +221,7 @@ def pdf(params = {}, opts = {}, &read_body_chunk_block)
)
end

# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf)
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
config = opts[:client]&.config || Stripe.config
opts = { api_base: config.uploads_base }.merge(opts)
Expand Down
14 changes: 14 additions & 0 deletions lib/stripe/resources/terminal/reader_collected_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Terminal
# Returns data collected by Terminal readers. This data is only stored for 24 hours.
class ReaderCollectedData < APIResource
OBJECT_NAME = "terminal.reader_collected_data"
def self.object_name
"terminal.reader_collected_data"
end
end
end
end
4 changes: 3 additions & 1 deletion lib/stripe/resources/treasury/inbound_transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

module Stripe
module Treasury
# Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
# Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
#
# Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers)
class InboundTransfer < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
4 changes: 3 additions & 1 deletion lib/stripe/resources/treasury/outbound_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

module Stripe
module Treasury
# Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
# Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
#
# Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
#
# Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments)
class OutboundPayment < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
4 changes: 3 additions & 1 deletion lib/stripe/resources/treasury/outbound_transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

module Stripe
module Treasury
# Use OutboundTransfers to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
# Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
#
# Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects.
#
# Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers)
class OutboundTransfer < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
Loading