Socket
Socket
Sign inDemoInstall

ebay-promised

Package Overview
Dependencies
9
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ebay-promised

promise wrapped Ebay requests with sensible response parsers


Version published
Maintainers
1
Install size
6.43 MB
Created

Readme

Source

A promise based wrapper for the eBay API

This module provides a succint, verbose way to build requests with the eBay API.
Currently it works in production applications with the eBay XML POST Trading API, and I have not properly fleshed out the other eBay services. Most of the other services are GET based and query string driven.

How to use this module

# Basic Setup

config = 
  ruName       : 'example123'
  cert         : 'exampleCert123'
  devName      : 'exampleDevName'
  authToken    : 'accesstoken123'
  sandbox      : true
  epoc         : 1000             # MS
  callsPerEpoc : 1                # number of requests per epoc


Ebay  = require 'ebay-promised'
ebay  = new Ebay(config)      # you can pass in configuration in initializiation


# or call it down the line
ebay = (new Ebay)
  .ruName(config.ruName)   
  .cert(config.cert)
  .devName(config.devName) 
  .sandbox(config.sandbox)         # will now use the eBay sandbox site
  .authToken(config.authToken)     # the user token to authenticate with against the API
  .serviceName('Trading')          # the service to use

Now let's set up a call


ebay
  .getCategories()            # a call from the Ebay trading API (http://developer.ebay.com/devzone/xml/docs/reference/ebay/getcategories.html)
  .detailLevel('ReturnAll')   # an option for the getCategories call
  .levelLimit(1)              # another option
  .invoke()                   # says you are done building the request, and makes it to ebay returns a Q promise
  .fail(handleError)          # what to do if your request fails
  .then(handleCategories)     # what to do when your request succeeds

Supported Calls

All calls that are currently defined live in ebay-promised/definitions/src/calls if you find a call that is missing, feel free to open an issue so it can be addressed, or make a pull request

Rate Limiting

ebay-promised handles rate-limiting internally, with a default limit of 3 calls per second.

To override these settings you can pass in the config.epoc and a config.callsPerEpoc options

Pagination

Internally ebay-promised will attempt to detect when a request is paginated and go ahead and grab the subsequent pages for you and concatenate the results

Utility methods

Ebay#respondsTo

  • this method is to test if a method exists for eBay

Ebay#reset

  • this method resets the fields for the api

Ebay#build

  • this is an internal method usually, but it will return the current state of the XML document to be POSTed to eBay

Pull requests are welcome.

TODOs
  • Add full support for other Ebay API services
  • Add tests

Keywords

FAQs

Last updated on 06 Apr 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc