-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle file
objects like file_upload
#689
Conversation
742fa2a
to
a57a87c
Compare
lib/stripe/file.rb
Outdated
extend Stripe::APIOperations::Create | ||
extend Stripe::APIOperations::List | ||
|
||
OBJECT_NAME = "file_upload".freeze | ||
OBJECT_NAME = "file".freeze | ||
ALT_OBJECT_NAME = "file_upload".freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind just adding a bit of a comment here explaining that these used to be two distinct objects that were then unified into one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, sorry for the super nit, but just so this sorts nicely, do you think we could go OBJECT_NAME_ALT
? :)
I think what you've done here is the right move for now. Left a few minor nits, but LGTM. I think your tests were failing due to an intermittent Travis problem, so I restarted one of the builds in the matrix. ptal @ob-stripe |
a57a87c
to
f3dd3ab
Compare
Fixed, ptal @brandur-stripe |
LGTM. |
6f697a5
to
0908d5b
Compare
I pushed a second commit to make it so that |
|
||
# Set `api_base` to `nil` to ensure that these requests are _not_ sent | ||
# to the default API hostname. | ||
Stripe.api_base = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit awkward, but it's necessary because if api_base
and uploads_base
have the same value, then assert_requested
is not actually asserting that the request is for the correct host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. It may be worth adding a comment that notes that api_base
will be reset between every test case so this won't mutate the global state of test runs that come after it.
@@ -103,7 +103,7 @@ module Stripe | |||
|
|||
@api_base = "https://api.stripe.com" | |||
@connect_base = "https://connect.stripe.com" | |||
@uploads_base = "https://uploads.stripe.com" | |||
@uploads_base = "https://files.stripe.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may eventually want to rename this to files_base
for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought of that but was afraid it should count as a breaking change. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, true (although hopefully no one's overriding this). It does seem less churnful to just leave it for now though, so NM. If we ever feel strongly about it later, we can always change it then.
Minor comment above, but LGTM. |
0908d5b
to
ea09249
Compare
d839680
to
9d64d31
Compare
Released as 3.27.0. |
r? @brandur-stripe
cc @stripe/api-libraries
Stripe::FileUpload
resource class toStripe::File
, and adds aFileUpload
alias for theFile
classOBJECT_NAME
fromfile_upload
tofile
, and adds anOBJECT_NAME_ALT
with valuefile_upload
convert_to_stripe_object
to deserialize bothfile
andfile_upload
objects intoStripe::File
objectsfile_test.rb
file but also kept the originalfile_upload_test.rb
file. This is probably unnecessary, and we could remove the latter and simply add a test to check thatStripe::FileUpload == Stripe::File
. Let me know what you think is preferable.