UNPKG

753 Btext/coffeescriptView Raw
1url = require("url")
2https = require("https")
3_ = require("underscore")
4async = require("async")
5xml2js = require("xml2js")
6
7class Zoho
8 authToken: null
9
10 constructor: (options = {}) ->
11 @authDefaults =
12 host: "accounts.zoho.com"
13 port: 443
14 path: "/apiauthtoken/nb/create?SCOPE=ZohoCRM/crmapi"
15
16 if options?.authToken
17 @authToken = options?.authToken
18
19 return @
20
21 getProduct: (productName) ->
22 Crm = require './products/crm'
23 return new Crm(@)
24
25 execute: (product, module, call) ->
26 args = Array.prototype.slice.call(arguments)
27 productInstance = @getProduct(product)
28 moduleInstance = productInstance.getModule(module)
29 moduleInstance[call].apply(moduleInstance,args.slice(3))
30
31module.exports = Zoho