def create_template(options={})
      ios = create_file_ios(options[:files])
      file_params = create_file_params(ios)

      post_body = {
        emailBlurb: "#{options[:email][:body] if options[:email]}",
        emailSubject: "#{options[:email][:subject] if options[:email]}",
        documents: get_documents(ios),
        recipients: {
          signers: get_signers(options[:signers], template: true)
        },
        envelopeTemplateDefinition: {
          description: options[:description],
          name: options[:name],
          pageCount: 1,
          password: '',
          shared: false
        }
      }.to_json

      uri = build_uri("/accounts/#{acct_id}/templates")
      http = initialize_net_http_ssl(uri)

      request = initialize_net_http_multipart_post_request(
                  uri, post_body, file_params, headers(options[:headers])
                )

      response = http.request(request)
      generate_log(request, response, uri)
      JSON.parse(response.body)
    end
def create_template(options={})
      ios = create_file_ios(options[:files])
      file_params = create_file_params(ios)

      post_body = {
        emailBlurb: "#{options[:email][:body] if options[:email]}",
        emailSubject: "#{options[:email][:subject] if options[:email]}",
        documents: get_documents(ios),
        recipients: {
          signers: get_signers(options[:signers], template: true)
        },
        envelopeTemplateDefinition: {
          description: options[:description],
          name: options[:name],
          pageCount: 1,
          password: '',
          shared: false
        }
      }.to_json

      uri = build_uri("/accounts/#{acct_id}/templates")
      http = initialize_net_http_ssl(uri)

      request = initialize_net_http_multipart_post_request(
                  uri, post_body, file_params, headers(options[:headers])
                )

      response = http.request(request)
      generate_log(request, response, uri)
      JSON.parse(response.body)
    end
Public: allows a template to be dynamically created with several options.

 files         - An array of hashes of file parameters which will be used
                 to create actual files suitable for upload in a multipart
                 request.

                 Options: io, path, name. The io is optional and would
                 require creating a file_io object to embed as the first
                 argument of any given file hash. See the create_file_ios
                 method definition above for more details.

 email/body    - (Optional) sets the text in the email. Note: the envelope
                 seems to override this, not sure why it needs to be
                 configured here as well. I usually leave it blank.
 email/subject - (Optional) sets the text in the email. Note: the envelope
                 seems to override this, not sure why it needs to be
                 configured here as well. I usually leave it blank.
 signers       - An array of hashes of signers. See the
                 get_signers method definition for options.
 description   - The template description
 name          - The template name
 headers       - Optional hash of headers to merge into the existing
                 required headers for a multipart request.

 Returns a JSON parsed response body containing the template's:
   name - Name given above
   templateId - The auto-generated ID provided by DocuSign
   Uri - the URI where the template is located on the DocuSign servers