1 | url = require("url")
|
2 | https = require("https")
|
3 | _ = require("underscore")
|
4 | async = require("async")
|
5 | xml2js = require("xml2js")
|
6 |
|
7 | class 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 |
|
31 | module.exports = Zoho
|