lib/filestack/models/filestack_av.rb in filestack-2.3.0 vs lib/filestack/models/filestack_av.rb in filestack-2.4.0

- old
+ new

@@ -1,7 +1,8 @@ require 'filestack/models/filelink' require 'filestack/utils/utils' +require 'json' # Class for AV objects -- allows to check status # and upgrade to filelink once completed class AV include UploadUtils @@ -16,17 +17,20 @@ # Turns AV into filelink if video conversion is complete # # @return [Filestack::FilestackFilelink] def to_filelink return 'Video conversion incomplete' unless status == 'completed' - response = UploadUtils.make_call(@url, 'get').body - handle = response['data']['url'].split('/').last + 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 # Checks the status of the video conversion # # @return [String] def status - UploadUtils.make_call(@url, 'get').body['status'] + response = UploadUtils.make_call(@url, 'get') + response_body = JSON.parse(response.body) + response_body['status'] end end