mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-10 00:02:25 -04:00
Removed v1/files override (#1443)
This commit is contained in:
parent
8fc981be69
commit
27d87e91ae
@ -18,6 +18,23 @@ module Stripe
|
|||||||
"file"
|
"file"
|
||||||
end
|
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.
|
# 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 = {})
|
def self.list(filters = {}, opts = {})
|
||||||
request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
|
request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
|
||||||
@ -35,18 +52,5 @@ module Stripe
|
|||||||
def self.resource_url
|
def self.resource_url
|
||||||
"/v1/files"
|
"/v1/files"
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user