def send_email(email_id, to, options = {})
      if email_id.nil?
        raise SendWithUs::ApiNilEmailId, 'email_id cannot be nil'
      end

      payload = {
        email_id: email_id,
        recipient: to
      }

      if options[:data] && options[:data].any?
        payload[:email_data] = options[:data]
      end
      if options[:from] && options[:from].any?
        payload[:sender] = options[:from]
      end
      if options[:cc] && options[:cc].any?
        payload[:cc] = options[:cc]
      end
      if options[:bcc] && options[:bcc].any?
        payload[:bcc] = options[:bcc]
      end
      if options[:esp_account]
        payload[:esp_account] = options[:esp_account]
      end
      if options[:version_name]
        payload[:version_name] = options[:version_name]
      end
      if options[:headers] && options[:headers].any?
        payload[:headers] = options[:headers]
      end
      if options[:tags] && options[:tags].any?
        payload[:tags] = options[:tags]
      end
      if options[:locale]
        payload[:locale] = options[:locale]
      end

      if options[:files] && options[:files].any?
        payload[:files] = options[:files].map do |file_data|
          SendWithUs::File.new(file_data).to_h
        end
      end

      SendWithUs::ApiRequest.new(@configuration).post(:send, payload.to_json)
    end
def send_email(email_id, to, options = {})
      if email_id.nil?
        raise SendWithUs::ApiNilEmailId, 'email_id cannot be nil'
      end

      payload = {
        email_id: email_id,
        recipient: to
      }

      if options[:data] && options[:data].any?
        payload[:email_data] = options[:data]
      end
      if options[:from] && options[:from].any?
        payload[:sender] = options[:from]
      end
      if options[:cc] && options[:cc].any?
        payload[:cc] = options[:cc]
      end
      if options[:bcc] && options[:bcc].any?
        payload[:bcc] = options[:bcc]
      end
      if options[:esp_account]
        payload[:esp_account] = options[:esp_account]
      end
      if options[:version_name]
        payload[:version_name] = options[:version_name]
      end
      if options[:headers] && options[:headers].any?
        payload[:headers] = options[:headers]
      end
      if options[:tags] && options[:tags].any?
        payload[:tags] = options[:tags]
      end
      if options[:locale]
        payload[:locale] = options[:locale]
      end

      if options[:files] && options[:files].any?
        payload[:files] = options[:files].map do |file_data|
          SendWithUs::File.new(file_data).to_h
        end
      end

      SendWithUs::ApiRequest.new(@configuration).post(:send, payload.to_json)
    end
Sends the specified email with any optional arguments

 * *Args*    :
   - +email_id+ -> ID of the email to send
   - +to+ -> Hash of recipient details
 * *Options*    :
   - +:data+ -> Hash of email data
   - +:from+ -> Hash of sender details
   - +:cc+ -> Array of CC recipients
   - +:bcc+ -> Array of BCC recipients
   - +:files+ -> Array of attachments
   - +:esp_account+ -> The ESP account to use
   - +:version_name+ -> The specific email version to use
   - +:headers+ -> Hash of headers
   - +:tags+ -> Array of tags
   - +:locale+ -> Localization string
 * *Notes*    :
   - "send" is already a ruby-defined method on all classes