def create_envelope_from_template(options={})
      content_type = { 'Content-Type' => 'application/json' }
      content_type.merge(options[:headers]) if options[:headers]

      post_body = {
        status:             options[:status],
        emailBlurb:         options[:email][:body],
        emailSubject:       options[:email][:subject],
        templateId:         options[:template_id],
        enableWetSign:      options[:wet_sign],
        brandId:            options[:brand_id],
        eventNotification:  get_event_notification(options[:event_notification]),
        templateRoles:      get_template_roles(options[:signers]),
        customFields:       options[:custom_fields],
        allowReassign:      options[:allow_reassign]
      }.to_json

      uri = build_uri("/accounts/#{acct_id}/envelopes")

      http = initialize_net_http_ssl(uri)

      request = Net::HTTP::Post.new(uri.request_uri, headers(content_type))
      request.body = post_body

      response = http.request(request)
      generate_log(request, response, uri)
      JSON.parse(response.body)
    end
def create_envelope_from_template(options={})
      content_type = { 'Content-Type' => 'application/json' }
      content_type.merge(options[:headers]) if options[:headers]

      post_body = {
        status:             options[:status],
        emailBlurb:         options[:email][:body],
        emailSubject:       options[:email][:subject],
        templateId:         options[:template_id],
        enableWetSign:      options[:wet_sign],
        brandId:            options[:brand_id],
        eventNotification:  get_event_notification(options[:event_notification]),
        templateRoles:      get_template_roles(options[:signers]),
        customFields:       options[:custom_fields],
        allowReassign:      options[:allow_reassign]
      }.to_json

      uri = build_uri("/accounts/#{acct_id}/envelopes")

      http = initialize_net_http_ssl(uri)

      request = Net::HTTP::Post.new(uri.request_uri, headers(content_type))
      request.body = post_body

      response = http.request(request)
      generate_log(request, response, uri)
      JSON.parse(response.body)
    end
Public: create an envelope for delivery from a template

 headers        - Optional hash of headers to merge into the existing
                  required headers for a POST request.
 status         - Options include: 'sent', 'created', 'voided' and
                  determine if the envelope is sent out immediately or
                  stored for sending at a later time
 email/body     - Sets the text in the email body
 email/subject  - Sets the text in the email subject line
 template_id    - The id of the template upon which we want to base this
                  envelope
 template_roles - See the get_template_roles method definition for a list
                  of options to pass. Note: for consistency sake we call
                  this 'signers' and not 'templateRoles' when we build up
                  the request in client code.
 headers        - Optional hash of headers to merge into the existing
                  required headers for a multipart request.

 Returns a JSON parsed response body containing the envelope'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