def get_signers(signers, options={})
      doc_signers = []

      signers.each_with_index do |signer, index|
        doc_signer = {
          accessCode:                            '',
          addAccessCodeToEmail:                  false,
          customFields:                          signer[:custom_fields],
          idCheckConfigurationName:              signer[:id_check_configuration_name],
          idCheckInformationInput:               nil,
          inheritEmailNotificationConfiguration: false,
          note:                                  signer[:note],
          phoneAuthentication:                   nil,
          recipientAttachment:                   nil,
          requireIdLookup:                       signer[:require_id_lookup],
          requireSignOnPaper:                    signer[:require_sign_on_paper] || false,
          roleName:                              signer[:role_name],
          routingOrder:                          signer[:routing_order] || index + 1,
          socialAuthentications:                 nil
        }

        recipient_id = signer[:recipient_id] || index + 1
        doc_signer[:recipientId] = recipient_id
        doc_signer[:clientUserId] = recipient_id if signer[:embedded_signing]

        if signer[:id_check_information_input]
          doc_signer[:idCheckInformationInput] =
            get_id_check_information_input(signer[:id_check_information_input])
        end

        if signer[:phone_authentication]
          doc_signer[:phoneAuthentication] =
            get_phone_authentication(signer[:phone_authentication])
        end

        if signer[:signing_group_id]
          doc_signer[:signingGroupId] = signer[:signing_group_id]
        else
          doc_signer[:email] = signer[:email]
          doc_signer[:name] = signer[:name]
        end

        if signer[:email_notification]
          doc_signer[:emailNotification] = signer[:email_notification]
        end

        if signer[:embedded]
          doc_signer[:clientUserId] = signer[:client_id] || signer[:email]
        end

        if options[:template] == true
          doc_signer[:templateAccessCodeRequired] = false
          doc_signer[:templateLocked]             = signer[:template_locked].nil? ? true : signer[:template_locked]
          doc_signer[:templateRequired]           = signer[:template_required].nil? ? true : signer[:template_required]
        end

        doc_signer[:autoNavigation]   = false
        doc_signer[:defaultRecipient] = false
        doc_signer[:signatureInfo]    = nil
        doc_signer[:tabs]             = {
          approveTabs:          nil,
          checkboxTabs:         get_tabs(signer[:checkbox_tabs], options, index),
          companyTabs:          nil,
          dateSignedTabs:       get_tabs(signer[:date_signed_tabs], options, index),
          dateTabs:             nil,
          declineTabs:          nil,
          emailTabs:            get_tabs(signer[:email_tabs], options, index),
          envelopeIdTabs:       nil,
          fullNameTabs:         get_tabs(signer[:full_name_tabs], options, index),
          listTabs:             get_tabs(signer[:list_tabs], options, index),
          noteTabs:             nil,
          numberTabs:           get_tabs(signer[:number_tabs], options, index),
          radioGroupTabs:       get_tabs(signer[:radio_group_tabs], options, index),
          initialHereTabs:      get_tabs(signer[:initial_here_tabs], options.merge!(initial_here_tab: true), index),
          signHereTabs:         get_tabs(signer[:sign_here_tabs], options.merge!(sign_here_tab: true), index),
          signerAttachmentTabs: nil,
          ssnTabs:              nil,
          textTabs:             get_tabs(signer[:text_tabs], options, index),
          titleTabs:            get_tabs(signer[:title_tabs], options, index),
          zipTabs:              nil
        }

        # append the fully build string to the array
        doc_signers << doc_signer
      end
      doc_signers
    end
