Class: AV

Inherits:
Object
  • Object
show all
Includes:
UploadUtils
Defined in:
lib/filestack/models/filestack_av.rb

Overview

Class for AV objects – allows to check status and upgrade to filelink once completed

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UploadUtils

#get_url, #make_call, #send_upload

Constructor Details

#initialize(url, apikey: nil, security: nil) ⇒ AV

Returns a new instance of AV



10
11
12
13
14
# File 'lib/filestack/models/filestack_av.rb', line 10

def initialize(url, apikey: nil, security: nil)
  @url = url
  @apikey = apikey
  @security = security
end

Instance Attribute Details

#apikeyObject (readonly)

Returns the value of attribute apikey



8
9
10
# File 'lib/filestack/models/filestack_av.rb', line 8

def apikey
  @apikey
end

#securityObject (readonly)

Returns the value of attribute security



8
9
10
# File 'lib/filestack/models/filestack_av.rb', line 8

def security
  @security
end

Instance Method Details

#statusString

Checks the status of the video conversion

Returns:

  • (String)


29
30
31
# File 'lib/filestack/models/filestack_av.rb', line 29

def status
  UploadUtils.make_call(@url, 'get').body['status']
end

Turns AV into filelink if video conversion is complete

Returns:

  • (Filestack::FilestackFilelink)


19
20
21
22
23
24
# File 'lib/filestack/models/filestack_av.rb', line 19

def to_filelink
  return 'Video conversion incomplete' unless status == 'completed'
  response = UploadUtils.make_call(@url, 'get').body
  handle = response['data']['url'].split('/').last
  FilestackFilelink.new(handle, apikey: @apikey, security: @security)
end