Socket
Socket
Sign inDemoInstall

ebay-api

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ebay-api - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

68

index.js

@@ -14,3 +14,3 @@ // eBay API client for Node.js

// - use arrays for repeating keys
var buildUrlParams = function(params) {
var buildUrlParams = function buildUrlParams(params) {
var urlFilters = []; // string parts to be joined

@@ -35,3 +35,3 @@

// [helper] constructor for an 'itemFilter' filter (used by the Finding Service)
module.exports.ItemFilter = function(name, value, paramName, paramValue) {
module.exports.ItemFilter = function ItemFilter(name, value, paramName, paramValue) {
// required

@@ -50,3 +50,3 @@ this.name = name;

// adapted from client-side JS example in ebay docs
var buildFilters = function(filterType, filters) {
var buildFilters = function buildFilters(filterType, filters) {
var urlFilter = '';

@@ -80,3 +80,3 @@ _(filters).each(function eachItemFilter(filter, filterInd) {

// params,filters only apply to GET requests; for POST pass in empty {} or null
var buildRequestUrl = function(serviceName, params, filters, sandbox) {
var buildRequestUrl = function buildRequestUrl(serviceName, params, filters, sandbox) {
var url;

@@ -143,3 +143,3 @@

//
var buildXmlInput = function(opType, params) {
var buildXmlInput = function buildXmlInput(opType, params) {
var xmlBuilder = require('xml');

@@ -185,3 +185,3 @@

// options differ by service, see below.
var defaultParams = function(options) {
var defaultParams = function defaultParams(options) {
var params = {},

@@ -246,6 +246,7 @@ defaultGetParams = {

// make a single GET request to a JSON service
var ebayApiGetRequest = function(options, callback) {
var ebayApiGetRequest = function ebayApiGetRequest(options, callback) {
if (! options.serviceName) return callback(new Error("Missing serviceName"));
if (! options.opType) return callback(new Error("Missing opType"));
if (! options.appId) return callback(new Error("Missing appId"));
options.params = options.params || {};

@@ -256,3 +257,5 @@ options.filters = options.filters || {};

options.sandbox = options.sandbox || false;
options.raw = options.raw || false;
if (options.serviceName === 'MerchandisingService') {

@@ -282,3 +285,6 @@ options.reqOptions.decoding = 'buffer'; // otherwise fails to decode json. doesn't seem to be necessary w/ FindingService.

}
else if (options.raw === true) {
return callback(null, result.toString());
}
try {

@@ -348,3 +354,3 @@ data = JSON.parse(result);

// make a single POST request to an XML service
var ebayApiPostXmlRequest = function(options, callback) {
var ebayApiPostXmlRequest = function ebayApiPostXmlRequest(options, callback) {
if (! options.serviceName) return callback(new Error("Missing serviceName"));

@@ -438,3 +444,3 @@ if (! options.opType) return callback(new Error("Missing opType"));

// PAGINATE multiple GET/JSON requests in parallel (max 100 per page, 100 pages = 10k items)
var paginateGetRequest = function(options, callback) {
var paginateGetRequest = function paginateGetRequest(options, callback) {
if (! options.serviceName) return callback(new Error("Missing serviceName"));

@@ -512,3 +518,3 @@ if (! options.opType) return callback(new Error("Missing opType"));

// (different from _.flatten() which returns an array)
var flatten = function(el, iter) {
var flatten = function flatten(el, iter) {
// sanity check

@@ -560,3 +566,3 @@ if (_.isUndefined(iter)) var iter = 1;

// (and array of these into single obj)
var isValuePair = function(el) {
var isValuePair = function isValuePair(el) {
if (_.isObject(el) && _.size(el) === 2) {

@@ -574,3 +580,3 @@ var keys = _.keys(el);

// e.g. 'galleryURL' (makes it easier to handle in MongoDB)
var isArrayOfValuePairs = function(el) {
var isArrayOfValuePairs = function isArrayOfValuePairs(el) {
if (_.isArray(el)) {

@@ -585,3 +591,3 @@ if (_.all(el, isValuePair)) return true;

// @todo build this out as more queries are added...
var parseItemsFromResponse = function(data, callback) {
var parseItemsFromResponse = function parseItemsFromResponse(data, callback) {
// console.log('parse data', data);

@@ -632,3 +638,3 @@

// and have param &campid=TRACKINGID (campid=1234567890)
module.exports.checkAffiliateUrl = function(url) {
module.exports.checkAffiliateUrl = function checkAffiliateUrl(url) {
var regexAffil = /http\:\/\/rover\.ebay\.com\/rover/,

@@ -641,1 +647,31 @@ regexNonAffil = /http\:\/\/www\.ebay\.com/,

// check the latest API versions (to update the code accordingly)
// callback gets hash of APIs:versions
module.exports.getLatestApiVersions = function getLatestApiVersions(options, callback) {
var versionParser = function versionParser(data, callback) {
callback(null, data.version);
};
var checkVersion = function checkVersion(serviceName, next) {
console.log('checkVersion for', serviceName);
ebayApiGetRequest({
serviceName: serviceName,
opType: 'getVersion',
appId: options.appId,
parser: versionParser
},
next);
};
async.series({
'finding': async.apply(checkVersion, 'FindingService'),
'merchandising': async.apply(checkVersion, 'MerchandisingService'),
// 'shopping': async.apply(checkVersion, 'Shopping'), // doesn't have this call!
// 'trading': async.apply(checkVersion, 'Trading') // doesn't have this call!
// ... which others have it?
},
callback);
};
{
"name": "ebay-api",
"description": "eBay API Client",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/newleafdigital/nodejs-ebay-api",

@@ -13,3 +13,3 @@ "author": "Ben Buckman <ben@newleafdigital.com> (http://newleafdigital.com)",

"dependencies": {
"async": "~0.1.18",
"async": "~0.1.22",
"restler": "~2.0.1",

@@ -16,0 +16,0 @@ "underscore": "~1.3.3",

@@ -137,2 +137,7 @@ eBay API client for Node.js

### `getLatestApiVersions(callback)`
Get the version numbers of the APIs that make their version available.
## Examples

@@ -139,0 +144,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc