From bff5843f9555ffa38e31d5b4c8c44b847f6c443a Mon Sep 17 00:00:00 2001 From: Gabi Date: Fri, 22 Mar 2019 15:55:47 +0100 Subject: [PATCH] Add fallback --- README.md | 14 ++++++++++++++ docs/TransformConfig.html | 2 +- lib/filestack/config.rb | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d553dcc..eedc575 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,20 @@ new_filelink = transform.store For a list of valid transformations, please see [here](https://www.filestack.com/docs/image-transformations). +### Fallback +Return `default` file if the source of the transformation does not work or the transformation fails. +To use fallback, you should provide `handle` of the file that should be returned. Optionally, you can add `cache`, which means number of seconds fallback response should be cached in CDN. + +```ruby +transform = client.transform_external('https://someurl.com').fallback(handle: 'DEFAULT_HANDLE') +``` + +If you are using fallback handle that belongs to different application than the one which runs transformation (APIKEY) and it is secured with security policy, appropriate signature and policy with read call should be used: + +```ruby +transform = client.transform_external('https://someurl.com').fallback(handle: 'DEFAULT_HANDLE?policy=HANDLE_APIKEY_POLICY&signature=HANDLE_APIKEY_SIGNATURE', cache: 10) +``` + ### Tagging If you have auto-tagging enabled onto your account, it can be called on any filelink object (tags don't work on external URLs). diff --git a/docs/TransformConfig.html b/docs/TransformConfig.html index 78b2183..ab3046a 100644 --- a/docs/TransformConfig.html +++ b/docs/TransformConfig.html @@ -113,7 +113,7 @@

Constant Summary

blackwhite sepia pixelate oil_paint negative modulate partial_pixelate partial_blur collage upscale enhance redeye ascii filetype_conversion quality urlscreenshot - no_metadata + no_metadata fallback ].freeze diff --git a/lib/filestack/config.rb b/lib/filestack/config.rb index 488d1f1..7d864dd 100644 --- a/lib/filestack/config.rb +++ b/lib/filestack/config.rb @@ -35,6 +35,7 @@ class TransformConfig torn_edges shadow circle border sharpen blur monochrome blackwhite sepia pixelate oil_paint negative modulate partial_pixelate partial_blur collage upscale enhance - redeye ascii filetype_conversion quality urlscreenshot no_metadata + redeye ascii filetype_conversion quality urlscreenshot + no_metadata fallback ].freeze end