Class: Boldsign::Resources::Document

Inherits:
Boldsign::Resource show all
Defined in:
lib/boldsign/resources/document.rb

Overview

Document endpoints (‘/v1/document/*`) — the bulk of the BoldSign API: sending, listing, downloading, editing, reminding, authenticating, tagging, and embedded signing flows.

Examples:

Send a document (JSON body)

client.documents.send_document(
  title: "NDA",
  signers: [{ name: "Jane", emailAddress: "jane@example.com", signerOrder: 1 }]
)

Send a document with file uploads (multipart)

client.documents.send_document(
  title: "NDA",
  signers: [{ name: "Jane", emailAddress: "jane@example.com", signerOrder: 1 }],
  files: [{ io: StringIO.new(pdf_bytes), filename: "nda.pdf", content_type: "application/pdf" }]
)

See Also:

Instance Method Summary collapse

Methods inherited from Boldsign::Resource

#initialize

Constructor Details

This class inherits a constructor from Boldsign::Resource

Instance Method Details

#add_authentication(document_id, body) ⇒ Object



70
# File 'lib/boldsign/resources/document.rb', line 70

def add_authentication(document_id, body);    @client.patch("/v1/document/addAuthentication", body: body, params: { documentId: document_id }); end

#add_tags(body) ⇒ Object



66
# File 'lib/boldsign/resources/document.rb', line 66

def add_tags(body);    @client.patch("/v1/document/addTags", body: body); end

#behalf_list(**params) ⇒ Object



24
# File 'lib/boldsign/resources/document.rb', line 24

def behalf_list(**params); @client.get("/v1/document/behalfList", params); end

#cancel_editing(document_id) ⇒ Object



48
# File 'lib/boldsign/resources/document.rb', line 48

def cancel_editing(document_id); @client.post("/v1/document/cancelEditing", params: { documentId: document_id }); end

#change_access_code(document_id, body) ⇒ Object



63
# File 'lib/boldsign/resources/document.rb', line 63

def change_access_code(document_id, body); @client.patch("/v1/document/changeAccessCode", body: body, params: { documentId: document_id }); end

#change_recipient(document_id, body) ⇒ Object



64
# File 'lib/boldsign/resources/document.rb', line 64

def change_recipient(document_id, body);   @client.patch("/v1/document/changeRecipient", body: body, params: { documentId: document_id }); end

#create_embedded_edit_url(body) ⇒ Object



51
# File 'lib/boldsign/resources/document.rb', line 51

def create_embedded_edit_url(body);    @client.post("/v1/document/createEmbeddedEditUrl", body: body); end

#create_embedded_request_url(body) ⇒ Object



50
# File 'lib/boldsign/resources/document.rb', line 50

def create_embedded_request_url(body); @client.post("/v1/document/createEmbeddedRequestUrl", body: body); end

#delete(document_id) ⇒ Object



60
# File 'lib/boldsign/resources/document.rb', line 60

def delete(document_id);            @client.delete("/v1/document/delete", documentId: document_id); end

#delete_tags(body) ⇒ Object



67
# File 'lib/boldsign/resources/document.rb', line 67

def delete_tags(body); @client.delete("/v1/document/deleteTags", body: body); end

#download(document_id) ⇒ Object



54
# File 'lib/boldsign/resources/document.rb', line 54

def download(document_id);   @client.download("/v1/document/download", documentId: document_id); end

#download_attachment(**params) ⇒ Object



55
# File 'lib/boldsign/resources/document.rb', line 55

def download_attachment(**params); @client.download("/v1/document/downloadAttachment", params); end

#download_audit_log(document_id) ⇒ Object



56
# File 'lib/boldsign/resources/document.rb', line 56

def download_audit_log(document_id); @client.download("/v1/document/downloadAuditLog", documentId: document_id); end

#draft_send(body) ⇒ Object



46
# File 'lib/boldsign/resources/document.rb', line 46

def draft_send(body);     @client.post("/v1/document/draftSend", body: body); end

#edit(document_id, body) ⇒ Object



47
# File 'lib/boldsign/resources/document.rb', line 47

def edit(document_id, body); @client.put("/v1/document/edit", body: body, params: { documentId: document_id }); end

#extend_expiry(document_id, body) ⇒ Object



61
# File 'lib/boldsign/resources/document.rb', line 61

def extend_expiry(document_id, body); @client.patch("/v1/document/extendExpiry", body: body, params: { documentId: document_id }); end


52
# File 'lib/boldsign/resources/document.rb', line 52

def get_embedded_sign_link(**params);  @client.get("/v1/document/getEmbeddedSignLink", params); end

#list(**params) ⇒ Object



22
# File 'lib/boldsign/resources/document.rb', line 22

def list(**params);       @client.get("/v1/document/list", params); end

#prefill_fields(document_id, body) ⇒ Object



72
# File 'lib/boldsign/resources/document.rb', line 72

def prefill_fields(document_id, body); @client.patch("/v1/document/prefillFields", body: body, params: { documentId: document_id }); end

#properties(document_id) ⇒ Object



25
# File 'lib/boldsign/resources/document.rb', line 25

def properties(document_id); @client.get("/v1/document/properties", documentId: document_id); end

#remind(document_id, body = {}) ⇒ Object



59
# File 'lib/boldsign/resources/document.rb', line 59

def remind(document_id, body = {}); @client.post("/v1/document/remind", body: body, params: { documentId: document_id }); end

#remove_authentication(document_id, body) ⇒ Object



69
# File 'lib/boldsign/resources/document.rb', line 69

def remove_authentication(document_id, body); @client.patch("/v1/document/RemoveAuthentication", body: body, params: { documentId: document_id }); end

#revoke(document_id, body = {}) ⇒ Object



58
# File 'lib/boldsign/resources/document.rb', line 58

def revoke(document_id, body = {}); @client.post("/v1/document/revoke", body: body, params: { documentId: document_id }); end

#send_document(files: nil, **body) ⇒ Object

Send a document for signature.

Pass ‘files:` to upload one or more PDFs (or other supported file types) via multipart/form-data. Without `files:`, the request is sent as JSON and BoldSign must already know the file content (e.g. via Base64 in the body or by referencing an existing template).

Parameters:

  • files (Array<Hash>, nil) (defaults to: nil)

    When present, each hash must include ‘:io` and `:filename` and may include `:content_type`. The request switches to multipart/form-data and remaining kwargs are serialized to multipart string parts (non-scalar values become JSON strings).

  • body (Hash)

    Top-level BoldSign send-document fields (‘title:`, `signers:`, `disableEmails:`, `metadata:`, etc.).



40
41
42
43
44
# File 'lib/boldsign/resources/document.rb', line 40

def send_document(files: nil, **body)
  return @client.post("/v1/document/send", body: body) if files.nil?

  @client.post("/v1/document/send", body: multipart_send_body(body, files), multipart: true)
end

#team_list(**params) ⇒ Object



23
# File 'lib/boldsign/resources/document.rb', line 23

def team_list(**params);  @client.get("/v1/document/teamlist", params); end