def get_signers(signers, options={})
      doc_signers = []

      signers.each_with_index do |signer, index|
        doc_signer = {
          accessCode:                            '',
          addAccessCodeToEmail:                  false,
          customFields:                          signer[:custom_fields],
          idCheckConfigurationName:              signer[:id_check_configuration_name],
          idCheckInformationInput:               nil,
          inheritEmailNotificationConfiguration: false,
          note:                                  signer[:note],
          phoneAuthentication:                   nil,
          recipientAttachment:                   nil,
          requireIdLookup:                       signer[:require_id_lookup],
          requireSignOnPaper:                    signer[:require_sign_on_paper] || false,
          roleName:                              signer[:role_name],
          routingOrder:                          signer[:routing_order] || index + 1,
          socialAuthentications:                 nil
        }

        recipient_id = signer[:recipient_id] || index + 1
        doc_signer[:recipientId] = recipient_id
        doc_signer[:clientUserId] = recipient_id if signer[:embedded_signing]

        if signer[:id_check_information_input]
          doc_signer[:idCheckInformationInput] =
            get_id_check_information_input(signer[:id_check_information_input])
        end

        if signer[:phone_authentication]
          doc_signer[:phoneAuthentication] =
            get_phone_authentication(signer[:phone_authentication])
        end

        if signer[:signing_group_id]
          doc_signer[:signingGroupId] = signer[:signing_group_id]
        else
          doc_signer[:email] = signer[:email]
          doc_signer[:name] = signer[:name]
        end

        if signer[:email_notification]
          doc_signer[:emailNotification] = signer[:email_notification]
        end

        if signer[:embedded]
          doc_signer[:clientUserId] = signer[:client_id] || signer[:email]
        end

        if options[:template] == true
          doc_signer[:templateAccessCodeRequired] = false
          doc_signer[:templateLocked]             = signer[:template_locked].nil? ? true : signer[:template_locked]
          doc_signer[:templateRequired]           = signer[:template_required].nil? ? true : signer[:template_required]
        end

        doc_signer[:autoNavigation]   = false
        doc_signer[:defaultRecipient] = false
        doc_signer[:signatureInfo]    = nil
        doc_signer[:tabs]             = {
          approveTabs:          nil,
          checkboxTabs:         get_tabs(signer[:checkbox_tabs], options, index),
          companyTabs:          nil,
          dateSignedTabs:       get_tabs(signer[:date_signed_tabs], options, index),
          dateTabs:             nil,
          declineTabs:          nil,
          emailTabs:            get_tabs(signer[:email_tabs], options, index),
          envelopeIdTabs:       nil,
          fullNameTabs:         get_tabs(signer[:full_name_tabs], options, index),
          listTabs:             get_tabs(signer[:list_tabs], options, index),
          noteTabs:             nil,
          numberTabs:           get_tabs(signer[:number_tabs], options, index),
          radioGroupTabs:       get_tabs(signer[:radio_group_tabs], options, index),
          initialHereTabs:      get_tabs(signer[:initial_here_tabs], options.merge!(initial_here_tab: true), index),
          signHereTabs:         get_tabs(signer[:sign_here_tabs], options.merge!(sign_here_tab: true), index),
          signerAttachmentTabs: nil,
          ssnTabs:              nil,
          textTabs:             get_tabs(signer[:text_tabs], options, index),
          titleTabs:            get_tabs(signer[:title_tabs], options, index),
          zipTabs:              nil
        }

        # append the fully build string to the array
        doc_signers << doc_signer
      end
      doc_signers
    end
Internal: takes an array of hashes of signers required to complete a
 document and allows for setting several options. Not all options are
 currently dynamic but that's easy to change/add which I (and I'm
 sure others) will be doing in the future.

 template           - Includes other optional fields only used when
                      being called from a template
 email              - The signer's email
 name               - The signer's name
 embedded           - Tells DocuSign if this is an embedded signer which
                      determines whether or not to deliver emails. Also
                      lets us authenticate them when they go to do
                      embedded signing. Behind the scenes this is setting
                      the clientUserId value to the signer's email.
 email_notification - Send an email or not
 role_name          - The signer's role, like 'Attorney' or 'Client', etc.
 template_locked    - Doesn't seem to work/do anything
 template_required  - Doesn't seem to work/do anything
 anchor_string      - The string of text to anchor the 'sign here' tab to
 document_id        - If the doc you want signed isn't the first doc in
                      the files options hash
 page_number        - Page number of the sign here tab
 x_position         - Distance horizontally from the anchor string for the
                      'sign here' tab to appear. Note: doesn't seem to
                      currently work.
 y_position         - Distance vertically from the anchor string for the
                      'sign here' tab to appear. Note: doesn't seem to
                      currently work.
 sign_here_tab_text - Instead of 'sign here'. Note: doesn't work
 tab_label          - TODO: figure out what this is