diff --git a/package.json b/package.json index f4ebf39..dce40e6 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,18 @@ { "name": "magento", - "author": "Tim Marshall ", + "author": "Ernest Conill ", "description": "Magento SOAP API wrapper for Node.js", - "version": "0.0.5", + "version": "0.0.7", "main": "./src/magento", "contributors": [ + { + "name": "Ernest Conill", + "email": "ernestconill@gmail.com" + }, + { + "name": "Stephen Keep", + "email": "stephenkeep@gmail.com" + }, { "name": "Tim Marshall", "email": "timothyjmarshall@gmail.com" @@ -23,6 +31,6 @@ "api", "xml" ], - "repository": "git://github.com/MadisonReed/magentoapi", + "repository": "git://github.com/netusco/magentoapi", "license": "MIT" } diff --git a/src/magento.js b/src/magento.js index 1d3938b..8699afb 100644 --- a/src/magento.js +++ b/src/magento.js @@ -35,6 +35,7 @@ var resources = { customerGroup: './resources/customer_group.js', directoryCountry: './resources/directory_country.js', directoryRegion: './resources/directory_region.js', + ourlaborisjoyTools: './resources/ourlaborisjoy_tools.js', salesOrder: './resources/sales_order.js', salesOrderCreditMemo: './resources/sales_order_credit_memo.js', salesOrderInvoice: './resources/sales_order_invoice.js', @@ -48,7 +49,8 @@ var configDefaults = { path: mandatory, login: mandatory, pass: mandatory, - parallelLimit: Infinity + parallelLimit: Infinity, + secure: false }; /** @@ -77,7 +79,13 @@ function Magento(config) { } this.config = magentoConfig; - this.client = xmlrpc.createClient(this.config); + + if (this.config.secure === true) { + this.client = xmlrpc.createSecureClient(this.config); + } else { + this.client = xmlrpc.createClient(this.config); + } + this.queue = []; this.queue.running = 0; this.queue.parallelLimit = this.config.parallelLimit; diff --git a/src/resources/catalog_category.js b/src/resources/catalog_category.js index 0f3d700..b80b25a 100644 --- a/src/resources/catalog_category.js +++ b/src/resources/catalog_category.js @@ -36,7 +36,7 @@ var protos = { Create a new category and return its ID. */ create: { - mandatory: 'categoryId,data', + mandatory: 'parentId,categoryData', optional: 'storeView' }, diff --git a/src/resources/catalog_product.js b/src/resources/catalog_product.js index e46c7fb..cef0277 100644 --- a/src/resources/catalog_product.js +++ b/src/resources/catalog_product.js @@ -21,43 +21,46 @@ var protos = { Allows you to create a new product and return ID of the created product. */ create: { - mandatory: 'type,set,sku,data' + mandatory: 'type,set,sku,productData', + optional: 'storeView' }, /** Allows you to set/get the current store view. */ currentStore: { - optional: 'view' + optional: 'storeView' }, /** Allows you to delete the required product. */ 'delete': { - mandatory: 'id' + mandatory: 'product', + optional: 'identifierType' }, /** Allows you to get the product special price data. */ getSpecialPrice: { - mandatory: 'id' + mandatory: 'product', + optional: 'storeView' }, /** Allows you to retrieve information about the required product. */ info: { - mandatory: 'id', - optional: 'storeView' + mandatory: 'productId', + optional: 'storeView,attributes' }, /** Allows you to retrieve the list of products. */ list: { - optional: 'filters' + optional: 'filters,storeView' }, /** @@ -71,7 +74,7 @@ var protos = { Allows you to set the product special price. */ setSpecialPrice: { - mandatory: 'id,specialPrice,from,to', + mandatory: 'productId,specialPrice,fromDate,toDate', optional: 'storeView', modifiers: { from: dateToISO8601Time, @@ -83,8 +86,8 @@ var protos = { Allows you to update the required product. Note that you should specify only those parameters which you want to be updated. */ update: { - mandatory: 'id,data', - optional: 'storeView' + mandatory: 'product,productData', + optional: 'storeView,identifierType' } }; diff --git a/src/resources/ourlaborisjoy_tools.js b/src/resources/ourlaborisjoy_tools.js new file mode 100644 index 0000000..2c3a20a --- /dev/null +++ b/src/resources/ourlaborisjoy_tools.js @@ -0,0 +1,44 @@ +// external dependencies +var events = require('events'); +var util = require('util'); + +// internal dependencies +var prototypeBase = require('../prototype_base.js'); +var curry = require('../curry.js'); + +/** + Allows you to manage products. +*/ +function OurlaborisjoyTools() { + this.prefix = 'ourlaborisjoy_tools.'; +} +util.inherits(OurlaborisjoyTools, events.EventEmitter); + + +// prototypes we will be applying +var protos = { + /** + Allows you to link simple products with a configurable product, + set the configurable attributes and prices. + */ + configurable_create_for_reals: { + mandatory: 'productId,attributes,variants', + optional: 'identifierType' + }, + + /** + * Allows you to add product attributes that cannot be added through normal api calls + */ + add_msrp_attribute: { + mandatory: 'product,msrp', + optional: 'identifierType,storeView' + } +}; + +// creating prototypes using curry func +for (var key in protos) { + OurlaborisjoyTools.prototype[key] = curry(prototypeBase, key, protos[key]); +} +protos = undefined; + +module.exports = OurlaborisjoyTools;