不知道你是否明白这一点或不完全。这是另一个解决方案,使用httparty并不困难。如果你想创建例如模板的文档,你的要求看起来可能是这样:
baseUrl = "https://demo.docusign.net/restapi/v2/accounts/acct_number/envelopes"
@lease = Lease.find(lease.id)
@unit = @lease.unit
@application = @lease.application
@manager = @lease.property_manager
@application.applicants.each do |renter|
req = HTTParty.post(baseUrl,
body: {
"emailSubject": "DocuSign API call - Request Signature - Boom",
"templateId": "id of your template",
"templateRoles": [{
"name": "#{renter.background.legal_name}",
"email": "#{renter.email}",
"recipientId": "1",
"roleName": "Lessee",
"tabs": {
"texttabs": [{
"tablabel": "Rent",
"value": "#{@lease.rent}"
},{
"tablabel": "Address",
"value": "987 apple lane"
}]
}
},{
"email": "#{@manager.email}",
"name": "#{@manager.name}",
"roleName": "Lessor",
"tabs": {
"texttabs": [{
"tablabel": "Any",
"value": "#{@lease.labels}"
},{
"tablabel": "Address",
"value": "987 hoser lane"
}]
}
}],
"status": "sent"
}.to_json,
headers: {
"Content-Type" => "application/json",
'Accept' => 'application/json',
'X-DocuSign-Authentication' => '{
"Username" : "place your",
"Password" : "credentials",
"IntegratorKey" : "here"
}'
}, :debug_output => $stdout)
最终线调试输出是让你调试API请求,其可以在去除任何时候。
你试过'config.api_version ='v2''吗? – DiegoSalazar