Commits

Dustin Shields-Cloues  committed c54b6ed

Add optional parameters to inbound/send-raw to enable SPF validation

  • Participants
  • Parent commits 7928fc4
  • Tags 1.0.14

Comments (0)

Files changed (3)

File mandrill.coffee

     port:   443,
     prefix: '/api/1.0/',
     method: 'POST',
-    headers: {'Content-Type': 'application/json', 'User-Agent': 'Mandrill-Node/1.0.13'}
+    headers: {'Content-Type': 'application/json', 'User-Agent': 'Mandrill-Node/1.0.14'}
 }
 
 class exports.Mandrill
     ###
     Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP
 $sparam string $to[] the email address of the recipient @validate trim
+$sparam string $mail_from the address specified in the MAIL FROM stage of the SMTP conversation @validate email. Optional; required for the SPF check.
+$sparam string $helo the identification provided by the client mta in the MTA state of the SMTP conversation. Optional; required for the SPF check.
+$sparam string $client_address the remote MTA's ip address. Optional; required for the SPF check.
     @param {Object} params the hash of the parameters to pass to the request
     @option params {String} raw_message the full MIME document of an email message
     @option params {Array|null} to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
-// Generated by CoffeeScript 1.3.3
 (function() {
   var Inbound, Internal, Messages, OPTS, Rejects, Senders, Tags, Templates, Urls, Users, Webhooks, https;
 
     method: 'POST',
     headers: {
       'Content-Type': 'application/json',
-      'User-Agent': 'Mandrill-Node/1.0.13'
+      'User-Agent': 'Mandrill-Node/1.0.14'
     }
   };
 
       this.urls = new Urls(this);
       this.webhooks = new Webhooks(this);
       this.senders = new Senders(this);
-      if (this.apikey === null) {
-        this.apikey = process.env['MANDRILL_APIKEY'];
-      }
+      if (this.apikey === null) this.apikey = process.env['MANDRILL_APIKEY'];
     }
 
     Mandrill.prototype.call = function(uri, params, onresult, onerror) {
       var req,
         _this = this;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       params.key = this.apikey;
       params = new Buffer(JSON.stringify(params), 'utf8');
       if (this.debug) {
               return _this.onerror(json);
             }
           } else {
-            if (onresult) {
-              return onresult(json);
-            }
+            if (onresult) return onresult(json);
           }
         });
       });
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.add = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["publish"]) == null) {
-        params["publish"] = true;
-      }
+      if (params["publish"] == null) params["publish"] = true;
       return this.master.call('templates/add', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.info = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.update = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["publish"]) == null) {
-        params["publish"] = true;
-      }
+      if (params["publish"] == null) params["publish"] = true;
       return this.master.call('templates/update', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.publish = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype["delete"] = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.list = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.timeSeries = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Templates.prototype.render = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["merge_vars"]) == null) {
-        params["merge_vars"] = null;
-      }
+      if (params["merge_vars"] == null) params["merge_vars"] = null;
       return this.master.call('templates/render', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Users.prototype.info = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Users.prototype.ping = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Users.prototype.ping2 = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Users.prototype.senders = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Rejects.prototype.list = function(params, onsuccess, onerror) {
-      var _ref, _ref1;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["email"]) == null) {
-        params["email"] = null;
-      }
-      if ((_ref1 = params["include_expired"]) == null) {
-        params["include_expired"] = false;
-      }
+      if (params["email"] == null) params["email"] = null;
+      if (params["include_expired"] == null) params["include_expired"] = false;
       return this.master.call('rejects/list', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Rejects.prototype["delete"] = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Inbound.prototype.domains = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Inbound.prototype.routes = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
     /*
         Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP
     $sparam string $to[] the email address of the recipient @validate trim
+    $sparam string $mail_from the address specified in the MAIL FROM stage of the SMTP conversation @validate email. Optional; required for the SPF check.
+    $sparam string $helo the identification provided by the client mta in the MTA state of the SMTP conversation. Optional; required for the SPF check.
+    $sparam string $client_address the remote MTA's ip address. Optional; required for the SPF check.
         @param {Object} params the hash of the parameters to pass to the request
         @option params {String} raw_message the full MIME document of an email message
         @option params {Array|null} to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Inbound.prototype.sendRaw = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["to"]) == null) {
-        params["to"] = null;
-      }
+      if (params["to"] == null) params["to"] = null;
       return this.master.call('inbound/send-raw', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Tags.prototype.list = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Tags.prototype["delete"] = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Tags.prototype.info = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Tags.prototype.timeSeries = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Tags.prototype.allTimeSeries = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Messages.prototype.send = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["async"]) == null) {
-        params["async"] = false;
-      }
+      if (params["async"] == null) params["async"] = false;
       return this.master.call('messages/send', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Messages.prototype.sendTemplate = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["async"]) == null) {
-        params["async"] = false;
-      }
+      if (params["async"] == null) params["async"] = false;
       return this.master.call('messages/send-template', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Messages.prototype.search = function(params, onsuccess, onerror) {
-      var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["query"]) == null) {
-        params["query"] = '*';
-      }
-      if ((_ref1 = params["date_from"]) == null) {
-        params["date_from"] = null;
-      }
-      if ((_ref2 = params["date_to"]) == null) {
-        params["date_to"] = null;
-      }
-      if ((_ref3 = params["tags"]) == null) {
-        params["tags"] = null;
-      }
-      if ((_ref4 = params["senders"]) == null) {
-        params["senders"] = null;
-      }
-      if ((_ref5 = params["limit"]) == null) {
-        params["limit"] = 100;
-      }
+      if (params["query"] == null) params["query"] = '*';
+      if (params["date_from"] == null) params["date_from"] = null;
+      if (params["date_to"] == null) params["date_to"] = null;
+      if (params["tags"] == null) params["tags"] = null;
+      if (params["senders"] == null) params["senders"] = null;
+      if (params["limit"] == null) params["limit"] = 100;
       return this.master.call('messages/search', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Messages.prototype.parse = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Messages.prototype.sendRaw = function(params, onsuccess, onerror) {
-      var _ref, _ref1, _ref2, _ref3;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["from_email"]) == null) {
-        params["from_email"] = null;
-      }
-      if ((_ref1 = params["from_name"]) == null) {
-        params["from_name"] = null;
-      }
-      if ((_ref2 = params["to"]) == null) {
-        params["to"] = null;
-      }
-      if ((_ref3 = params["async"]) == null) {
-        params["async"] = false;
-      }
+      if (params["from_email"] == null) params["from_email"] = null;
+      if (params["from_name"] == null) params["from_name"] = null;
+      if (params["to"] == null) params["to"] = null;
+      if (params["async"] == null) params["async"] = false;
       return this.master.call('messages/send-raw', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Urls.prototype.list = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Urls.prototype.search = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Urls.prototype.timeSeries = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Webhooks.prototype.list = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Webhooks.prototype.add = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["events"]) == null) {
-        params["events"] = [];
-      }
+      if (params["events"] == null) params["events"] = [];
       return this.master.call('webhooks/add', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Webhooks.prototype.info = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Webhooks.prototype.update = function(params, onsuccess, onerror) {
-      var _ref;
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         params = {};
       }
-      if ((_ref = params["events"]) == null) {
-        params["events"] = [];
-      }
+      if (params["events"] == null) params["events"] = [];
       return this.master.call('webhooks/update', params, onsuccess, onerror);
     };
 
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Webhooks.prototype["delete"] = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Senders.prototype.list = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Senders.prototype.domains = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Senders.prototype.info = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;
         @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
     */
 
-
     Senders.prototype.timeSeries = function(params, onsuccess, onerror) {
-      if (params == null) {
-        params = {};
-      }
+      if (params == null) params = {};
       if (typeof params === 'function') {
         onerror = onsuccess;
         onsuccess = params;

File package.json

   "author": "Mandrill Devs <community@mandrill.com> (http://mandrill.com)",
   "name": "mandrill-api",
   "description": "The official API client for the Mandrill email as a service product.",
-  "version": "1.0.13",
+  "version": "1.0.14",
   "homepage": "https://bitbucket.org/mailchimp/mandrill-api-node",
   "repository": {
     "type": "git",