2016-09-19 1 views
1

DocuSign REST API에 docusign_rest 보석을 사용하고 있으며 다음은 DocuSign 구성입니다.레일과 Docusign 통합 4

# config/initializers/docusign_rest.rb 

require 'docusign_rest' 
DocusignRest.configure do |config| 
    config.username  = '[email protected]' 
    config.password  = 'MyPassword' 
    config.integrator_key = 'My-key' 
    config.account_id  = 'account_id' 
    config.endpoint  = 'https://www.docusign.net/restapi' 
    config.api_version = 'v1' 
end 

account_id에 연결하려고하면 응답으로 nil이 표시됩니다.

client = DocusignRest::Client.new 
puts client.get_account_id   # Returns nil. 

나는 rails-4.1.4

나는 무엇을 그리워 않았다 ruby-2.2.2을 사용하고? 제발 제안 해주세요.

+1

'config.api_version = 'v2''을 사용해 보셨습니까? – DiegoSalazar

답변

1

당신이 이것을 알아 냈는지 확실치 않은지 확실하지 않습니다. 여기에 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 요청을 디버깅 할 수 있도록하는 것입니다, 그것은에서 제거 할 수 있습니다 언제든지.

1

이것은 docusign_rest 0.1.1의 버그입니다. 이 메서드는 항상 nil을 반환했습니다. 해당 버그는 fixed이고 최신 보석 버전에는 수정 사항이 포함되어 있습니다.