I was able to solve the problem with the parameters. The parameters work if I make the call like this:
def request_and_send_file
response = RestClient.get("https://some.service.com/api/pdf", :params => {
doc_id: 99,
"data[info1]" => "some info",
"data[info2]" => "more info"})
send_data response.body, filename: "customer.pdf", disposition: "attachment", :content_type => 'application/pdf'
end
What I still could not figure out, is why I cannot serve the file I get from the HTTP call via send_file
, but have to use send_data
.