Class: SignwellSDK::Resources::V1::DocumentTemplates

Inherits:
Object
  • Object
show all
Defined in:
lib/signwell_sdk/resources/v1/document_templates.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ DocumentTemplates

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DocumentTemplates.

Parameters:



198
199
200
# File 'lib/signwell_sdk/resources/v1/document_templates.rb', line 198

def initialize(client:)
  @client = client
end

Instance Method Details

#create(files:, placeholders:, allow_decline: nil, allow_reassign: nil, api_application_id: nil, apply_signing_order: nil, attachment_requests: nil, checkbox_groups: nil, copied_placeholders: nil, decline_redirect_url: nil, draft: nil, expires_in: nil, fields: nil, labels: nil, language: nil, message: nil, metadata: nil, name: nil, redirect_url: nil, reminders: nil, subject: nil, text_tags: nil, request_options: {}) ⇒ SignwellSDK::Models::V1::DocumentTemplate

Some parameter documentations has been truncated, see Models::V1::DocumentTemplateCreateParams for more details.

Creates a new template.

Parameters:

  • files (Array<SignwellSDK::Models::V1::DocumentFile>)

    Document files can be uploaded by specifying a file URL or base64 string. Either

  • placeholders (Array<SignwellSDK::Models::V1::DocumentTemplateCreateParams::Placeholder>)

    Placeholders are generally job roles that must complete and/or sign the document

  • allow_decline (Boolean)

    Whether to allow recipients the option to decline signing a document. If multipl

  • allow_reassign (Boolean)

    In some cases a signer is not the right person to sign and may need to reassign

  • api_application_id (String)

    Unique identifier for API Application settings to use. API Applications are opti

  • apply_signing_order (Boolean)

    When set to ‘true` recipients will sign one at a time in the order of the `recip

  • attachment_requests (Array<SignwellSDK::Models::V1::DocumentTemplateCreateParams::AttachmentRequest>)

    Attachments that a recipient must upload to complete the signing process. Attach

  • checkbox_groups (Array<SignwellSDK::Models::V1::TemplateCheckboxGroup>)

    Checkbox fields that are placed on a document can be grouped with selection requ

  • copied_placeholders (Array<SignwellSDK::Models::V1::DocumentTemplateCreateParams::CopiedPlaceholder>)

    Copied placeholders are emailed the final document once it has been completed by

  • decline_redirect_url (String)

    A URL that recipients are redirected to if the document is declined.

  • draft (Boolean)

    Whether the template can still be updated before it is ready for usage. If set t

  • expires_in (Integer)

    Number of days before the signature request expires. Defaults to the account exp

  • fields (Array<Array<SignwellSDK::Models::V1::DocumentTemplateCreateParams::Field>>)

    Document fields placed on a document for collecting data or signatures from reci

  • labels (Array<SignwellSDK::Models::V1::Label>)

    Labels can be used to organize documents in a way that can make it easy to find

  • language (String)

    Sets the language for the template and documents created from the template for a

  • message (String)

    Email message for the signature request that recipients will see. Defaults to th

  • metadata (Hash{Symbol=>String})

    Optional key-value data that can be associated with the document. If set, will b

  • name (String)

    The name of the template.

  • redirect_url (String)

    A URL that recipients are redirected to after successfully signing a document.

  • reminders (Boolean)

    Whether to send signing reminders to recipients. Reminders are sent on day 3, da

  • subject (String)

    Email subject for the signature request that recipients will see. Defaults to th

  • text_tags (Boolean)

    An alternative way (if you can’t use the recommended way) of placing fields in s

  • request_options (SignwellSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
# File 'lib/signwell_sdk/resources/v1/document_templates.rb', line 63

def create(params)
  parsed, options = SignwellSDK::V1::DocumentTemplateCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/v1/document_templates",
    body: parsed,
    model: SignwellSDK::V1::DocumentTemplate,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

Deletes a template. Supply the unique template ID from either a Create Template request or template page URL.

Parameters:

Returns:

  • (nil)

See Also:



186
187
188
189
190
191
192
193
# File 'lib/signwell_sdk/resources/v1/document_templates.rb', line 186

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["api/v1/document_templates/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(limit: nil, page: nil, request_options: {}) ⇒ SignwellSDK::Models::V1::DocumentTemplateListResponse

Returns a paginated list of templates for the authenticated account.

Parameters:

  • limit (Integer)

    The number of documents to fetch. Defaults to 10, max is 50.

  • page (Integer)

    The page number for pagination. Defaults to the first page.

  • request_options (SignwellSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



163
164
165
166
167
168
169
170
171
172
# File 'lib/signwell_sdk/resources/v1/document_templates.rb', line 163

def list(params = {})
  parsed, options = SignwellSDK::V1::DocumentTemplateListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "api/v1/document_templates",
    query: parsed,
    model: SignwellSDK::Models::V1::DocumentTemplateListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ SignwellSDK::Models::V1::DocumentTemplate

Returns a template and all associated template data. Supply the unique template ID from either a Create Template request or template page URL.

Parameters:

Returns:

See Also:



86
87
88
89
90
91
92
93
# File 'lib/signwell_sdk/resources/v1/document_templates.rb', line 86

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["api/v1/document_templates/%1$s", id],
    model: SignwellSDK::V1::DocumentTemplate,
    options: params[:request_options]
  )
end

#update(id, allow_decline: nil, allow_reassign: nil, api_application_id: nil, apply_signing_order: nil, checkbox_groups: nil, decline_redirect_url: nil, draft: nil, expires_in: nil, labels: nil, message: nil, metadata: nil, name: nil, redirect_url: nil, reminders: nil, subject: nil, request_options: {}) ⇒ SignwellSDK::Models::V1::DocumentTemplate

Some parameter documentations has been truncated, see Models::V1::DocumentTemplateUpdateParams for more details.

Updates an existing template.

Parameters:

  • id (String)

    Unique identifier for a template.

  • allow_decline (Boolean)

    Whether to allow recipients the option to decline signing a document. If multipl

  • allow_reassign (Boolean)

    In some cases a signer is not the right person to sign and may need to reassign

  • api_application_id (String)

    Unique identifier for API Application settings to use. API Applications are opti

  • apply_signing_order (Boolean)

    When set to ‘true` recipients will sign one at a time in the order of the `recip

  • checkbox_groups (Array<SignwellSDK::Models::V1::TemplateCheckboxGroup>)

    Checkbox fields that are placed on a document can be grouped with selection requ

  • decline_redirect_url (String)

    A URL that recipients are redirected to if the document is declined.

  • draft (Boolean)

    Whether the template can still be updated before it is ready for usage. If set t

  • expires_in (Integer)

    Number of days before the signature request expires. Defaults to the account exp

  • labels (Array<SignwellSDK::Models::V1::Label>)

    Labels can be used to organize documents in a way that can make it easy to find

  • message (String)

    Email message for the signature request that recipients will see. Defaults to th

  • metadata (Hash{Symbol=>String})

    Optional key-value data that can be associated with the document. If set, will b

  • name (String)

    The name of the template.

  • redirect_url (String)

    A URL that recipients are redirected to after successfully signing a document.

  • reminders (Boolean)

    Whether to send signing reminders to recipients. Reminders are sent on day 3, da

  • subject (String)

    Email subject for the signature request that recipients will see. Defaults to th

  • request_options (SignwellSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



139
140
141
142
143
144
145
146
147
148
# File 'lib/signwell_sdk/resources/v1/document_templates.rb', line 139

def update(id, params = {})
  parsed, options = SignwellSDK::V1::DocumentTemplateUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["api/v1/document_templates/%1$s", id],
    body: parsed,
    model: SignwellSDK::V1::DocumentTemplate,
    options: options
  )
end