From 79463b2efa12295769d19e3cf2f8fd6a552424c6 Mon Sep 17 00:00:00 2001 From: Paul Padier Date: Tue, 22 Aug 2023 10:14:56 +0900 Subject: [PATCH 1/2] Explicitly format timestamp in SignatureVerificationError message (#1262) When interpolating a Time object in a String, Ruby calls `to_s` under the hood. For Rails applications defining a `default` string format, this triggers deprecation warnings as of v7.0.7: https://github.com/rails/rails/pull/48555 This change fixes that by explicitly formatting the timestamp (using the same `YYYY-MM-DD HH:mm:ss` format currently implicitly used). --- lib/stripe/webhook.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stripe/webhook.rb b/lib/stripe/webhook.rb index df1ed65d..63b2f0c8 100644 --- a/lib/stripe/webhook.rb +++ b/lib/stripe/webhook.rb @@ -108,8 +108,9 @@ module Stripe end if tolerance && timestamp < Time.now - tolerance + formatted_timestamp = Time.at(timestamp).strftime("%F %T") raise SignatureVerificationError.new( - "Timestamp outside the tolerance zone (#{Time.at(timestamp)})", + "Timestamp outside the tolerance zone (#{formatted_timestamp})", header, http_body: payload ) end From 658a0b786a3c1b44086354956c32ad75b8f441b6 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 23 Aug 2023 22:10:54 +0000 Subject: [PATCH 2/2] Update generated code for v482 --- OPENAPI_VERSION | 2 +- lib/stripe/resources/quote.rb | 44 +++++++++++++++---- lib/stripe/resources/quote_preview_invoice.rb | 2 - .../resources/quote_preview_schedule.rb | 2 - 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ad928211..3c560ddf 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v481 \ No newline at end of file +v482 \ No newline at end of file diff --git a/lib/stripe/resources/quote.rb b/lib/stripe/resources/quote.rb index 0ce759bf..72aaf00e 100644 --- a/lib/stripe/resources/quote.rb +++ b/lib/stripe/resources/quote.rb @@ -8,17 +8,9 @@ module Stripe extend Stripe::APIOperations::Create extend Stripe::APIOperations::List include Stripe::APIOperations::Save - extend Stripe::APIOperations::NestedResource OBJECT_NAME = "quote" - nested_resource_class_methods :todo, - operations: %i[list], - resource_plural: "TODO" - nested_resource_class_methods :todo, - operations: %i[list], - resource_plural: "TODO" - def accept(params = {}, opts = {}) request_stripe_object( method: :post, @@ -112,6 +104,24 @@ module Stripe ) end + def preview_invoices(params = {}, opts = {}) + request_stripe_object( + method: :get, + path: format("/v1/quotes/%s/preview_invoices", { quote: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + def preview_subscription_schedules(params = {}, opts = {}) + request_stripe_object( + method: :get, + path: format("/v1/quotes/%s/preview_subscription_schedules", { quote: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + def reestimate(params = {}, opts = {}) request_stripe_object( method: :post, @@ -219,6 +229,24 @@ module Stripe ) end + def self.preview_invoices(quote, params = {}, opts = {}) + request_stripe_object( + method: :get, + path: format("/v1/quotes/%s/preview_invoices", { quote: CGI.escape(quote) }), + params: params, + opts: opts + ) + end + + def self.preview_subscription_schedules(quote, params = {}, opts = {}) + request_stripe_object( + method: :get, + path: format("/v1/quotes/%s/preview_subscription_schedules", { quote: CGI.escape(quote) }), + params: params, + opts: opts + ) + end + def self.reestimate(quote, params = {}, opts = {}) request_stripe_object( method: :post, diff --git a/lib/stripe/resources/quote_preview_invoice.rb b/lib/stripe/resources/quote_preview_invoice.rb index abf093a1..e6c191bf 100644 --- a/lib/stripe/resources/quote_preview_invoice.rb +++ b/lib/stripe/resources/quote_preview_invoice.rb @@ -35,8 +35,6 @@ module Stripe # # Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending) class QuotePreviewInvoice < APIResource - extend Stripe::APIOperations::List - OBJECT_NAME = "quote_preview_invoice" end end diff --git a/lib/stripe/resources/quote_preview_schedule.rb b/lib/stripe/resources/quote_preview_schedule.rb index 05c5cc70..d6e7477c 100644 --- a/lib/stripe/resources/quote_preview_schedule.rb +++ b/lib/stripe/resources/quote_preview_schedule.rb @@ -3,8 +3,6 @@ module Stripe class QuotePreviewSchedule < APIResource - extend Stripe::APIOperations::List - OBJECT_NAME = "quote_preview_schedule" end end