Class: AV
- Inherits:
-
Object
- Object
- AV
- 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
-
#apikey ⇒ Object
readonly
Returns the value of attribute apikey.
-
#security ⇒ Object
readonly
Returns the value of attribute security.
Instance Method Summary collapse
-
#initialize(url, apikey: nil, security: nil) ⇒ AV
constructor
A new instance of AV.
-
#status ⇒ String
Checks the status of the video conversion.
-
#to_filelink ⇒ Filestack::FilestackFilelink
Turns AV into filelink if video conversion is complete.
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.
11 12 13 14 15 |
# File 'lib/filestack/models/filestack_av.rb', line 11 def initialize(url, apikey: nil, security: nil) @url = url @apikey = apikey @security = security end |
Instance Attribute Details
#apikey ⇒ Object (readonly)
Returns the value of attribute apikey.
9 10 11 |
# File 'lib/filestack/models/filestack_av.rb', line 9 def apikey @apikey end |
#security ⇒ Object (readonly)
Returns the value of attribute security.
9 10 11 |
# File 'lib/filestack/models/filestack_av.rb', line 9 def security @security end |
Instance Method Details
#status ⇒ String
Checks the status of the video conversion
31 32 33 34 35 |
# File 'lib/filestack/models/filestack_av.rb', line 31 def status response = UploadUtils.make_call(@url, 'get') response_body = JSON.parse(response.body) response_body['status'] end |
#to_filelink ⇒ Filestack::FilestackFilelink
Turns AV into filelink if video conversion is complete
20 21 22 23 24 25 26 |
# File 'lib/filestack/models/filestack_av.rb', line 20 def to_filelink return 'Video conversion incomplete' unless status == 'completed' response = UploadUtils.make_call(@url, 'get') response_body = JSON.parse(response.body) handle = response_body['data']['url'].split('/').last FilestackFilelink.new(handle, apikey: @apikey, security: @security) end |