curl类型和ruby-rest客户端

curl类型和ruby-rest客户端,ruby,json,curl,rest-client,Ruby,Json,Curl,Rest Client,我无法将curl命令转换为ruby rest客户端 curl'http://localhost:8080/../attachments“-H”内容类型:多部分/表单数据“-H”CMD授权:xxxx“-X POST-F附件=”{“\u说明”:“这是测试”;类型=应用程序/json'-F文件=@/root/Desktop/rest/saturn.bin 主要问题与附件格式中的“type=application/json”有关 我的代码是: require 'base64' require 'rest

我无法将curl命令转换为ruby rest客户端

curl'http://localhost:8080/../attachments“-H”内容类型:多部分/表单数据“-H”CMD授权:xxxx“-X POST-F附件=”{“\u说明”:“这是测试”;类型=应用程序/json'-F文件=@/root/Desktop/rest/saturn.bin

主要问题与附件格式中的“type=application/json”有关

我的代码是:

require 'base64'
require 'rest-client'
require 'json'
....
file1=File.new('/root/Desktop/rest/saturn.bin','rb')
response =RestClient.post("#{uri}",
{
:attachment=>'{"_description":"this is test";"type"=>"application/json"}',
:file=>file1,
},{:cmd_authorization=>"#{@session_id}"})`
我尝试了其他代码组合,例如:content\u type=>“application/json”在标题中添加,但没有成功。感谢您的支持