Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hildjj/node-yelp
Interface with Yelp's API v2.0
https://github.com/hildjj/node-yelp
Last synced: 14 days ago
JSON representation
Interface with Yelp's API v2.0
- Host: GitHub
- URL: https://github.com/hildjj/node-yelp
- Owner: hildjj
- License: mit
- Created: 2015-08-06T20:37:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-06T20:50:38.000Z (over 9 years ago)
- Last Synced: 2024-10-18T20:33:52.907Z (28 days ago)
- Language: JavaScript
- Size: 83 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Yelp
=================Simple, promise-based, node module for interfacing with Yelp API v2.0.
### How to use
```javascript
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:
```javascript
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:
```javascript
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