Method: Koala::HTTPService::UploadableIO#initialize
- Defined in:
- lib/koala/http_service/uploadable_io.rb
#initialize(io_or_path_or_mixed, content_type = nil, filename = nil) ⇒ UploadableIO
Returns a new instance of UploadableIO.
9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |