From f503afd9c5a0062cd2070601d9ae489bcc53c117 Mon Sep 17 00:00:00 2001 From: Bunglfy Apps Date: Wed, 13 Feb 2019 07:37:36 -0500 Subject: [PATCH 1/3] add attachment list method --- lib/docusign_rest/client.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/docusign_rest/client.rb b/lib/docusign_rest/client.rb index 7c931c7c..be1f16ac 100644 --- a/lib/docusign_rest/client.rb +++ b/lib/docusign_rest/client.rb @@ -1364,6 +1364,23 @@ def get_combined_document_from_envelope(options={}) end end + # Public retrieves the list of attachments from a given envelope + # + # envelope_id - ID of the envelope from which document infos are to be retrieved + # + # Returns a hash containing the envelopeId, the attachmentId and the attachment meta + def get_attachment_list_from_envelope(options={}) + content_type = { 'Content-Type' => 'application/json' } + content_type.merge(options[:headers]) if options[:headers] + + uri = build_uri("/accounts/#{acct_id}/envelopes/#{options[:envelope_id]}/attachments") + + http = initialize_net_http_ssl(uri) + request = Net::HTTP::Get.new(uri.request_uri, headers(content_type)) + response = http.request(request) + generate_log(request, response, uri) + JSON.parse(response.body) + end # Public moves the specified envelopes to the given folder # From c741d29f6e79802e7b4786ef9cee76e12376911a Mon Sep 17 00:00:00 2001 From: Bunglfy Apps Date: Wed, 13 Feb 2019 14:44:44 -0500 Subject: [PATCH 2/3] get document list with attachment ids --- lib/docusign_rest/client.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/docusign_rest/client.rb b/lib/docusign_rest/client.rb index be1f16ac..90aa2bfc 100644 --- a/lib/docusign_rest/client.rb +++ b/lib/docusign_rest/client.rb @@ -1318,7 +1318,7 @@ def get_documents_from_envelope(options={}) request = Net::HTTP::Get.new(uri.request_uri, headers(content_type)) response = http.request(request) generate_log(request, response, uri) - JSON.parse(response.body) + response.body end @@ -1364,19 +1364,18 @@ def get_combined_document_from_envelope(options={}) end end - # Public retrieves the list of attachments from a given envelope + # Public retrieves the list of all documents, including attachments from a given envelope # # envelope_id - ID of the envelope from which document infos are to be retrieved # - # Returns a hash containing the envelopeId, the attachmentId and the attachment meta - def get_attachment_list_from_envelope(options={}) - content_type = { 'Content-Type' => 'application/json' } - content_type.merge(options[:headers]) if options[:headers] + # Returns a hash containing the envelopeId, the documentId and the attachmentTabId, the document name (or filename) and other document meta + def get_document_list_from_envelope(options={}) + envelope_id = options[:envelope_id] - uri = build_uri("/accounts/#{acct_id}/envelopes/#{options[:envelope_id]}/attachments") + uri = build_uri("/accounts/#{acct_id}/envelopes/#{envelope_id}/documents") http = initialize_net_http_ssl(uri) - request = Net::HTTP::Get.new(uri.request_uri, headers(content_type)) + request = Net::HTTP::Get.new(uri.request_uri, headers) response = http.request(request) generate_log(request, response, uri) JSON.parse(response.body) From 7dce036b402e4cab4383f3e26b4dcf369a6688e1 Mon Sep 17 00:00:00 2001 From: Bunglfy Apps Date: Thu, 14 Feb 2019 08:47:57 -0500 Subject: [PATCH 3/3] retrieve list of templates for a given envelope --- lib/docusign_rest/client.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/docusign_rest/client.rb b/lib/docusign_rest/client.rb index 90aa2bfc..4fd829cd 100644 --- a/lib/docusign_rest/client.rb +++ b/lib/docusign_rest/client.rb @@ -984,6 +984,24 @@ def create_envelope_from_composite_template(options={}) JSON.parse(response.body) end + + # Public gets the template_ids in an agreement + # + # envelope_id] - ID of the envelope which you want to send + # + # Returns the template list in a hash + def get_templates_from_envelope(options) + content_type = { 'Content-Type' => 'application/json' } + uri = build_uri("/accounts/#{acct_id}/envelopes/#{options[:envelope_id]}/templates/") + + http = initialize_net_http_ssl(uri) + request = Net::HTTP::Get.new(uri.request_uri, headers(content_type)) + response = http.request(request) + generate_log(request, response, uri) + JSON.parse(response.body) + end + + # Public fetches custom fields for a document # # options[:envelope_id] - ID of the envelope which you want to send