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.
93 94 95 96 97 |
# File 'lib/hello_sign/api/template.rb', line 93 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.
164 165 166 167 168 169 |
# File 'lib/hello_sign/api/template.rb', line 164 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.
182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/hello_sign/api/template.rb', line 182 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 79 |
# File 'lib/hello_sign/api/template.rb', line 73 def get_templates(opts={}) path = '/template/list' opts[:query] = create_search_string(opts[:query]) if opts[:query] query = create_query_string(opts, [:page, :page_size, :query]) path += query 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.
111 112 113 114 115 |
# File 'lib/hello_sign/api/template.rb', line 111 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.
210 211 212 213 214 215 |
# File 'lib/hello_sign/api/template.rb', line 210 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 |