I'm trying to do a Net::HTTP:POST::Multiport and send some text in a file format to an API.
I get the data from my database, and I don't want to create physical files, I want to create a file on the fly with the data and send it to the API. Right now I have
request = Net::HTTP::Post::Multipart.new("my/path",
{ "file" => UploadIO.new(file, "text/plain", file.path),
"merge" => false,
"ignore_missing" => false,
"label" => "",
"low_priority" => false })
Here file
is supposed to be a file object I read from the disk or an IO
according to http://rubydoc.info/gems/multipart-post/1.1.0/UploadIO#initialize-instance_method, any idea how I can just create a JSON IO from a bunch of strings, without having to create a file and write to it?
Also any idea how I can do this via httmultiparty
?