MultiPart POST com script de upload de imagem

require 'rest_client'


@image1 = { :file => File.new("spec/support/labrador.jpg") }

@images = [ {@image1} ]

@params = {:name => "Test", :description => "aaaa",
:website => "http://something.com",
:unlocked_time => "00:30:00",
:company_id => "1",
:image_url => "aaaaaa",
:images_attributes => @images
}



url
= "http://localhost:3000/api/products"


begin
response
= RestClient.post url,{ :product => @params }
p response
.to_str
rescue => e
p e
.response
end