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.
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) ⇒ FilestackFilelink
constructor
Initialize FilestackFilelink.
-
#metadata(params = {}) ⇒ Typhoeus::Response
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
#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) ⇒ FilestackFilelink
Initialize FilestackFilelink
21 22 23 24 25 |
# File 'lib/filestack/models/filelink.rb', line 21 def initialize(handle, apikey: nil, security: nil) @handle = handle @apikey = apikey @security = security 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 |
Instance Method Details
#delete ⇒ Typhoeus::Response
Delete filelink
46 47 48 |
# File 'lib/filestack/models/filelink.rb', line 46 def delete send_delete(handle, apikey, security) end |
#download(filepath) ⇒ Typhoeus::Response
Download FilestackFilelink
39 40 41 |
# File 'lib/filestack/models/filelink.rb', line 39 def download(filepath) send_download(filepath) end |
#get_content ⇒ Bytes
Get content of filelink
30 31 32 |
# File 'lib/filestack/models/filelink.rb', line 30 def get_content send_get_content(url) end |
#metadata(params = {}) ⇒ Typhoeus::Response
Return metadata for file handle
77 78 79 |
# File 'lib/filestack/models/filelink.rb', line 77 def (params = {}) (@handle, @security, params) end |
#overwrite(filepath) ⇒ Typhoeus::Response
Ovewrite filelink by uploading local file
55 56 57 |
# File 'lib/filestack/models/filelink.rb', line 55 def overwrite(filepath) send_overwrite(filepath, handle, apikey, security) end |
#sfw ⇒ Bool
Return true (SFW) or false (NSFW)
84 85 86 |
# File 'lib/filestack/models/filelink.rb', line 84 def sfw ('sfw', @handle, @security) end |
#tags ⇒ Hash
Return auto and user tags for the filelink
70 71 72 |
# File 'lib/filestack/models/filelink.rb', line 70 def ('tags', @handle, @security) end |
#transform ⇒ Filestack::Transform
Turn the filelink into a transform object to perform transform operations
63 64 65 |
# File 'lib/filestack/models/filelink.rb', line 63 def transform Transform.new(handle: @handle, apikey: @apikey, security: @security) end |
#url ⇒ String
Get the URL of the FilestackFilelink
91 92 93 94 95 |
# File 'lib/filestack/models/filelink.rb', line 91 def url UploadUtils.get_url( FilestackConfig::CDN_URL, handle: handle, security: security ) end |