Socket
Socket
Sign inDemoInstall

node-yelp

Package Overview
Dependencies
60
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-yelp

Simple, promise-based, node module for interfacing with Yelp API v2.0


Version published
0
Maintainers
3
Install size
5.51 MB
Created
Weekly downloads
 

Readme

Source

Yelp

Simple, promise-based, node module for interfacing with Yelp API v2.0.

How to use

var yelp = require("node-yelp");


var client = yelp.createClient({
  oauth: {
    "consumer_key": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "consumer_secret": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "token": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "token_secret": "xxxxxxxxxxxxxxxxxxxxxxxx"
  },
  
  // Optional settings:
  httpClient: {
    maxSockets: 25  // ~> Default is 10
  }
});


client.search({
  terms: "Café de la presse",
  location: "BELGIUM"
}).then(function (data) {
  var businesses = data.businesses;
  var location = data.region;
  
  // ... 
});


client.business("grand-place-bruxelles-2", {
  cc: "US"
}).then(function (data) {
  // ...
});

Error handling

Every error that comes from the module has an id property attached to it:


var yelp = require("node-yelp");


client.search({
  terms: "Café de la presse",
  location: "BELGIUM"
}).then(function (data) {
  // ..
}).catch(function (err) {
  if (err.type === yelp.errorTypes.areaTooLarge) {
    // ..
  } else if (err.type === yelp.errorTypes.unavailableForLocation) {
    // ..
  }
});

Types:


var types = {
  unknown: "UNKNOWN",
  internal: "INTERNAL_ERROR",
  exceededRequests: "EXCEEDED_REQS",
  missingParameter: "MISSING_PARAMETER",
  invalidParameter: "INVALID_PARAMETER",
  invalidSignature: "INVALID_SIGNATURE",
  invalidCredentials: "INVALID_CREDENTIALS",
  invalidOAuthCredentials: "INVALID_OAUTH_CREDENTIALS",
  invalidOAuthUser: "INVALID_OAUTH_USER",
  accountUnconfirmed: "ACCOUNT_UNCONFIRMED",
  passwordTooLong: "PASSWORD_TOO_LONG",
  unavailableForLocation: "UNAVAILABLE_FOR_LOCATION",
  areaTooLarge: "AREA_TOO_LARGE",
  multipleLocations: "MULTIPLE_LOCATIONS",
  businessUnavailable: "BUSINESS_UNAVAILABLE",
  unspecifiedLocation: "UNSPECIFIED_LOCATION"
};

Dependencies

  • bluebird: ~2.2.2
  • request: ~2.40.0

LICENSE

MIT

Keywords

FAQs

Last updated on 19 Aug 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