UNPKG

1.13 kBJavaScriptView Raw
1// Generated by CoffeeScript 2.2.1
2var BaseProduct, CrmProduct;
3
4BaseProduct = require('../../base-product');
5
6CrmProduct = (function() {
7 class CrmProduct extends BaseProduct {
8 getModules() {
9 return ['Leads', 'Events', 'Potentials', 'Contacts', 'Accounts', 'CustomModule1'];
10 }
11
12 getModule(module_name) {
13 var err, instance, module_class, module_path;
14 try {
15 module_name = module_name.toLowerCase();
16 module_path = `./${module_name}`;
17 require.resolve(module_path);
18 module_class = require(module_path);
19 } catch (error) {
20 err = error;
21 throw new Error(err);
22 }
23 instance = new module_class(this);
24 return instance;
25 }
26
27 getScope() {
28 return 'crmapi';
29 }
30
31 getBaseUrl() {
32 return {
33 hostname: `crm.zoho.${this.zoho.region}`,
34 protocol: 'https',
35 query: {
36 authtoken: this.zoho.authToken,
37 scope: this.getScope()
38 },
39 path: [this.name]
40 };
41 }
42
43 };
44
45 CrmProduct.prototype.name = 'crm';
46
47 return CrmProduct;
48
49}).call(this);
50
51module.exports = CrmProduct;