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.
Instance Method Summary collapse
-
#add_user_to_template(opts) ⇒ Template
Gives the specified Account on your team 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 Template specified by the id parameter.
-
#get_template(opts) ⇒ HelloSign::Resource::Template
Retrieves the Template specified by the id parameter.
- #get_template_files(opts) ⇒ Object
-
#get_templates(opts = {}) ⇒ HelloSign::Resource::ResourceArray
Retrieves the Templates for the current user account.
-
#remove_user_from_template(opts) ⇒ Template
Removes the specified Account’s access to the specified Template.
- #update_template_files(opts) ⇒ Object
Instance Method Details
#add_user_to_template(opts) ⇒ Template
Gives the specified Account on your team access to a Template
88 89 90 91 92 |
# File 'lib/hello_sign/api/template.rb', line 88 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.
154 155 156 157 158 159 |
# File 'lib/hello_sign/api/template.rb', line 154 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 Template specified by the id parameter.
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
161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/hello_sign/api/template.rb', line 161 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 current user account.
70 71 72 73 74 75 |
# File 'lib/hello_sign/api/template.rb', line 70 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’s access to the specified Template. The user can be designated using their account ID or email address.
105 106 107 108 109 |
# File 'lib/hello_sign/api/template.rb', line 105 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
174 175 176 177 178 179 |
# File 'lib/hello_sign/api/template.rb', line 174 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 |