From d478ba66794420a53badcb9dc97f2eeaaef3cdf0 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:51:59 -0700 Subject: [PATCH] Update generated code (#1369) * Update generated code for v897 * Update generated code for v898 * Update generated code for v901 * Update generated code for v905 * Update generated code for v908 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- lib/stripe/object_types.rb | 4 + lib/stripe/resources.rb | 4 + lib/stripe/resources/billing/meter.rb | 83 +++++++++++++++++++ lib/stripe/resources/billing/meter_event.rb | 27 ++++++ .../billing/meter_event_adjustment.rb | 26 ++++++ .../resources/billing/meter_event_summary.rb | 15 ++++ lib/stripe/resources/confirmation_token.rb | 4 +- lib/stripe/resources/forwarding/request.rb | 2 + lib/stripe/resources/invoice.rb | 4 + lib/stripe/resources/quote.rb | 4 +- 11 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 lib/stripe/resources/billing/meter.rb create mode 100644 lib/stripe/resources/billing/meter_event.rb create mode 100644 lib/stripe/resources/billing/meter_event_adjustment.rb create mode 100644 lib/stripe/resources/billing/meter_event_summary.rb diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 6f4327e8..71e11743 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v889 \ No newline at end of file +v908 \ No newline at end of file diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 6df8d8b8..28e62f8c 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -23,6 +23,10 @@ module Stripe Balance.object_name => Balance, BalanceTransaction.object_name => BalanceTransaction, BankAccount.object_name => BankAccount, + Billing::Meter.object_name => Billing::Meter, + Billing::MeterEvent.object_name => Billing::MeterEvent, + Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment, + Billing::MeterEventSummary.object_name => Billing::MeterEventSummary, BillingPortal::Configuration.object_name => BillingPortal::Configuration, BillingPortal::Session.object_name => BillingPortal::Session, Capability.object_name => Capability, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 918b2990..06f388c4 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -11,6 +11,10 @@ require "stripe/resources/apps/secret" require "stripe/resources/balance" require "stripe/resources/balance_transaction" require "stripe/resources/bank_account" +require "stripe/resources/billing/meter" +require "stripe/resources/billing/meter_event" +require "stripe/resources/billing/meter_event_adjustment" +require "stripe/resources/billing/meter_event_summary" require "stripe/resources/billing_portal/configuration" require "stripe/resources/billing_portal/session" require "stripe/resources/capability" diff --git a/lib/stripe/resources/billing/meter.rb b/lib/stripe/resources/billing/meter.rb new file mode 100644 index 00000000..49bcf2e0 --- /dev/null +++ b/lib/stripe/resources/billing/meter.rb @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Billing + # A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then use the billing meter to charge the user for the number of API calls they make. + class Meter < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + extend Stripe::APIOperations::NestedResource + include Stripe::APIOperations::Save + + OBJECT_NAME = "billing.meter" + def self.object_name + "billing.meter" + end + + nested_resource_class_methods :event_summary, + operations: %i[list], + resource_plural: "event_summaries" + + # Creates a billing meter + def self.create(params = {}, opts = {}) + request_stripe_object(method: :post, path: "/v1/billing/meters", params: params, opts: opts) + end + + # Deactivates a billing meter + def deactivate(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/billing/meters/%s/deactivate", { id: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Deactivates a billing meter + def self.deactivate(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/billing/meters/%s/deactivate", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + + # Retrieve a list of billing meters. + def self.list(filters = {}, opts = {}) + request_stripe_object(method: :get, path: "/v1/billing/meters", params: filters, opts: opts) + end + + # Reactivates a billing meter + def reactivate(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/billing/meters/%s/reactivate", { id: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Reactivates a billing meter + def self.reactivate(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/billing/meters/%s/reactivate", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + + # Updates a billing meter + def self.update(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/billing/meters/%s", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + end + end +end diff --git a/lib/stripe/resources/billing/meter_event.rb b/lib/stripe/resources/billing/meter_event.rb new file mode 100644 index 00000000..53190ce8 --- /dev/null +++ b/lib/stripe/resources/billing/meter_event.rb @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Billing + # A billing meter event represents a customer's usage of a product. Meter events are used to bill a customer based on their usage. + # Meter events are associated with billing meters, which define the shape of the event's payload and how those events are aggregated for billing. + class MeterEvent < APIResource + extend Stripe::APIOperations::Create + + OBJECT_NAME = "billing.meter_event" + def self.object_name + "billing.meter_event" + end + + # Creates a billing meter event + def self.create(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: "/v1/billing/meter_events", + params: params, + opts: opts + ) + end + end + end +end diff --git a/lib/stripe/resources/billing/meter_event_adjustment.rb b/lib/stripe/resources/billing/meter_event_adjustment.rb new file mode 100644 index 00000000..1da80385 --- /dev/null +++ b/lib/stripe/resources/billing/meter_event_adjustment.rb @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Billing + # A billing meter event adjustment represents the status of a meter event adjustment. + class MeterEventAdjustment < APIResource + extend Stripe::APIOperations::Create + + OBJECT_NAME = "billing.meter_event_adjustment" + def self.object_name + "billing.meter_event_adjustment" + end + + # Creates a billing meter event adjustment + def self.create(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: "/v1/billing/meter_event_adjustments", + params: params, + opts: opts + ) + end + end + end +end diff --git a/lib/stripe/resources/billing/meter_event_summary.rb b/lib/stripe/resources/billing/meter_event_summary.rb new file mode 100644 index 00000000..0fb71afd --- /dev/null +++ b/lib/stripe/resources/billing/meter_event_summary.rb @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Billing + # A billing meter event summary represents an aggregated view of a customer's billing meter events within a specified timeframe. It indicates how much + # usage was accrued by a customer for that period. + class MeterEventSummary < APIResource + OBJECT_NAME = "billing.meter_event_summary" + def self.object_name + "billing.meter_event_summary" + end + end + end +end diff --git a/lib/stripe/resources/confirmation_token.rb b/lib/stripe/resources/confirmation_token.rb index 8dcdcfd4..bfda75f7 100644 --- a/lib/stripe/resources/confirmation_token.rb +++ b/lib/stripe/resources/confirmation_token.rb @@ -6,7 +6,9 @@ module Stripe # to your server for confirming a PaymentIntent or SetupIntent. If the confirmation # is successful, values present on the ConfirmationToken are written onto the Intent. # - # To learn more or request access, visit the related guided: [Finalize payments on the server using Confirmation Tokens](https://stripe.com/docs/payments/finalize-payments-on-the-server-confirmation-tokens). + # To learn more about how to use ConfirmationToken, visit the related guides: + # - [Finalize payments on the server](https://stripe.com/docs/payments/finalize-payments-on-the-server) + # - [Build two-step confirmation](https://stripe.com/docs/payments/build-a-two-step-confirmation). class ConfirmationToken < APIResource OBJECT_NAME = "confirmation_token" def self.object_name diff --git a/lib/stripe/resources/forwarding/request.rb b/lib/stripe/resources/forwarding/request.rb index 48a8b41d..d9201e59 100644 --- a/lib/stripe/resources/forwarding/request.rb +++ b/lib/stripe/resources/forwarding/request.rb @@ -17,6 +17,8 @@ module Stripe # # Forwarding Requests are synchronous requests that return a response or time out according to # Stripe's limits. + # + # Related guide: [Forward card details to third-party API endpoints](https://docs.stripe.com/payments/forwarding). class Request < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb index 2c26ab5c..77ed151c 100644 --- a/lib/stripe/resources/invoice.rb +++ b/lib/stripe/resources/invoice.rb @@ -203,6 +203,8 @@ module Stripe end # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. + # + # Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you're doing business in. You might need to [issue another invoice or credit note](https://stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business. def void_invoice(params = {}, opts = {}) request_stripe_object( method: :post, @@ -213,6 +215,8 @@ module Stripe end # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. + # + # Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you're doing business in. You might need to [issue another invoice or credit note](https://stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business. def self.void_invoice(invoice, params = {}, opts = {}) request_stripe_object( method: :post, diff --git a/lib/stripe/resources/quote.rb b/lib/stripe/resources/quote.rb index 69c5ef48..9034ed63 100644 --- a/lib/stripe/resources/quote.rb +++ b/lib/stripe/resources/quote.rb @@ -124,7 +124,7 @@ module Stripe ) end - # Download the PDF for a finalized quote + # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.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) @@ -137,7 +137,7 @@ module Stripe ) end - # Download the PDF for a finalized quote + # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.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)