filestack / filestack-ruby

Official Ruby SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
34 stars 27 forks source link

Question: Support bucket and path options in upload #35

Closed assimovt closed 5 years ago

assimovt commented 6 years ago

I'd like to migrate a number of filestack files from one account to another and using the upload method from local path method. I wanted to ask if it supports providing a bucket and a path in the bucket, similarly to the JS SDK? Can't find it anywhere mentioned in the doc. Thanks!

gabifija commented 5 years ago

@assimovt we have added some changes to version 2.5.3, so if you want to upload filepath or external_url you have to pass query params in options (https://www.filestack.com/docs/api/file/#store-qp):

here is an example: require 'filestack'

client = FilestackClient.new('YOUR_APIKEY') filelink_external_url = client.upload(external_url: 'https://someimage.png', options: {mimetype: 'image/jpeg', path:'foldername/'}) filelink_filepath = client.upload(filepath: 'somelocalimage.png', options: {mimetype: 'image/jpeg', path:'foldername/'}) puts filelink_external_url.metadata puts filelink_filepath.metadata

Let me know if it helps.