class FilestackFilelink

This class represents a file stored on your Filestack storage. Once initialized, you may perform transformations, conversions, get metadata, update, or delete it.

Attributes

apikey[R]
handle[R]
security[R]

Public Class Methods

new(handle, apikey: nil, security: nil) click to toggle source

Initialize FilestackFilelink

@param [String] file_handle The FilestackFilelink handle @param [String] apikey Your Filestack API Key (optional) @param [FilestackSecurity] security Filestack security object, if

security is enabled.
# File lib/filestack/models/filelink.rb, line 21
def initialize(handle, apikey: nil, security: nil)
  @handle = handle
  @apikey = apikey
  @security = security
end

Public Instance Methods

delete() click to toggle source

Delete filelink

@return [Typhoeus::Response]

# File lib/filestack/models/filelink.rb, line 46
def delete
  send_delete(handle, apikey, security)
end
download(filepath) click to toggle source

Download FilestackFilelink

@param [String] filepath The local destination of the

downloaded filelink

@return [Typhoeus::Response]

# File lib/filestack/models/filelink.rb, line 39
def download(filepath)
  send_download(url, filepath)
end
get_content() click to toggle source

Get content of filelink

@return [Bytes]

# File lib/filestack/models/filelink.rb, line 30
def get_content
  send_get_content(url)
end
metadata(params = {}) click to toggle source

Return metadata for file handle

@return [Hash]

# File lib/filestack/models/filelink.rb, line 77
def metadata(params = {})
  send_metadata(@handle, @security, params)
end
overwrite(filepath) click to toggle source

Ovewrite filelink by uploading local file

@param [String] filepath filepath of file to upload

@return [Typhoeus::Response]

# File lib/filestack/models/filelink.rb, line 55
def overwrite(filepath)
  send_overwrite(filepath, handle, apikey, security)
end
sfw() click to toggle source

Return true (SFW) or false (NSFW)

@return [Bool]

# File lib/filestack/models/filelink.rb, line 84
def sfw
  send_tags('sfw', @handle, @security)
end
tags() click to toggle source

Return auto and user tags for the filelink

@return [Hash]

# File lib/filestack/models/filelink.rb, line 70
def tags
  send_tags('tags', @handle, @security)
end
transform() click to toggle source

Turn the filelink into a transform object to perform transform operations

@return [Filestack::Transform]

# File lib/filestack/models/filelink.rb, line 63
def transform
  Transform.new(handle: @handle, apikey: @apikey, security: @security)
end
url() click to toggle source

Get the URL of the FilestackFilelink

@return [String]

# File lib/filestack/models/filelink.rb, line 91
def url
  UploadUtils.get_url(
    FilestackConfig::CDN_URL, handle: handle, security: security
  )
end