-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (34 loc) · 1.05 KB
/
index.js
File metadata and controls
42 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const Accounting = require('./collections/Accounting');
const Clients = require('./collections/Clients');
const IntraTransfer = require('./collections/Intratransfer');
const Loans = require('./collections/Loans');
const Products = require('./collections/Products');
const Savings = require('./collections/Savings');
class WoodCore {
constructor(key) {
if (!key) throw new Error('API Key is required')
this.key = key;
this.env = this.key.startsWith("wc_test") ? "test" : "prod"
this.baseURL = this.env === "test" ? 'https://spark.test.woodcoreapp.com/api/v2' : 'https://spark.woodcoreapp.com/api/v2'
this.config = { key: this.key, baseURL: this.baseURL }
}
get accounting() {
return new Accounting(this.config)
}
get clients() {
return new Clients(this.config)
}
get intraTransfer() {
return new IntraTransfer(this.config)
}
get loans() {
return new Loans(this.config)
}
get products() {
return new Products(this.config)
}
get savings() {
return new Savings(this.config)
}
}
module.exports = WoodCore