Skip to content

Commit

Permalink
* Added version variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
nouvak committed Apr 27, 2016
1 parent 5fc5fee commit a3260e3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ var RestClient = require('./lib/rest_client').RestClient;
var categories = require('./lib/categories');
var products = require('./lib/products');

const MAGENTO_API_VERSION = 'V1';

module.exports.Magento2Client = function (options) {
var instance = {};

options.version = MAGENTO_API_VERSION;

var client = RestClient(options);

instance.categories = categories(client);
Expand Down
4 changes: 4 additions & 0 deletions lib/rest_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ module.exports.RestClient = function (options) {
form: request_data.data,
}, function(error, response, body) {
logger.debug('Response received.');
if (error) {
logger.error('Error occured: ' + error);
return
}
//process your data here
});
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"dependencies": {
"oauth-1.0a": "^1.0.1",
"request": "^2.72.0",
"winston": "^2.2.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/categories.integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var Magento2Client = require('../../index').Magento2Client;
suite('categories tests', function () {
test('list categories test', function () {
var client = Magento2Client(credentials);

assert.equal(client.categories.list(), 'categories');
client.categories.list()
//assert.equal(client.categories.list(), 'categories');
});
});

Expand Down

0 comments on commit a3260e3

Please sign in to comment.