Module: HelloSign::Api::Template

Included in:
Client
Defined in:
lib/hello_sign/api/template.rb

Overview

Contains all the api calls for the Template resource. Take a look at our template form api document for more information about this.

Author:

  • hellosign

Instance Method Summary collapse

Instance Method Details

#add_user_to_template(opts) ⇒ Template

Gives the specified Account on your team access to a Template

Examples:

templates = @client.add_user_to_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35', :email_address => '[email protected]'

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • template_id (String)

    The id of the Template to give access to.

  • account_id (String)

    The id of the Account to get access. The account_id prevails if account_id and email_address are both provided.

  • email_address (String)

    The email address of the Account to give access to the Template. The account_id prevails if account_id and email_address are both provided.

Returns:



53
54
55
56
57
# File 'lib/hello_sign/api/template.rb', line 53

def add_user_to_template opts
  path = "/template/add_user/#{opts[:template_id]}"
  opts.delete(:template_id)
  HelloSign::Resource::Template.new post(path, :body => opts)
end

#get_template(opts) ⇒ HelloSign::Resource::Template

Retrieves the Template specified by the id parameter.

Examples:

template = @client.get_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35'

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • template_id (String)

    The id of the Template to retrieve.

Returns:



22
23
24
# File 'lib/hello_sign/api/template.rb', line 22

def get_template opts
  HelloSign::Resource::Template.new get("/template/#{opts[:template_id]}")
end

#get_templates(opts = {}) ⇒ HelloSign::Resource::ResourceArray

Retrieves the Templates for the current user account.

Examples:

templates = @client.get_templates :page => 1

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • page (Integer) — default: 1

    Which page number of the Template List to return.

Returns:



35
36
37
38
39
# File 'lib/hello_sign/api/template.rb', line 35

def get_templates opts={}
  path = '/template/list'
  path += opts[:page] ? "?page=#{opts[:page]}" : ""
  HelloSign::Resource::ResourceArray.new get(path, opts), "templates", HelloSign::Resource::Template
end

#remove_user_from_template(opts) ⇒ Template

Removes the specified Account’s access to the specified Template. The user can be designated using their account ID or email address.

Examples:

templates = @client.remove_user_from_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35', :email_address => '[email protected]'

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • template_id (String)

    The id of the Template to remove the Account access to.

  • account_id (String)

    The id of the Account to remove access to the Template. The account_id prevails if account_id and email_address are both provided.

  • email_address (String)

    The email address of the Account to remove access to the Template. The account_id prevails if account_id and email_address are both provided.

Returns:



70
71
72
73
74
# File 'lib/hello_sign/api/template.rb', line 70

def remove_user_from_template opts
  path = "/template/remove_user/#{opts[:template_id]}"
  opts.delete(:template_id)
  HelloSign::Resource::Template.new post(path, :body => opts)
end