Created
November 24, 2015 12:17
-
-
Save mwawrusch/65d9f95f680e65d5a25d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = require 'underscore' | |
Hoek = require 'hoek' | |
transloadit = require 'transloadit' | |
### | |
Sends a post request to transloadit to start image processing. | |
### | |
module.exports = (testMode,authKey,authSecret,templateId,notifyUrl,sourceUrl,productFeedId,cb) -> | |
Hoek.assert _.isString(authKey),"The required parameter authKey is missing or not a string." | |
Hoek.assert _.isString(authSecret), "The required parameter authSecret is missing or not a string." | |
Hoek.assert _.isString(templateId),"The required parameter templateId is missing or not a string." | |
Hoek.assert _.isString(notifyUrl),"The required parameter notifyUrl is missing or not a string." | |
Hoek.assert _.isString(sourceUrl),"The required parameter sourceUrl is missing or not a string." | |
Hoek.assert _.isString(productFeedId),"The required parameter productFeedId is missing or not a string." | |
Hoek.assert _.isFunction(cb),"The required parameter cb is missing or not a function." | |
return cb null if testMode | |
transloaditClient = new transloadit | |
authKey : authKey | |
authSecret: authSecret | |
assemblyOptions = | |
params: | |
productFeedId: productFeedId | |
template_id: templateId | |
notify_url: notifyUrl | |
steps: | |
import: | |
url: sourceUrl | |
transloaditClient.createAssembly assemblyOptions, (err, result) -> | |
return cb err if err | |
cb null, result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment