def upload(template_id, to, reply_to, from, subject, merge_fields, view_online, click_tracking, suppress_address, attachments, headers, reply_name, from_address)
      path = "#{@root ? @root : ROOT}/#{@endpoint}"
      begin
        payload = prepare_payload(template_id, to, reply_to, from, subject, merge_fields, view_online, click_tracking, suppress_address, attachments, headers, reply_name, from_address)
        request = RestClient::Request.new(
            :method => :post,
            :headers => {:'X-auth-key' => get_auth_key},
            :url => path,
            :payload => payload)
        resp = request.execute
        res = resp.body
      rescue RestClient::ExceptionWithResponse => err
        res = err.response
      end

      parsed = JSON.parse(res)
      if parsed.kind_of? Hash
        MetaResponse.new parsed
      else
        parsed
      end
    end
def upload(template_id, to, reply_to, from, subject, merge_fields, view_online, click_tracking, suppress_address, attachments, headers, reply_name, from_address)
      path = "#{@root ? @root : ROOT}/#{@endpoint}"
      begin
        payload = prepare_payload(template_id, to, reply_to, from, subject, merge_fields, view_online, click_tracking, suppress_address, attachments, headers, reply_name, from_address)
        request = RestClient::Request.new(
            :method => :post,
            :headers => {:'X-auth-key' => get_auth_key},
            :url => path,
            :payload => payload)
        resp = request.execute
        res = resp.body
      rescue RestClient::ExceptionWithResponse => err
        res = err.response
      end

      parsed = JSON.parse(res)
      if parsed.kind_of? Hash
        MetaResponse.new parsed
      else
        parsed
      end
    end
Sends a transactional message with attachments using ExpressPigeon Rest API.
 This method  is not used directly, instead use +send_message()+ or +send_msg()+

 * +template_id+ - ID of a template to use for sending
 * +to+ - destination email address
 * +reply_to+ - return email address
 * +from+ - name of sender
 * +subject+ - subject of email
 * +merge fields+ - hash with dynamic values to merge into a template
 * +view_online+ - generate "view online" link in the template
 * +click_tracking+ - enable/disable click tracking (and URL rewriting)
 * +suppress_address+ - enable/disable display of physical address at the bottom of newsletter.
 * +attachments+ - array of file paths  to attach to email.
 * +headers+ - hash of headers to add to SMTP message
 * +reply_name+ - reply name to use in the +reply-to+ header.
 * +from_name+ - name to use in the +from+ header