Skip to content
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

WIP: Support for file upload #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cice
Copy link

@cice cice commented Feb 4, 2020

At the moment, the File client follows the same implementation as all other endpoints. If you want to upload a file though, the API expects a multipart request containing the file contents + parameters.

This PR tries to solve this by introducing a new convern Upload.
Unfortunately this is a very recent feature of Faraday (>= v1.0), so I had to introduce that version constraint.
Furthermore, the Faraday guys haven't released a new, compatible version of faraday_middleware yet (see lostisland/faraday_middleware#200), so this gem is temporarily bound to the corresponding Github commit (lostisland/faraday_middleware@e169ab2).

Because of this I open this PR as draft and to be discussed.
Cheers

@@ -0,0 +1,37 @@
require 'open-uri'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? There is possibility to use a url as file. Not sure if this secure enough.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be better if #upload expects a file/IO object, instead of URL/filename?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants