Comparing version 2.10.4 to 2.11.0
@@ -17,4 +17,24 @@ const { withClient } = require('../helpers') | ||
optIn: (email) => postEmail(`${endpoint}/opt_in/`, email), | ||
get: (email) => dispatchReturnData('get')(`customers/${email}/`), | ||
update: (data) => putEmail(`customers/${data.email}/`, data), | ||
get: (email) => { | ||
switch (client.version) { | ||
case 1: | ||
return dispatchReturnData('get')(`customers/${email}/`) | ||
case 2: | ||
return dispatchReturnData('get')('customers/by_email/', { | ||
params: { email }, | ||
}) | ||
default: | ||
throw new Error(`Invalid API version: ${client.version}`) | ||
} | ||
}, | ||
update: (data) => { | ||
switch (client.version) { | ||
case 1: | ||
return putEmail(`customers/${data.email}/`, data) | ||
case 2: | ||
return postEmail('/customers/', data) | ||
default: | ||
throw new Error(`Invalid API version: ${client.version}`) | ||
} | ||
}, | ||
} | ||
@@ -21,0 +41,0 @@ } |
{ | ||
"name": "rejoiner", | ||
"description": "Rejoiner REST API client wrapper for Node.js", | ||
"version": "2.10.4", | ||
"version": "2.11.0", | ||
"main": "lib/rejoiner.js", | ||
@@ -6,0 +6,0 @@ "author": "Sascha Bratton <sascha@brattonbratton.com>", |
11901
209