node-springboard-es

阅读时长 11 分钟读完

Node JS library for interacting with Springboard Retail API

node-springboard-es

Node JS Library for Interacting with Springboard Retail API. Uses the [restler] (https://github.com/danwrong/restler) module as its foundation for querying the service.

Springboard Retail is a cloud based point-of-sale system that is well designed and highly accessible. Refer to their API docs for details on API usage.

After asking the permission of Alex, I have been adding more functions to his library as I needed to use the Springboard Retail API for a client. :)

I have not ammended the lack of test of Alex. Like he said: "Forgive the lack of tests, I'm one of "those" people."

Installing and Configuring

Require the module, passing in a valid domain, user, and password. Then experience Springboard API nirvana.

Usage

####Basic Example

-- -------------------- ---- -------
--- ----------- - ------------------------------------------ --------- --------------

--------------------------- ------------- ----- --------- -
--- ----- --- ----- --- ------
-------- -
---- ------ -----
-- ---- -
---- ------- ---- ----------- -------- -- -----------
--------------------
--
---

####General Use This module follows the Node callback convention of passing either null or an Error object as the first argument of the callback. See the basic example above.

All functions in this module expect a callback that accepts three parameters: err, data, and response.

#####Err An Error object if there was a problem; null if not. Always check for this first in your callbacks.

#####Data Varies based on the method call.

Methods beginning with "create" will return a hash with a "path" and "objectId" value. For example:

All other methods will return the JSON object returned by the Springboard API, easily accessible through dot notation or your preferred method of data access.

#####Response The raw response as returned by restler. Refer to restler documentation for info on how to interact with this object.

####API As a general rule, API method signatures begin with data required by Springboard, then accept a hash parameter for other data, and finally method callback. I'm not fully sold on this design yet but it works. For now, only parameters that are not self explanatory are documented.

#####data parameter The data parameter in the method calls is the catch all of capturing information not necessariliy required by the API. The following example creates an item that includes some custom fields:

#####createInventoryAdjustment(locationId, itemId, adjustmentReasonId, qtyAdjust, cost, data, callback) Note: Undocumented API method.

Creates an inventory adjustment entry.

qtyAdjust: The quantity adjustment to make to current on hand counts. NOT the on hand count.

#####createItem(cost, data, callback) Creates an item. Cost is the only field required by Springboard. However, if you have custom fields that are required, you will have to provide those via the data parameter.

#####createItemVendor(itemId, vendorId, data, callback) Note: Undocumented API method.

Creates a vendor record for an item (sometimes called a source record).

#####createTicket(data, callback) Creates a sales ticket.

#####createTicketLine(ticketId, data, callback) Note: The Springboard API does not currently provide the newly created ID for a ticket line. Not sure why Creates a line for a given ticket ID.

#####createVendor(name, data, callback) Creates a vendor.

#####createVendorAddress(vendorId, city, state, country, postalCode, data, callback) Note: Undocumented API method Creates an address for a vendor.

#####createVendorContact(vendorId, data, callback) Note: Undocumented API method Creates a contact for a vendor.

#####getGiftCard(giftCardNumber, callback) Gets gift card with the given number. Springboard throws an error if the gift card is not found.

#####getInventoryValues(data, callback) Gets inventory values. Recommend using convenience methods for retrieving inventory values for a given item ID by location.

#####getInventoryValuesByLocation(itemId, data, callback) Gets inventory values for an item, grouped by location.

#####getItem(id, callback) Retrieves an item based on its ID.

#####getItemByLookup(lookup, callback) Retrieves an item based on its lookup code.

#####getItemsByFilter(jsonFilter, callback) Retrieve items based on advanced JSON filter.

#####getItemVendors(id, callback) Retrieves vendor records for a given item ID.

#####getTicket(id, callback) Retrieves a ticket based on its ID.

#####getTicketLines(id, callback) Retrieves ticket lines based on a ticket ID.

#####getVendor(id, callback) Retrieves a vendor based on its ID.

#####getVendorsByFilter(jsonFilter, callback) Retrieve vendors based on advanced JSON filter.

#####searchItems(searchTerm, page, perPage, callback) A basic way to query items using Springboard's standard search. Springboard has a sophisticated query system that is not yet implemented in this module.

#####searchVendors(searchTerm, page, perPage, callback) A basic way to query vendors using Springboard's standard search. Springboard has a sophisticated query system that is not yet implemented in this module.

#####updateItem(id, data, callback) Update an item.

#####updateVendor(id, data, callback) Update a vendor.

HomePage

https://github.com/ExobyteStudio

Repository

git+https://github.com/ExobyteStudio/node-springboard.git

来源:JavaScript中文网 ,转载请注明来源 https://www.javascriptcn.com/post/6005606d81e8991b448de92f

纠错
反馈