sphere-stock-xml-import

0.5.8 • Public • Published

sphere-stock-xml-import

Build Status Dependency Status devDependency Status

This repository contains an stock updater that can handle CSV and XML files.

Setup

  • install NodeJS (platform for running application)

From scratch

  • install npm (NodeJS package manager, bundled with node since version 0.6.3!)
  • install grunt-cli (automation tool)
  • resolve dependencies using npm
$ npm install
  • build javascript sources
$ grunt build

From ZIP

  • Just download the ready to use application as ZIP
  • Extract the latest.zip with unzip sphere-stock-xml-import-latest.zip
  • Change into the directory cd sphere-stock-xml-import

General Usage

node lib/run

Usage: node ./lib/run.js --projectKey [key] --clientId [id] --clientSecret [secret] --file [file]

Options:
  --projectKey    your SPHERE.IO project-key                                            [required]
  --clientId      your OAuth client id for the SPHERE.IO API                            [required]
  --clientSecret  your OAuth client secret for the SPHERE.IO API                        [required]
  --file          XML or CSV file containing inventory information to import            [required]
  --csvHeaders    a list of column names to use as mapping, comma separated             [default: 'sku, quantity']
  --csvDelimiter  the delimiter type used in the csv                                    [default: ',']
  --sftpCredentials the path to a JSON file where to read the credentials from          [*optional]
  --sftpHost      the SFTP host (overwrite value in sftpCredentials JSON, if given)     [*optional]
  --sftpUsername  the SFTP username (overwrite value in sftpCredentials JSON, if given) [*optional]
  --sftpPassword  the SFTP password (overwrite value in sftpCredentials JSON, if given) [*optional]
  --sftpSource    path in the SFTP server from where to read the files                  [*optional]
  --sftpTarget    path in the SFTP server to where to move the worked files             [*optional]
  --sftpFileRegex a RegEx to filter files when downloading them                         [*optional]
  --logDir        log level for file logging                                            [default: 'info']
  --logLevel      directory to store logs                                               [default: '.']
  --logSilent     use console to print messages                                         [default: false]
  --timeout       Set timeout for requests                                              [default: 300000]

*optional means that they are required all together to use the SFTP functionality

CSV Format

Column 1 will be used as SKU identifier, whereas column 2 will be used as quantity. An example:

sku,quantity
foo,9
bar,-1
SKU-123,42

Please note that the header names are currenlty ignored.

XML Format

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <row>
    <code>foo</code>
    <quantity>7</quantity>
  </row>
  <row>
    <code>bar</code>
    <quantity>1</quantity>
  </row>
</root>

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

License

Copyright (c) 2013 Hajo Eichler and Nicola Molinari Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i sphere-stock-xml-import

Weekly Downloads

2

Version

0.5.8

License

none

Last publish

Collaborators

  • commercetools-admin
  • emmenko
  • hajoeichler
  • yanns
  • tdeekens
  • timonrey
  • vineetkumarkushwaha
  • markusazer
  • jherey
  • danrleyt
  • jenschude
  • chukwuemeka