Sha256: d14d03c4ae8f7d903a7d01b8c17449ae93d36f5df2a38121b18427eb72734a97
Contents?: true
Size: 651 Bytes
Versions: 11
Compression:
Stored size: 651 Bytes
Contents
require 'uri' module ConvertApi class UploadIO def initialize(io, filename = nil) @io = io @filename = filename || io_filename || raise(FileNameError, 'IO filename must be provided') end def to_s file_id end def file_id result['FileId'] end def file_name result['FileName'] end def file_ext result['FileExt'] end private def result @result ||= upload_file end def upload_file ConvertApi.client.upload(@io, @filename) end def io_filename return unless @io.respond_to?(:path) File.basename(@io.path) end end end
Version data entries
11 entries across 11 versions & 2 rubygems