Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List documents incl attachmentIds & find templates associated with an envelope #140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion lib/docusign_rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1318,7 +1336,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


Expand Down Expand Up @@ -1364,6 +1382,22 @@ def get_combined_document_from_envelope(options={})
end
end

# 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 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/#{envelope_id}/documents")

http = initialize_net_http_ssl(uri)
request = Net::HTTP::Get.new(uri.request_uri, headers)
response = http.request(request)
generate_log(request, response, uri)
JSON.parse(response.body)
end

# Public moves the specified envelopes to the given folder
#
Expand Down