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 API Documentation for Templates (app.hellosign.com/api/reference#Template) for more information about this.
Instance Method Summary collapse
-
#add_user_to_template(opts) ⇒ Template
Gives the specified Account access to a Template.
-
#create_embedded_template_draft(opts) ⇒ Object
Creates a new embedded template draft object that can be launched in an iFrame using the claim_url.
-
#delete_template(opts) ⇒ Object
Deletes the specified Template.
-
#get_template(opts) ⇒ HelloSign::Resource::Template
Retrieves the Template specified by the id parameter.
-
#get_template_files(opts) ⇒ Object
Downloads the original files of a specified Template.
-
#get_templates(opts = {}) ⇒ HelloSign::Resource::ResourceArray
Retrieves the Templates for the accessible by the current user.
-
#remove_user_from_template(opts) ⇒ Template
Removes the specified Account access to the specified Template.
-
#update_template_files(opts) ⇒ Object
Overlays a new file with the overlay of the specified Template.
Instance Method Details
#add_user_to_template(opts) ⇒ Template
Gives the specified Account access to a Template. The Account must be part of your Team.
Note: The account_id prevails if both email_address and acccount_id are provided.
92 93 94 95 96 |
# File 'lib/hello_sign/api/template.rb', line 92 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 |
#create_embedded_template_draft(opts) ⇒ Object
Creates a new embedded template draft object that can be launched in an iFrame using the claim_url.
163 164 165 166 167 168 |
# File 'lib/hello_sign/api/template.rb', line 163 def (opts) opts[:client_id] ||= self.client_id prepare_files opts prepare_signer_roles opts HelloSign::Resource::TemplateDraft.new post("/template/create_embedded_draft", :body => opts) end |
#delete_template(opts) ⇒ Object
Deletes the specified Template.
57 58 59 |
# File 'lib/hello_sign/api/template.rb', line 57 def delete_template(opts) post("/template/delete/#{opts[:template_id]}") end |
#get_template(opts) ⇒ HelloSign::Resource::Template
Retrieves the Template specified by the id parameter.
46 47 48 |
# File 'lib/hello_sign/api/template.rb', line 46 def get_template(opts) HelloSign::Resource::Template.new get("/template/#{opts[:template_id]}") end |
#get_template_files(opts) ⇒ Object
Downloads the original files of a specified Template.
181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/hello_sign/api/template.rb', line 181 def get_template_files(opts) path = "/template/files/#{opts[:template_id]}" if opts[:file_type] path = path + "?file_type=#{opts[:file_type]}" end if opts[:get_url] separator = opts[:file_type].nil? ? '?' : '&' path = path + "#{separator}get_url=#{opts[:get_url]}" end get(path) end |
#get_templates(opts = {}) ⇒ HelloSign::Resource::ResourceArray
Retrieves the Templates for the accessible by the current user.
73 74 75 76 77 78 |
# File 'lib/hello_sign/api/template.rb', line 73 def get_templates(opts={}) path = '/template/list' path += opts[:page] ? "?page=#{opts[:page]}" : '' path += opts[:page_size] ? "&page_size=#{opts[:page_size]}" : '' HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template end |
#remove_user_from_template(opts) ⇒ Template
Removes the specified Account access to the specified Template.
Note: The account_id prevails if both email_address and acccount_id are provided.
110 111 112 113 114 |
# File 'lib/hello_sign/api/template.rb', line 110 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 |
#update_template_files(opts) ⇒ Object
Overlays a new file with the overlay of the specified Template.
209 210 211 212 213 214 |
# File 'lib/hello_sign/api/template.rb', line 209 def update_template_files(opts) template_id = opts.delete(:template_id) path = "/template/update_files/#{template_id}" prepare_files opts HelloSign::Resource::Template.new post(path, :body => opts) end |