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) ⇒ HelloSign::Resource::Template
Gives the specified Account access to a Template.
-
#create_embedded_template_draft(opts) ⇒ HelloSign::Resource::Template
Creates a new Embedded Template draft object that can be launched in an iFrame using the claim_url.
-
#delete_template(opts) ⇒ HTTP::Status
Deletes the specified Template.
-
#get_template(opts) ⇒ HelloSign::Resource::Template
Retrieves the Template with the given ID.
-
#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) ⇒ HelloSign::Resource::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) ⇒ HelloSign::Resource::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.
83 84 85 86 87 |
# File 'lib/hello_sign/api/template.rb', line 83 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) ⇒ HelloSign::Resource::Template
Creates a new Embedded Template draft object that can be launched in an iFrame using the claim_url.
174 175 176 177 178 179 180 |
# File 'lib/hello_sign/api/template.rb', line 174 def (opts) opts[:client_id] ||= self.client_id prepare_files opts prepare_signer_roles opts opts HelloSign::Resource::TemplateDraft.new post("/template/create_embedded_draft", body: opts) end |
#delete_template(opts) ⇒ HTTP::Status
Deletes the specified Template.
51 52 53 |
# File 'lib/hello_sign/api/template.rb', line 51 def delete_template(opts) post("/template/delete/#{opts[:template_id]}") end |
#get_template(opts) ⇒ HelloSign::Resource::Template
Retrieves the Template with the given ID.
40 41 42 |
# File 'lib/hello_sign/api/template.rb', line 40 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.
191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/hello_sign/api/template.rb', line 191 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.
65 66 67 68 69 70 71 |
# File 'lib/hello_sign/api/template.rb', line 65 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) ⇒ HelloSign::Resource::Template
Removes the specified Account access to the specified Template. Note: The account_id prevails if both email_address and acccount_id are provided.
99 100 101 102 103 |
# File 'lib/hello_sign/api/template.rb', line 99 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.
218 219 220 221 222 223 224 |
# File 'lib/hello_sign/api/template.rb', line 218 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 |