diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 32951953e..62a99e0ea 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v879 \ No newline at end of file +v896 \ No newline at end of file diff --git a/lib/stripe/api_version.rb b/lib/stripe/api_version.rb index ce62d3089..9a9fdac0f 100644 --- a/lib/stripe/api_version.rb +++ b/lib/stripe/api_version.rb @@ -4,6 +4,6 @@ module Stripe module ApiVersion CURRENT = "2023-10-16" - PREVIEW = "2024-02-15.preview-v2" + PREVIEW = "2024-03-20.preview-v2" end end diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 3fb708233..9515fe4b8 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -49,11 +49,10 @@ def self.object_names_to_classes Customer.object_name => Customer, CustomerBalanceTransaction.object_name => CustomerBalanceTransaction, CustomerCashBalanceTransaction.object_name => CustomerCashBalanceTransaction, - CustomerEntitlement.object_name => CustomerEntitlement, - CustomerEntitlementSummary.object_name => CustomerEntitlementSummary, CustomerSession.object_name => CustomerSession, Discount.object_name => Discount, Dispute.object_name => Dispute, + Entitlements::ActiveEntitlement.object_name => Entitlements::ActiveEntitlement, Entitlements::Feature.object_name => Entitlements::Feature, EphemeralKey.object_name => EphemeralKey, Event.object_name => Event, @@ -67,6 +66,7 @@ def self.object_names_to_classes FinancialConnections::AccountOwnership.object_name => FinancialConnections::AccountOwnership, FinancialConnections::Session.object_name => FinancialConnections::Session, FinancialConnections::Transaction.object_name => FinancialConnections::Transaction, + Forwarding::Request.object_name => Forwarding::Request, FundingInstructions.object_name => FundingInstructions, GiftCards::Card.object_name => GiftCards::Card, GiftCards::Transaction.object_name => GiftCards::Transaction, @@ -100,6 +100,7 @@ def self.object_names_to_classes Plan.object_name => Plan, Price.object_name => Price, Product.object_name => Product, + ProductFeature.object_name => ProductFeature, PromotionCode.object_name => PromotionCode, Quote.object_name => Quote, QuotePhase.object_name => QuotePhase, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index b34be48fd..324a68db8 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -37,11 +37,10 @@ require "stripe/resources/customer" require "stripe/resources/customer_balance_transaction" require "stripe/resources/customer_cash_balance_transaction" -require "stripe/resources/customer_entitlement" -require "stripe/resources/customer_entitlement_summary" require "stripe/resources/customer_session" require "stripe/resources/discount" require "stripe/resources/dispute" +require "stripe/resources/entitlements/active_entitlement" require "stripe/resources/entitlements/feature" require "stripe/resources/ephemeral_key" require "stripe/resources/event" @@ -54,6 +53,7 @@ require "stripe/resources/financial_connections/account_ownership" require "stripe/resources/financial_connections/session" require "stripe/resources/financial_connections/transaction" +require "stripe/resources/forwarding/request" require "stripe/resources/funding_instructions" require "stripe/resources/gift_cards/card" require "stripe/resources/gift_cards/transaction" @@ -87,6 +87,7 @@ require "stripe/resources/plan" require "stripe/resources/price" require "stripe/resources/product" +require "stripe/resources/product_feature" require "stripe/resources/promotion_code" require "stripe/resources/quote" require "stripe/resources/quote_phase" diff --git a/lib/stripe/resources/customer.rb b/lib/stripe/resources/customer.rb index 4a3390009..4587b20ce 100644 --- a/lib/stripe/resources/customer.rb +++ b/lib/stripe/resources/customer.rb @@ -22,7 +22,6 @@ def self.object_name nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list] nested_resource_class_methods :source, operations: %i[create retrieve update delete list] nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list] - nested_resource_class_methods :entitlement, operations: %i[list] # Creates a new customer object. def self.create(params = {}, opts = {}) @@ -128,16 +127,6 @@ def self.retrieve_cash_balance(customer, params = {}, opts = {}) ) end - # Retrieve the entitlement summary for a customer - def self.retrieve_entitlement_summary(customer, params = {}, opts = {}) - request_stripe_object( - method: :get, - path: format("/v1/customers/%s/entitlement_summary", { customer: CGI.escape(customer) }), - params: params, - opts: opts - ) - end - # Retrieves a PaymentMethod object for a given Customer. def retrieve_payment_method(payment_method, params = {}, opts = {}) request_stripe_object( diff --git a/lib/stripe/resources/customer_entitlement.rb b/lib/stripe/resources/customer_entitlement.rb deleted file mode 100644 index bea54ca31..000000000 --- a/lib/stripe/resources/customer_entitlement.rb +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec -# frozen_string_literal: true - -module Stripe - # A entitlement for a customer describes access to a feature. - class CustomerEntitlement < APIResource - OBJECT_NAME = "customer_entitlement" - def self.object_name - "customer_entitlement" - end - end -end diff --git a/lib/stripe/resources/customer_entitlement_summary.rb b/lib/stripe/resources/customer_entitlement_summary.rb deleted file mode 100644 index 3aedca898..000000000 --- a/lib/stripe/resources/customer_entitlement_summary.rb +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec -# frozen_string_literal: true - -module Stripe - # A summary of a customer's entitlements. - class CustomerEntitlementSummary < APIResource - OBJECT_NAME = "customer_entitlement_summary" - def self.object_name - "customer_entitlement_summary" - end - end -end diff --git a/lib/stripe/resources/entitlements/active_entitlement.rb b/lib/stripe/resources/entitlements/active_entitlement.rb new file mode 100644 index 000000000..6454e399e --- /dev/null +++ b/lib/stripe/resources/entitlements/active_entitlement.rb @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Entitlements + # An active entitlement describes access to a feature for a customer. + class ActiveEntitlement < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "entitlements.active_entitlement" + def self.object_name + "entitlements.active_entitlement" + end + + # Retrieve a list of active entitlements for a customer + def self.list(filters = {}, opts = {}) + request_stripe_object( + method: :get, + path: "/v1/entitlements/active_entitlements", + params: filters, + opts: opts + ) + end + end + end +end diff --git a/lib/stripe/resources/forwarding/request.rb b/lib/stripe/resources/forwarding/request.rb new file mode 100644 index 000000000..48a8b41d6 --- /dev/null +++ b/lib/stripe/resources/forwarding/request.rb @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Forwarding + # Instructs Stripe to make a request on your behalf using the destination URL and HTTP method in the config. + # A config is set up for each destination URL by Stripe at the time of onboarding. Stripe verifies requests with + # your credentials in the config, and injects card details from the payment_method into the request. + # + # Stripe redacts all sensitive fields and headers, including authentication credentials and card numbers, + # before storing the request and response data in the forwarding Request object, which are subject to a + # 30-day retention period. + # + # You can provide a Stripe idempotency key to make sure that requests with the same key result in only one + # outbound request. The Stripe idempotency key provided should be unique and different from any idempotency + # keys provided on the underlying third-party request. + # + # Forwarding Requests are synchronous requests that return a response or time out according to + # Stripe's limits. + class Request < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "forwarding.request" + def self.object_name + "forwarding.request" + end + + # Creates a ForwardingRequest object. + def self.create(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: "/v1/forwarding/requests", + params: params, + opts: opts + ) + end + + # Lists all ForwardingRequest objects. + def self.list(filters = {}, opts = {}) + request_stripe_object( + method: :get, + path: "/v1/forwarding/requests", + params: filters, + opts: opts + ) + end + end + end +end diff --git a/lib/stripe/resources/product.rb b/lib/stripe/resources/product.rb index 3dc845255..213f30242 100644 --- a/lib/stripe/resources/product.rb +++ b/lib/stripe/resources/product.rb @@ -14,6 +14,7 @@ class Product < APIResource extend Stripe::APIOperations::Create include Stripe::APIOperations::Delete extend Stripe::APIOperations::List + extend Stripe::APIOperations::NestedResource extend Stripe::APIOperations::Search include Stripe::APIOperations::Save @@ -22,6 +23,8 @@ def self.object_name "product" end + nested_resource_class_methods :feature, operations: %i[create delete list] + # Creates a new product object. def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/products", params: params, opts: opts) diff --git a/lib/stripe/resources/product_feature.rb b/lib/stripe/resources/product_feature.rb new file mode 100644 index 000000000..5a36e5647 --- /dev/null +++ b/lib/stripe/resources/product_feature.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + # A product_feature represents an attachment between a feature and a product. + # When a product is purchased that has a feature attached, Stripe will create an entitlement to the feature for the purchasing customer. + class ProductFeature < APIResource + OBJECT_NAME = "product_feature" + def self.object_name + "product_feature" + end + end +end diff --git a/lib/stripe/resources/quote.rb b/lib/stripe/resources/quote.rb index 52254fa67..c85363b0a 100644 --- a/lib/stripe/resources/quote.rb +++ b/lib/stripe/resources/quote.rb @@ -208,7 +208,7 @@ def self.mark_stale(quote, params = {}, opts = {}) ) 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) @@ -221,7 +221,7 @@ def pdf(params = {}, opts = {}, &read_body_chunk_block) ) 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) diff --git a/stripe.gemspec b/stripe.gemspec index d4f2f4a58..0f46f3381 100644 --- a/stripe.gemspec +++ b/stripe.gemspec @@ -33,10 +33,13 @@ Gem::Specification.new do |s| /\A\.rubocop/, /\A\.travis.yml/, /\A\.vscode/, + %r{\A(bin/tapioca)}, + /\Asorbet/, /\Atest/ ) s.files = `git ls-files`.split("\n").reject { |f| ignored.match(f) } s.executables = `git ls-files -- bin/*`.split("\n") .map { |f| File.basename(f) } + .reject { |f| f == "tapioca" } s.require_paths = ["lib"] end