不知道你是否明白這一點或不完全。這是另一個解決方案,使用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