Comparing version
@@ -0,55 +1,56 @@ | ||
var request = require('./request'); | ||
var api = {}; | ||
var request = function (arg) {}; | ||
api.exportGetAllPackages = function (arg) { | ||
request('/etc/creativeExchange/export/api.packages.json'); | ||
api.exportGetAllPackages = function () { | ||
return this.request('GET', '/etc/creativeExchange/export/api.packages.json'); | ||
}; | ||
api.exportGetPackageStatus = function (arg) { | ||
request('/etc/creativeExchange/export/api.status.json'); | ||
api.exportGetPackageStatus = function (args) { | ||
return this.request('GET', '/etc/creativeExchange/export/api.status.json', args); | ||
}; | ||
api.exportDownloadPackage = function (arg) { | ||
request('/etc/creativeExchange/export/api.package.zip'); | ||
api.exportDownloadPackage = function (args) { | ||
return this.request('GET', '/etc/creativeExchange/export/api.package.zip', args); | ||
}; | ||
api.exportCreatePackage = function (arg) { | ||
request('/etc/creativeExchange/export/api.create.json'); | ||
api.exportCreatePackage = function (args) { | ||
return this.request('POST', '/etc/creativeExchange/export/api.create.json', args); | ||
}; | ||
api.exportRemovePackage = function (arg) { | ||
request('/etc/creativeExchange/export/api.packages.json'); | ||
api.exportRemovePackage = function (args) { | ||
return this.request('DELETE', '/etc/creativeExchange/export/api.packages.json', args); | ||
}; | ||
api.importGetAllPackages = function (arg) { | ||
request('/etc/creativeExchange/import/api.packages.json'); | ||
api.importGetAllPackages = function () { | ||
return this.request('GET', '/etc/creativeExchange/import/api.packages.json'); | ||
}; | ||
api.importGetPackageStatus = function (arg) { | ||
request('/etc/creativeExchange/import/api.status.json'); | ||
api.importGetPackageStatus = function (args) { | ||
return this.request('GET', '/etc/creativeExchange/import/api.status.json', args); | ||
}; | ||
api.importUploadPackage = function (arg) { | ||
request('/etc/creativeExchange/import/api.upload.json'); | ||
api.importUploadPackage = function (args) { | ||
return this.request('UPLOAD', '/etc/creativeExchange/import/api.upload.json', args); | ||
}; | ||
api.importInspectPackage = function (arg) { | ||
request('/etc/creativeExchange/import/api.inspect.json'); | ||
api.importInspectPackage = function (args) { | ||
return this.request('POST', '/etc/creativeExchange/import/api.inspect.json', args); | ||
}; | ||
api.importDryRunPackage = function (arg) { | ||
request('/etc/creativeExchange/import/api.dry_run.json'); | ||
api.importDryRunPackage = function (args) { | ||
return this.request('POST', '/etc/creativeExchange/import/api.dry_run.json', args); | ||
}; | ||
api.importInstallPackage = function (arg) { | ||
request('/etc/creativeExchange/import/api.install.json'); | ||
api.importInstallPackage = function (args) { | ||
return this.request('POST', '/etc/creativeExchange/import/api.install.json', args); | ||
}; | ||
api.importRemovePackage = function (arg) { | ||
request('/etc/creativeExchange/import/api.packages.json'); | ||
api.importRemovePackage = function (args) { | ||
return this.request('DELETE', '/etc/creativeExchange/import/api.packages.json', args); | ||
}; | ||
api.themeGetAllThemes = function (arg) { | ||
api.themeGetAllThemes = function (args) { | ||
return this.request('GET', '/etc/creativeExchange/themes/api.json', args); | ||
}; | ||
module.exports = api; |
var api = require('./api'); | ||
var DEFAULTS = { | ||
var request = require('./request'); | ||
} | ||
var CrEx = function (options) { | ||
options = options || {}; | ||
this.admin = options.admin; | ||
this.user = options.user; | ||
this.password = options.password; | ||
this.server = options.server; | ||
this.url = options.url; | ||
this.port = options.port; | ||
}; | ||
CrEx.prototype.getUrl = function () { | ||
return this.user + ':' + this.password + '@' + this.url + ':' + this.port; | ||
} | ||
CrEx.prototype.request = function(method, url, args) { | ||
var req = null; | ||
url = this.getUrl() + url; | ||
switch (method) { | ||
case 'GET': | ||
req = request.doGet; | ||
break; | ||
} | ||
return req(url, args); | ||
}; | ||
CrEx.prototype = Object.assign(CrEx.prototype, api); | ||
module.exports = CrEx; |
{ | ||
"name": "crex", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Creative Exchange SDK for Javascript", | ||
@@ -8,9 +8,16 @@ "author": "Mateusz Luczak <mateusz.luczak@outlook.com>", | ||
"scripts": { | ||
"build": "rollup -c" | ||
"build": "rollup -c", | ||
"test": "mocha test/**" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^6.0.0", | ||
"mocha": "^3.3.0", | ||
"rollup": "^0.41.6", | ||
"rollup-plugin-commonjs": "^8.0.2", | ||
"rollup-plugin-node-resolve": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"superagent": "^3.5.2" | ||
} | ||
} |
@@ -17,6 +17,6 @@ <img width="200px" src="http://zg.cognifide.com/galaxite/img/zg_logo.svg"> | ||
var crex = new CrEx({ | ||
user: 'admin', | ||
password: 'admin', | ||
address: 'localhost', | ||
port: 4502 | ||
user: 'admin', | ||
password: 'admin', | ||
address: 'localhost', | ||
port: 4502 | ||
}); | ||
@@ -23,0 +23,0 @@ |
8009
35.63%12
33.33%179
47.93%1
Infinity%6
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added