lib/filestack/utils/utils.rb
# Uploads to v1 REST API (for external URLs or if multipart is turned off)
#
# @param [String]             apikey         Filestack API key
# @param [String]             external_url   External URL to be uploaded
# @param [FilestackSecurity]  security       Security object with
#                                            policy/signature
# @param [Hash]               options        User-defined options for
#                                            multipart uploads
# @return [Hash]
Uploads to v1 REST API (for external URLs or if multipart is turned off)
Uploads to v1 REST API ( for external URLs or if multipart is turned off )
def send_upload(apikey, external_url = nil, security = nil, options = nil)
    base = "#{FilestackConfig::CDN_URL}/#{apikey}/#{build_store_task(options)}"
    if security
      policy = security.policy
      signature = security.signature
      base = "#{base}/security=s:#{signature},p:#{policy}"
    end
    response = Typhoeus.post("#{base}/#{external_url}", headers: FilestackConfig::HEADERS)
    if response.code == 200
      begin
        response_body = JSON.parse(response.body)
        return response_body
      rescue
        raise response.body
      end
    end
    raise response.body
  end
def send_upload ( apikey , external_url = nil , security = nil , options = nil ) base = "#{FilestackConfig::CDN_URL}/#{apikey}/#{build_store_task(options)}" if security policy = security . policy signature = security . signature base = "#{base}/security=s:#{signature},p:#{policy}" end response = Typhoeus . post ( "#{base}/#{external_url}" , headers : FilestackConfig :: HEADERS ) if response . code == 200 begin response_body = JSON . parse ( response . body ) return response_body rescue raise response . body end end raise response . body end
Uploads to v1 REST API (for external URLs or if multipart is turned off)
Uploads to v1 REST API ( for external URLs or if multipart is turned off )
None
Hash
apikey
<not_specific>
external_url
<not_specific>
security
<not_specific>
options
<not_specific>
<not_specific>
options User-defined options for multipart uploads
options User - defined options for multipart uploads