From b92062d56dbb56b449abae22af42902556592832 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Sun, 31 Mar 2024 14:33:01 -0400 Subject: [PATCH] Start explaining storing behaviour at various places for file upload. Closes #155 (#157) * Fix wrong param name used in docs for method definition * Mention in docs at various placea about auto store file behavior * Cleanup this documentation * Make sure the values for store are properly annotated as objects * Missing option * Updates to section about passing params per request. Also remove the irrelevant autostore option. We don't really support configuring it --- README.md | 27 ++++++++++--------- .../entity/conversion/base_converter.rb | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c277815..7c98637 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Using Uploadcare is simple, and here are the basics of handling files. ```ruby @file_to_upload = File.open("your-file.png") -@uc_file = Uploadcare::Uploader.upload(@file_to_upload) +@uc_file = Uploadcare::Uploader.upload(@file_to_upload, store: "auto") @uc_file.uuid # => "dc99200d-9bd6-4b43-bfa9-aa7bfaefca40" @@ -105,13 +105,15 @@ Using Uploadcare is simple, and here are the basics of handling files. # => "https://ucarecdn.com/dc99200d-9bd6-4b43-bfa9-aa7bfaefca40/your-file.png" ``` -Your might then want to store or delete the uploaded file. Storing files could -be crucial if you aren't using the “Automatic file storing” option for your -Uploadcare project. If not stored manually or automatically, files get deleted -within a 24-hour period. +The `store` option can have these possible values: +- `true`: mark the uploaded file as stored. +- `false`: do not mark the uploaded file as stored and remove it after 24 hours. +- `"auto"`: defers the choice of storage behavior to the [auto-store setting](https://app.uploadcare.com/projects/-/settings/#storage) for your Uploadcare project. This is the default behavior. + +Your might then want to store or delete the uploaded file. ```ruby -# that's how you store a file +# that's how you store a file, if you have uploaded the file using store: false and changed your mind later @uc_file.store # => #