From d356ef6e9636f74c8bd7a589b383cc84f7766894 Mon Sep 17 00:00:00 2001 From: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:58:17 -0800 Subject: [PATCH 1/3] Remove list in child resources (#1317) --- lib/stripe/resources/application_fee_refund.rb | 1 - lib/stripe/resources/capability.rb | 1 - lib/stripe/resources/customer_balance_transaction.rb | 1 - lib/stripe/resources/customer_cash_balance_transaction.rb | 2 -- lib/stripe/resources/person.rb | 1 - lib/stripe/resources/reversal.rb | 1 - lib/stripe/resources/tax_id.rb | 1 - 7 files changed, 8 deletions(-) diff --git a/lib/stripe/resources/application_fee_refund.rb b/lib/stripe/resources/application_fee_refund.rb index 635494d43..dc62a88e6 100644 --- a/lib/stripe/resources/application_fee_refund.rb +++ b/lib/stripe/resources/application_fee_refund.rb @@ -8,7 +8,6 @@ module Stripe # # Related guide: [Refunding application fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee) class ApplicationFeeRefund < APIResource - extend Stripe::APIOperations::List include Stripe::APIOperations::Save OBJECT_NAME = "fee_refund" diff --git a/lib/stripe/resources/capability.rb b/lib/stripe/resources/capability.rb index cf65c1c66..5c4af73d2 100644 --- a/lib/stripe/resources/capability.rb +++ b/lib/stripe/resources/capability.rb @@ -6,7 +6,6 @@ module Stripe # # Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities) class Capability < APIResource - extend Stripe::APIOperations::List include Stripe::APIOperations::Save OBJECT_NAME = "capability" diff --git a/lib/stripe/resources/customer_balance_transaction.rb b/lib/stripe/resources/customer_balance_transaction.rb index 597f6e37e..b846fb7ba 100644 --- a/lib/stripe/resources/customer_balance_transaction.rb +++ b/lib/stripe/resources/customer_balance_transaction.rb @@ -9,7 +9,6 @@ module Stripe # # Related guide: [Customer balance](https://stripe.com/docs/billing/customer/balance) class CustomerBalanceTransaction < APIResource - extend Stripe::APIOperations::List include Stripe::APIOperations::Save OBJECT_NAME = "customer_balance_transaction" diff --git a/lib/stripe/resources/customer_cash_balance_transaction.rb b/lib/stripe/resources/customer_cash_balance_transaction.rb index 3c28e823b..bdaad3975 100644 --- a/lib/stripe/resources/customer_cash_balance_transaction.rb +++ b/lib/stripe/resources/customer_cash_balance_transaction.rb @@ -7,8 +7,6 @@ module Stripe # represent when funds are moved into or out of this balance. This includes funding by the customer, allocation # to payments, and refunds to the customer. class CustomerCashBalanceTransaction < APIResource - extend Stripe::APIOperations::List - OBJECT_NAME = "customer_cash_balance_transaction" end end diff --git a/lib/stripe/resources/person.rb b/lib/stripe/resources/person.rb index 4aaebf3e0..d5e432b3a 100644 --- a/lib/stripe/resources/person.rb +++ b/lib/stripe/resources/person.rb @@ -9,7 +9,6 @@ module Stripe # # Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/handling-api-verification#person-information) class Person < APIResource - extend Stripe::APIOperations::List include Stripe::APIOperations::Save OBJECT_NAME = "person" diff --git a/lib/stripe/resources/reversal.rb b/lib/stripe/resources/reversal.rb index db67f1c92..c98945b2e 100644 --- a/lib/stripe/resources/reversal.rb +++ b/lib/stripe/resources/reversal.rb @@ -16,7 +16,6 @@ module Stripe # # Related guide: [Reversing transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reversing-transfers) class Reversal < APIResource - extend Stripe::APIOperations::List include Stripe::APIOperations::Save OBJECT_NAME = "transfer_reversal" diff --git a/lib/stripe/resources/tax_id.rb b/lib/stripe/resources/tax_id.rb index d81d3e9b9..f19e8adc2 100644 --- a/lib/stripe/resources/tax_id.rb +++ b/lib/stripe/resources/tax_id.rb @@ -8,7 +8,6 @@ module Stripe # Related guides: [Customer tax identification numbers](https://stripe.com/docs/billing/taxes/tax-ids), [Account tax IDs](https://stripe.com/docs/invoicing/connect#account-tax-ids) class TaxId < APIResource include Stripe::APIOperations::Delete - extend Stripe::APIOperations::List OBJECT_NAME = "tax_id" From 33e217ba15dfaf6ffeb514b786669e6169beb9ce Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 23:11:17 +0000 Subject: [PATCH 2/3] Update generated code for v805 --- OPENAPI_VERSION | 2 +- lib/stripe/object_types.rb | 4 ++++ lib/stripe/resources.rb | 4 ++++ lib/stripe/resources/customer.rb | 11 +++++++++++ lib/stripe/resources/customer_entitlement.rb | 9 +++++++++ .../resources/customer_entitlement_summary.rb | 9 +++++++++ lib/stripe/resources/entitlements/event.rb | 13 +++++++++++++ lib/stripe/resources/entitlements/feature.rb | 15 +++++++++++++++ 8 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 lib/stripe/resources/customer_entitlement.rb create mode 100644 lib/stripe/resources/customer_entitlement_summary.rb create mode 100644 lib/stripe/resources/entitlements/event.rb create mode 100644 lib/stripe/resources/entitlements/feature.rb diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 366478d72..8af654392 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v802 \ No newline at end of file +v805 \ No newline at end of file diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index b0f308b49..c9bdeca59 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -45,9 +45,13 @@ 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::Event::OBJECT_NAME => Entitlements::Event, + Entitlements::Feature::OBJECT_NAME => Entitlements::Feature, EphemeralKey::OBJECT_NAME => EphemeralKey, Event::OBJECT_NAME => Event, ExchangeRate::OBJECT_NAME => ExchangeRate, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 4bfdf7254..3f55e6b54 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -33,9 +33,13 @@ 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/event" +require "stripe/resources/entitlements/feature" require "stripe/resources/ephemeral_key" require "stripe/resources/event" require "stripe/resources/exchange_rate" diff --git a/lib/stripe/resources/customer.rb b/lib/stripe/resources/customer.rb index e9a737a3c..78f5bba1f 100644 --- a/lib/stripe/resources/customer.rb +++ b/lib/stripe/resources/customer.rb @@ -17,6 +17,7 @@ class Customer < APIResource nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list] nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list] + nested_resource_class_methods :entitlement, operations: %i[list] nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list] # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new @@ -141,6 +142,16 @@ def self.update_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 + def test_helpers TestHelpers.new(self) end diff --git a/lib/stripe/resources/customer_entitlement.rb b/lib/stripe/resources/customer_entitlement.rb new file mode 100644 index 000000000..7aa365075 --- /dev/null +++ b/lib/stripe/resources/customer_entitlement.rb @@ -0,0 +1,9 @@ +# 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" + end +end diff --git a/lib/stripe/resources/customer_entitlement_summary.rb b/lib/stripe/resources/customer_entitlement_summary.rb new file mode 100644 index 000000000..16dffa412 --- /dev/null +++ b/lib/stripe/resources/customer_entitlement_summary.rb @@ -0,0 +1,9 @@ +# 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" + end +end diff --git a/lib/stripe/resources/entitlements/event.rb b/lib/stripe/resources/entitlements/event.rb new file mode 100644 index 000000000..9642ef5c7 --- /dev/null +++ b/lib/stripe/resources/entitlements/event.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Entitlements + # An entitlement event either grants or revokes an entitlement to a feature for a customer. + class Event < APIResource + extend Stripe::APIOperations::Create + + OBJECT_NAME = "entitlements.event" + end + end +end diff --git a/lib/stripe/resources/entitlements/feature.rb b/lib/stripe/resources/entitlements/feature.rb new file mode 100644 index 000000000..47c301d9d --- /dev/null +++ b/lib/stripe/resources/entitlements/feature.rb @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Entitlements + # A feature represents a monetizable ability or functionality in your system. + # Features can be assigned to products, and when those products are purchased, Stripe will create an entitlement to the feature for the purchasing customer. + class Feature < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "entitlements.feature" + end + end +end From ec0e71ddb0cff7abd2d9cec0432f05493e8e8fcd Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Thu, 1 Feb 2024 14:15:29 -0800 Subject: [PATCH 3/3] Bump version to 10.7.0 --- CHANGELOG.md | 5 +++++ VERSION | 2 +- lib/stripe/version.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad780e00f..cee80fa81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Changelog +## 10.7.0 - 2024-02-01 +* [#1317](https://github.com/stripe/stripe-ruby/pull/1317) Remove list method in child resources + * Removes list method mixin from child resources, as these methods always return `InvalidRequestError` and never succeed +* [#1311](https://github.com/stripe/stripe-ruby/pull/1311) Use the deprecation gem in search and clean up usage of the gem + ## 10.6.0 - 2024-01-12 * [#1310](https://github.com/stripe/stripe-ruby/pull/1310) Update generated code * Add support for new resource `CustomerSession` diff --git a/VERSION b/VERSION index d1dd3f904..1bcdaf5fe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.6.0 +10.7.0 diff --git a/lib/stripe/version.rb b/lib/stripe/version.rb index 0d88a821c..122b8c1c7 100644 --- a/lib/stripe/version.rb +++ b/lib/stripe/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Stripe - VERSION = "10.6.0" + VERSION = "10.7.0" end