Class: FilestackFilelink
- Inherits:
-
Object
- Object
- FilestackFilelink
- Includes:
- FilestackCommon, UploadUtils
- Defined in:
- lib/filestack/models/filelink.rb
Overview
This class represents a file stored on your Filestack storage. Once initialized, you may perform transformations, conversions, get metadata, update, or delete it.
Instance Attribute Summary collapse
-
#apikey ⇒ Object
readonly
Returns the value of attribute apikey.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#security ⇒ Object
readonly
Returns the value of attribute security.
-
#upload_response ⇒ Object
readonly
Returns the value of attribute upload_response.
Instance Method Summary collapse
-
#delete ⇒ Typhoeus::Response
Delete filelink.
-
#download(filepath) ⇒ Typhoeus::Response
Download FilestackFilelink.
-
#get_content ⇒ Bytes
Get content of filelink.
-
#initialize(handle, apikey: nil, security: nil, upload_response: nil) ⇒ FilestackFilelink
constructor
Initialize FilestackFilelink.
-
#metadata(params = {}) ⇒ Hash
Return metadata for file handle.
-
#overwrite(filepath) ⇒ Typhoeus::Response
Ovewrite filelink by uploading local file.
-
#sfw ⇒ Bool
Return true (SFW) or false (NSFW).
-
#tags ⇒ Hash
Return auto and user tags for the filelink.
-
#transform ⇒ Filestack::Transform
Turn the filelink into a transform object to perform transform operations.
-
#url ⇒ String
Get the URL of the FilestackFilelink.
Methods included from UploadUtils
#build_store_task, #get_url, #make_call, #send_upload
Methods included from FilestackCommon
#send_delete, #send_download, #send_get_content, #send_metadata, #send_overwrite, #send_tags
Constructor Details
#initialize(handle, apikey: nil, security: nil, upload_response: nil) ⇒ FilestackFilelink
Initialize FilestackFilelink
21 22 23 24 25 26 |
# File 'lib/filestack/models/filelink.rb', line 21 def initialize(handle, apikey: nil, security: nil, upload_response: nil) @handle = handle @apikey = apikey @security = security @upload_response = upload_response end |
Instance Attribute Details
#apikey ⇒ Object (readonly)
Returns the value of attribute apikey.
13 14 15 |
# File 'lib/filestack/models/filelink.rb', line 13 def apikey @apikey end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
13 14 15 |
# File 'lib/filestack/models/filelink.rb', line 13 def handle @handle end |
#security ⇒ Object (readonly)
Returns the value of attribute security.
13 14 15 |
# File 'lib/filestack/models/filelink.rb', line 13 def security @security end |
#upload_response ⇒ Object (readonly)
Returns the value of attribute upload_response.
13 14 15 |
# File 'lib/filestack/models/filelink.rb', line 13 def upload_response @upload_response end |
Instance Method Details
#delete ⇒ Typhoeus::Response
Delete filelink
47 48 49 |
# File 'lib/filestack/models/filelink.rb', line 47 def delete send_delete(handle, apikey, security) end |
#download(filepath) ⇒ Typhoeus::Response
Download FilestackFilelink
40 41 42 |
# File 'lib/filestack/models/filelink.rb', line 40 def download(filepath) send_download(url, filepath) end |
#get_content ⇒ Bytes
Get content of filelink
31 32 33 |
# File 'lib/filestack/models/filelink.rb', line 31 def get_content send_get_content(url) end |
#metadata(params = {}) ⇒ Hash
Return metadata for file handle
78 79 80 |
# File 'lib/filestack/models/filelink.rb', line 78 def (params = {}) (@handle, @security, params) end |
#overwrite(filepath) ⇒ Typhoeus::Response
Ovewrite filelink by uploading local file
56 57 58 |
# File 'lib/filestack/models/filelink.rb', line 56 def overwrite(filepath) send_overwrite(filepath, handle, apikey, security) end |
#sfw ⇒ Bool
Return true (SFW) or false (NSFW)
85 86 87 |
# File 'lib/filestack/models/filelink.rb', line 85 def sfw ('sfw', @handle, @security) end |
#tags ⇒ Hash
Return auto and user tags for the filelink
71 72 73 |
# File 'lib/filestack/models/filelink.rb', line 71 def ('tags', @handle, @security) end |
#transform ⇒ Filestack::Transform
Turn the filelink into a transform object to perform transform operations
64 65 66 |
# File 'lib/filestack/models/filelink.rb', line 64 def transform Transform.new(handle: @handle, apikey: @apikey, security: @security) end |
#url ⇒ String
Get the URL of the FilestackFilelink
92 93 94 95 96 |
# File 'lib/filestack/models/filelink.rb', line 92 def url UploadUtils.get_url( FilestackConfig::CDN_URL, handle: handle, security: security ) end |