使用带有Echosign API的savon发布预填充PDF

时间:2014-06-15 20:23:13

标签: ruby-on-rails ruby api savon echosign

我正在使用savonrb作为SOAP客户端来发出api请求来回显以生成小部件。
似乎savon只用最后一个的值覆盖我的mergeField,而不是将它们作为数组传递。

我正在用来打电话的短信:

call_api(:create_personal_embedded_widget, senderInfo: {email: sender_email}, widgetInfo: {
 "callbackInfo" => {
   "signedDocumentUrl" => signed_document_url
 },  
 "fileInfos" => {
   "FileInfo" => {
     "file" =>encoded_file,
     "fileName" =>"simple_text.docx",
     "mimeType "=>"application/msword"
   }  
 },  
 "formFieldLayerTemplates" => "",
 "locale" => "",
 "mergeFieldInfo" => {
   "mergeFields" => {
     "MergeField" => 
     {
       "defaultValue" => "Foo Bar",
       "fieldName" => "fullName"
     },  
     "MergeField" => 
     {
       "defaultValue" => "01-01-1980",
       "fieldName" => "dob"
     }
   }  
 },  
 "name" => document_name,
 "securityOptions" => "",
 "signatureFlow" =>"SENDER_SIGNS_LAST",
 "widgetAuthFailureInfo" => {
   "deframe" =>"true",
   "delay" =>"10",
   "url" => error_call_back_url
 },  
 "widgetCompletionInfo" => {
   "deframe" =>"true",
   "delay" =>"10",
   "url" => success_call_back_url
 }  
}, personalizationInfo: "")  

实际传递给echosign的内容:

<ins2:mergeFieldInfo>
  <ins3:mergeFields>
    <ins3:MergeField>
      <ins3:defaultValue>01-01-1980</ins3:defaultValue>
      <ins3:fieldName>dob</ins3:fieldName>
    </ins3:MergeField>
  </ins3:mergeFields>
</ins2:mergeFieldInfo>

我一直在喋喋不休地说这是无济于事的,我认为它会覆盖这些值,但却无法理解为什么,也不确定如何对它们进行索引以使字段为增量。

提前致谢!

1 个答案:

答案 0 :(得分:0)

似乎不是肥皂或savon的问题,我是不是正确创建阵列,

mergeFields = { 'MergeField' => [ 
    {'defaultValue' => 'Foo Bar', 'fieldName' => 'fullName' }, 
    {'defaultValue' => '212-555-1234',   'fieldName' => 'phoneNumber },
  ] 
}

并且在哈希内部,我只是放入变量

"mergeFieldInfo" => {
    "mergeFields" => mergeFields
},