# File lib/koala/http_service/uploadable_io.rb, line 26 def to_file @io_or_path.is_a?(String) ? File.open(@io_or_path) : @io_or_path end
# File lib/koala/http_service/uploadable_io.rb, line 22 def to_upload_io UploadIO.new(@io_or_path, @content_type, @filename) end
# File lib/koala/http_service/uploadable_io.rb, line 30 def self.binary_content?(content) content.is_a?(UploadableIO) || DETECTION_STRATEGIES.detect {|method| send(method, content)} end
# File lib/koala/http_service/uploadable_io.rb, line 9 def initialize(io_or_path_or_mixed, content_type = nil, filename = nil) # see if we got the right inputs parse_init_mixed_param io_or_path_or_mixed, content_type # filename is used in the Ads API # if it's provided, take precedence over the detected filename # otherwise, fall back to a dummy name @filename = filename || @filename || "koala-io-file.dum" raise KoalaError.new("Invalid arguments to initialize an UploadableIO") unless @io_or_path raise KoalaError.new("Unable to determine MIME type for UploadableIO") if !@content_type end