Removed v1/files override (#1443)

This commit is contained in:
prathmesh-stripe 2024-08-29 19:26:49 -04:00 committed by GitHub
parent 8fc981be69
commit 27d87e91ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,23 @@ module Stripe
"file"
end
# To upload a file to Stripe, you need to send a request of type multipart/form-data. Include the file you want to upload in the request, and the parameters for creating a file.
#
# All of Stripe's officially supported Client libraries support sending multipart/form-data.
def self.create(params = {}, opts = {})
config = opts[:client]&.config || Stripe.config
upload_base = config.uploads_base
opts = { api_base: upload_base }.merge(Util.normalize_opts(opts))
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
raise ArgumentError, "file must respond to `#read`"
end
opts = { content_type: MultipartEncoder::MULTIPART_FORM_DATA }.merge(Util.normalize_opts(opts))
request_stripe_object(method: :post, path: "/v1/files", params: params, opts: opts)
end
# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
@ -35,18 +52,5 @@ module Stripe
def self.resource_url
"/v1/files"
end
def self.create(params = {}, opts = {})
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
raise ArgumentError, "file must respond to `#read`"
end
config = opts[:client]&.config || Stripe.config
opts = {
api_base: config.uploads_base,
content_type: MultipartEncoder::MULTIPART_FORM_DATA,
}.merge(Util.normalize_opts(opts))
super
end
end
end