uploadcare / uploadcare-ruby

Ruby API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
MIT License
39 stars 28 forks source link

Sign URL uploads if configured #139

Closed geeosh closed 9 months ago

geeosh commented 10 months ago

When having Signed Uploads enabled, and using Uploadcare::Uploader.upload, it doesn't send the signature and expire parameters if using a URL (whereas it does if you use a file).

This PR introduces a few changes to use (Param::Upload::SignatureGenerator to add the signature and expire to the upload_from_url_body method.

Ideally both the upload_from_url_body method and the upload_many_body method would use the Param::Upload::UploadParamsGenerator service to generate params. Since the param keys are different, I didn't take the time to refactor that service, but it wouldn't be too hard. There is already code repetition for the store_value in both places.

kraft001 commented 10 months ago

@geeosh The PR looks good to me! Just need to fix (or at least mute) Rubocop issues before merging it

geeosh commented 9 months ago

@kraft001 sure thing, I can submit an update for this later this week.