From 16357521b013ac0e1ac0b2a8f60c9a65519852c5 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Wed, 12 Oct 2022 10:18:09 -0700 Subject: [PATCH 1/7] Remove Order --- lib/stripe/object_types.rb | 1 - lib/stripe/resources.rb | 1 - lib/stripe/resources/order.rb | 89 ----------------------------------- 3 files changed, 91 deletions(-) delete mode 100644 lib/stripe/resources/order.rb diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index a60132743..98ecbd8e9 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -62,7 +62,6 @@ def self.object_names_to_classes LineItem::OBJECT_NAME => LineItem, LoginLink::OBJECT_NAME => LoginLink, Mandate::OBJECT_NAME => Mandate, - Order::OBJECT_NAME => Order, PaymentIntent::OBJECT_NAME => PaymentIntent, PaymentLink::OBJECT_NAME => PaymentLink, PaymentMethod::OBJECT_NAME => PaymentMethod, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 01da2aea2..017ab3c6e 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -49,7 +49,6 @@ require "stripe/resources/line_item" require "stripe/resources/login_link" require "stripe/resources/mandate" -require "stripe/resources/order" require "stripe/resources/payment_intent" require "stripe/resources/payment_link" require "stripe/resources/payment_method" diff --git a/lib/stripe/resources/order.rb b/lib/stripe/resources/order.rb deleted file mode 100644 index 0ca6e75df..000000000 --- a/lib/stripe/resources/order.rb +++ /dev/null @@ -1,89 +0,0 @@ -# File generated from our OpenAPI spec -# frozen_string_literal: true - -module Stripe - # An Order describes a purchase being made by a customer, including the - # products & quantities being purchased, the order status, the payment information, - # and the billing/shipping details. - # - # Related guide: [Orders overview](https://stripe.com/docs/orders) - class Order < APIResource - extend Stripe::APIOperations::Create - extend Stripe::APIOperations::List - include Stripe::APIOperations::Save - - OBJECT_NAME = "order" - - def cancel(params = {}, opts = {}) - request_stripe_object( - method: :post, - path: format("/v1/orders/%s/cancel", { id: CGI.escape(self["id"]) }), - params: params, - opts: opts - ) - end - - def list_line_items(params = {}, opts = {}) - request_stripe_object( - method: :get, - path: format("/v1/orders/%s/line_items", { id: CGI.escape(self["id"]) }), - params: params, - opts: opts - ) - end - - def reopen(params = {}, opts = {}) - request_stripe_object( - method: :post, - path: format("/v1/orders/%s/reopen", { id: CGI.escape(self["id"]) }), - params: params, - opts: opts - ) - end - - def submit(params = {}, opts = {}) - request_stripe_object( - method: :post, - path: format("/v1/orders/%s/submit", { id: CGI.escape(self["id"]) }), - params: params, - opts: opts - ) - end - - def self.cancel(id, params = {}, opts = {}) - request_stripe_object( - method: :post, - path: format("/v1/orders/%s/cancel", { id: CGI.escape(id) }), - params: params, - opts: opts - ) - end - - def self.list_line_items(id, params = {}, opts = {}) - request_stripe_object( - method: :get, - path: format("/v1/orders/%s/line_items", { id: CGI.escape(id) }), - params: params, - opts: opts - ) - end - - def self.reopen(id, params = {}, opts = {}) - request_stripe_object( - method: :post, - path: format("/v1/orders/%s/reopen", { id: CGI.escape(id) }), - params: params, - opts: opts - ) - end - - def self.submit(id, params = {}, opts = {}) - request_stripe_object( - method: :post, - path: format("/v1/orders/%s/submit", { id: CGI.escape(id) }), - params: params, - opts: opts - ) - end - end -end From fc2e4cf6a6c663a7ecfcfe536ef69318d389b50d Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 13 Oct 2022 14:46:46 -0700 Subject: [PATCH 2/7] Remove SKU resource --- lib/stripe/object_types.rb | 1 - lib/stripe/resources.rb | 1 - lib/stripe/resources/sku.rb | 19 ------------- test/stripe/generated_examples_test.rb | 38 -------------------------- 4 files changed, 59 deletions(-) delete mode 100644 lib/stripe/resources/sku.rb diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 98ecbd8e9..e62425bc7 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -84,7 +84,6 @@ def self.object_names_to_classes SetupIntent::OBJECT_NAME => SetupIntent, ShippingRate::OBJECT_NAME => ShippingRate, Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun, - SKU::OBJECT_NAME => SKU, Source::OBJECT_NAME => Source, SourceTransaction::OBJECT_NAME => SourceTransaction, Subscription::OBJECT_NAME => Subscription, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 017ab3c6e..b0b3029a2 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -71,7 +71,6 @@ require "stripe/resources/setup_intent" require "stripe/resources/shipping_rate" require "stripe/resources/sigma/scheduled_query_run" -require "stripe/resources/sku" require "stripe/resources/source" require "stripe/resources/source_transaction" require "stripe/resources/subscription" diff --git a/lib/stripe/resources/sku.rb b/lib/stripe/resources/sku.rb deleted file mode 100644 index f7d72b2e5..000000000 --- a/lib/stripe/resources/sku.rb +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec -# frozen_string_literal: true - -module Stripe - # Stores representations of [stock keeping units](http://en.wikipedia.org/wiki/Stock_keeping_unit). - # SKUs describe specific product variations, taking into account any combination of: attributes, - # currency, and cost. For example, a product may be a T-shirt, whereas a specific SKU represents - # the `size: large`, `color: red` version of that shirt. - # - # Can also be used to manage inventory. - class SKU < APIResource - extend Stripe::APIOperations::Create - include Stripe::APIOperations::Delete - extend Stripe::APIOperations::List - include Stripe::APIOperations::Save - - OBJECT_NAME = "sku" - end -end diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb index 2fbc1220e..4837c2599 100644 --- a/test/stripe/generated_examples_test.rb +++ b/test/stripe/generated_examples_test.rb @@ -1815,44 +1815,6 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx?" end end - context "SKU.create" do - should "support requests with args: attributes, price, currency, inventory, product" do - Stripe::SKU.create( - { - attributes: { size: "Medium", gender: "Unisex" }, - price: 1500, - currency: "usd", - inventory: { type: "finite", quantity: 500 }, - product: "prod_xxxxxxxxxxxxx", - } - ) - assert_requested :post, "#{Stripe.api_base}/v1/skus" - end - end - context "SKU.delete" do - should "support requests with args: id" do - Stripe::SKU.delete("sku_xxxxxxxxxxxxx") - assert_requested :delete, "#{Stripe.api_base}/v1/skus/sku_xxxxxxxxxxxxx?" - end - end - context "SKU.list" do - should "support requests with args: limit" do - Stripe::SKU.list({ limit: 3 }) - assert_requested :get, "#{Stripe.api_base}/v1/skus?limit=3" - end - end - context "SKU.retrieve" do - should "support requests with args: id" do - Stripe::SKU.retrieve("sku_xxxxxxxxxxxxx") - assert_requested :get, "#{Stripe.api_base}/v1/skus/sku_xxxxxxxxxxxxx?" - end - end - context "SKU.update" do - should "support requests with args: metadata, id" do - Stripe::SKU.update("sku_xxxxxxxxxxxxx", { metadata: { order_id: "6735" } }) - assert_requested :post, "#{Stripe.api_base}/v1/skus/sku_xxxxxxxxxxxxx" - end - end context "Source.retrieve" do should "support requests with args: id" do Stripe::Source.retrieve("src_xxxxxxxxxxxxx") From 422f897ea67094f48c343dfc485c31d1558edd76 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 13 Oct 2022 14:47:08 -0700 Subject: [PATCH 3/7] Remove sku_test --- test/stripe/sku_test.rb | 60 ----------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 test/stripe/sku_test.rb diff --git a/test/stripe/sku_test.rb b/test/stripe/sku_test.rb deleted file mode 100644 index ec383f85b..000000000 --- a/test/stripe/sku_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require ::File.expand_path("../test_helper", __dir__) - -module Stripe - class SKUTest < Test::Unit::TestCase - should "be listable" do - skus = Stripe::SKU.list - assert_requested :get, "#{Stripe.api_base}/v1/skus" - assert skus.data.is_a?(Array) - assert skus.data[0].is_a?(Stripe::SKU) - end - - should "be retrievable" do - sku = Stripe::SKU.retrieve("sku_123") - assert_requested :get, "#{Stripe.api_base}/v1/skus/sku_123" - assert sku.is_a?(Stripe::SKU) - end - - should "be creatable" do - _ = Stripe::SKU.create( - currency: "USD", - inventory: { type: "finite", quantity: 500 }, - price: 100, - product: "prod_123" - ) - assert_requested :post, "#{Stripe.api_base}/v1/skus" - end - - should "be saveable" do - sku = Stripe::SKU.retrieve("sku_123") - sku.metadata["key"] = "value" - sku.save - assert_requested :post, "#{Stripe.api_base}/v1/skus/#{sku.id}" - end - - should "be updateable" do - sku = Stripe::SKU.update("sku_123", metadata: { foo: "bar" }) - assert_requested :post, "#{Stripe.api_base}/v1/skus/sku_123" - assert sku.is_a?(Stripe::SKU) - end - - context "#delete" do - should "be deletable" do - sku = Stripe::SKU.retrieve("sku_123") - sku = sku.delete - assert_requested :delete, "#{Stripe.api_base}/v1/skus/#{sku.id}" - assert sku.is_a?(Stripe::SKU) - end - end - - context ".delete" do - should "be deletable" do - sku = Stripe::SKU.delete("sku_123") - assert_requested :delete, "#{Stripe.api_base}/v1/skus/sku_123" - assert sku.is_a?(Stripe::SKU) - end - end - end -end From d285f1fe9648d3d6e6204c8d33f82c36d3479ab3 Mon Sep 17 00:00:00 2001 From: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> Date: Mon, 24 Oct 2022 16:11:17 -0700 Subject: [PATCH 4/7] Deprecate save() (#1136) * Deprecate save method * Deprecate save method * Update deprecation message * Add 'a' * Reviewer comments --- lib/stripe/api_operations/save.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/stripe/api_operations/save.rb b/lib/stripe/api_operations/save.rb index 8b08c88b5..89c7f38cd 100644 --- a/lib/stripe/api_operations/save.rb +++ b/lib/stripe/api_operations/save.rb @@ -33,6 +33,9 @@ def update(id, params = {}, opts = {}) end end + # The `save` method is DEPRECATED and will be removed in a future major + # version of the library. Use the `update` method on the resource instead. + # # Creates or updates an API resource. # # If the resource doesn't yet have an assigned ID and the resource is one @@ -68,6 +71,8 @@ def save(params = {}, opts = {}) resp, opts = execute_resource_request(:post, save_url, values, opts) initialize_from(resp.data, opts) end + extend Gem::Deprecate + deprecate :save, :update, 2022, 11 def self.included(base) # Set `metadata` as additive so that when it's set directly we remember From 73c3969220582a6e519e0512b8cc4c8840945c73 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Fri, 4 Nov 2022 15:55:33 -0700 Subject: [PATCH 5/7] Bring sdk-release/next-major up to date --- lib/stripe/resources/refund.rb | 4 ++++ lib/stripe/resources/source.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/stripe/resources/refund.rb b/lib/stripe/resources/refund.rb index f7aa8a55c..7d8ce075f 100644 --- a/lib/stripe/resources/refund.rb +++ b/lib/stripe/resources/refund.rb @@ -6,6 +6,10 @@ module Stripe # but not yet refunded. Funds will be refunded to the credit or debit card that # was originally charged. # + # Stripe Tax users with recurring payments and invoices can create [Credit Notes](https://stripe.com/docs/api/credit_notes), + # which reduce overall tax liability because tax is correctly recalculated and + # apportioned to the related invoice. + # # Related guide: [Refunds](https://stripe.com/docs/refunds). class Refund < APIResource extend Stripe::APIOperations::Create diff --git a/lib/stripe/resources/source.rb b/lib/stripe/resources/source.rb index a93ccfb69..d474f59d9 100644 --- a/lib/stripe/resources/source.rb +++ b/lib/stripe/resources/source.rb @@ -7,6 +7,10 @@ module Stripe # just like a `Card` object: once chargeable, they can be charged, or can be # attached to customers. # + # Stripe doesn't recommend using the deprecated [Sources API](https://stripe.com/docs/api/sources). + # We recommend that you adopt the [PaymentMethods API](https://stripe.com/docs/api/payment_methods). + # This newer API provides access to our latest features and payment method types. + # # Related guides: [Sources API](https://stripe.com/docs/sources) and [Sources & Customers](https://stripe.com/docs/sources/customers). class Source < APIResource extend Stripe::APIOperations::Create From bef1b5e9d1e72983c8cd2bbb009290c4f496977d Mon Sep 17 00:00:00 2001 From: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:16:59 -0800 Subject: [PATCH 6/7] New API version (#1145) --- lib/stripe/api_version.rb | 2 +- lib/stripe/resources/subscription.rb | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/lib/stripe/api_version.rb b/lib/stripe/api_version.rb index 9244d4ee2..b34ad87ba 100644 --- a/lib/stripe/api_version.rb +++ b/lib/stripe/api_version.rb @@ -3,6 +3,6 @@ module Stripe module ApiVersion - CURRENT = "2022-08-01" + CURRENT = "2022-11-09" end end diff --git a/lib/stripe/resources/subscription.rb b/lib/stripe/resources/subscription.rb index 7c9cbb1e8..ee14a68f0 100644 --- a/lib/stripe/resources/subscription.rb +++ b/lib/stripe/resources/subscription.rb @@ -50,31 +50,6 @@ def self.delete_discount(subscription_exposed_id, params = {}, opts = {}) end save_nested_resource :source - def delete(params = {}, opts = {}) - request_stripe_object( - method: :delete, - path: format("/v1/subscriptions/%s", { subscription_exposed_id: CGI.escape(self["id"]) }), - params: params, - opts: opts - ) - end - - def self.delete(subscription_exposed_id, params = {}, opts = {}) - request_stripe_object( - method: :delete, - path: format("/v1/subscriptions/%s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }), - params: params, - opts: opts - ) - end - - extend Gem::Deprecate - deprecate :delete, "Stripe::Subscription.cancel", 2022, 7 - - class << self - extend Gem::Deprecate - deprecate :delete, "Stripe::Subscription#cancel", 2022, 7 - end def self.search(params = {}, opts = {}) _search("/v1/subscriptions/search", params, opts) From 64c6fca77ffff37d0537c3c9e7fe53923eb71f58 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com> Date: Tue, 15 Nov 2022 13:26:08 -0800 Subject: [PATCH 7/7] Latest API version (#1148) --- lib/stripe/api_version.rb | 2 +- lib/stripe/resources/refund.rb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/stripe/api_version.rb b/lib/stripe/api_version.rb index b34ad87ba..b348fbad6 100644 --- a/lib/stripe/api_version.rb +++ b/lib/stripe/api_version.rb @@ -3,6 +3,6 @@ module Stripe module ApiVersion - CURRENT = "2022-11-09" + CURRENT = "2022-11-15" end end diff --git a/lib/stripe/resources/refund.rb b/lib/stripe/resources/refund.rb index 7d8ce075f..f7aa8a55c 100644 --- a/lib/stripe/resources/refund.rb +++ b/lib/stripe/resources/refund.rb @@ -6,10 +6,6 @@ module Stripe # but not yet refunded. Funds will be refunded to the credit or debit card that # was originally charged. # - # Stripe Tax users with recurring payments and invoices can create [Credit Notes](https://stripe.com/docs/api/credit_notes), - # which reduce overall tax liability because tax is correctly recalculated and - # apportioned to the related invoice. - # # Related guide: [Refunds](https://stripe.com/docs/refunds). class Refund < APIResource extend Stripe::APIOperations::Create