diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 2ba492604..ae2bb1461 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v424 \ No newline at end of file +v425 \ No newline at end of file diff --git a/lib/stripe/resources/quote.rb b/lib/stripe/resources/quote.rb index 5c3d09553..72aaf00e7 100644 --- a/lib/stripe/resources/quote.rb +++ b/lib/stripe/resources/quote.rb @@ -83,6 +83,18 @@ def mark_stale_quote(params = {}, opts = {}) ) end + def pdf(params = {}, opts = {}, &read_body_chunk_block) + config = opts[:client]&.config || Stripe.config + opts = { api_base: config.uploads_base }.merge(opts) + request_stream( + method: :get, + path: format("/v1/quotes/%s/pdf", { quote: CGI.escape(self["id"]) }), + params: params, + opts: opts, + &read_body_chunk_block + ) + end + def preview_invoice_lines(preview_invoice, params = {}, opts = {}) request_stripe_object( method: :get, @@ -191,6 +203,18 @@ def self.mark_stale_quote(quote, params = {}, opts = {}) ) end + def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) + config = opts[:client]&.config || Stripe.config + opts = { api_base: config.uploads_base }.merge(opts) + execute_resource_request_stream( + :get, + format("/v1/quotes/%s/pdf", { quote: CGI.escape(quote) }), + params, + opts, + &read_body_chunk_block + ) + end + def self.preview_invoice_lines( quote, preview_invoice, @@ -231,47 +255,5 @@ def self.reestimate(quote, params = {}, opts = {}) opts: opts ) end - - def pdf(params = {}, opts = {}, &read_body_chunk_block) - unless block_given? - raise ArgumentError, "A read_body_chunk_block block parameter is required when calling the pdf method." - end - - config = opts[:client]&.config || Stripe.config - - request_stream( - method: :get, - path: resource_url + "/pdf", - params: params, - opts: { - api_base: config.uploads_base, - }.merge(opts), - &read_body_chunk_block - ) - end - - def self.pdf(id, params = {}, opts = {}, &read_body_chunk_block) - unless id.is_a?(String) - raise ArgumentError, - "id should be a string representing the ID of an API resource" - end - - unless block_given? - raise ArgumentError, "A read_body_chunk_block block parameter is required when calling the pdf method." - end - - config = opts[:client]&.config || Stripe.config - - resp = execute_resource_request_stream( - :get, - "#{resource_url}/#{CGI.escape(id)}/pdf", - params, - { - api_base: config.uploads_base, - }.merge(opts), - &read_body_chunk_block - ) - resp - end end end