v3-yelp-api
Advanced tools
Comparing version 1.0.1 to 1.0.2
15
index.js
@@ -1,2 +0,3 @@ | ||
import http from 'httpism'; | ||
import http from 'axios'; | ||
import qs from 'querystring' | ||
@@ -18,6 +19,5 @@ const baseUrl = 'https://api.yelp.com/v3/'; | ||
if(this.accessToken) Promise.resolve(this.accessToken) | ||
return http.post(tokenUrl, this.credentials , {form: true}) | ||
.then((res) => {this.accessToken = res.body.access_token; return this.accessToken}) | ||
.catch(err => new Error(err.message)) | ||
} | ||
return http.post(tokenUrl, qs.stringify(this.credentials) ) | ||
.then((res) => { this.accessToken = res.data.access_token;return this.accessToken}) | ||
} | ||
@@ -27,5 +27,4 @@ get(resource,params){ | ||
return this.getAccessToken() | ||
.then(token => http.get(baseUrl + resource ,{ querystring:params, headers: {'Authorization': 'Bearer ' + token}})) | ||
.then(res => res.body) | ||
.catch(err => new Error(err.message)) | ||
.then(token => http({method:'get' ,url:baseUrl + resource, params:params, headers: {'Authorization': 'Bearer ' + token}})) | ||
.then(res => res.data) | ||
} | ||
@@ -32,0 +31,0 @@ |
{ | ||
"name": "v3-yelp-api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Node Wrapper for Yelp Api V3", | ||
@@ -25,4 +25,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"httpism": "^2.7.0" | ||
"axios": "^0.16.1", | ||
"querystring": "^0.2.0" | ||
} | ||
} |
@@ -1,4 +0,7 @@ | ||
# v3 Yelp Api Wrapper | ||
A simple npm wrapper for Yelp v3 Api | ||
# v3 Yelp Api | ||
A simple npm wrapper for Yelp v3 Api which is compatible with [React Native](https://github.com/facebook/react-native) | ||
## Dependencies | ||
[axios](https://github.com/mzabriskie/axios) | ||
[qs](https://github.com/ljharb/qs) | ||
## Install | ||
@@ -13,3 +16,3 @@ | ||
let credententials = { | ||
const credentials = { | ||
appId:"App Id from Yelp Developer Console", | ||
@@ -19,3 +22,3 @@ app: "App Secret from Yelp Developer Console" | ||
let yelp = New YelpApi(credentials) | ||
const yelp = New YelpApi(credentials) | ||
``` | ||
@@ -38,5 +41,3 @@ | ||
```JavaScript | ||
let params = { | ||
phone: '+442073722882' | ||
} | ||
let params = { phone: '+442073722882' } | ||
@@ -55,3 +56,3 @@ yelp.phoneSearch(params) | ||
yelp.reviews(bestRestaurantEver) | ||
yelp.reviews(bestRestaurantEver) | ||
.then(data => data) | ||
@@ -58,0 +59,0 @@ .catch(err => err) |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
3380
66
0
2
43
+ Addedaxios@^0.16.1
+ Addedquerystring@^0.2.0
+ Addedaxios@0.16.2(transitive)
+ Addedfollow-redirects@1.15.6(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedquerystring@0.2.1(transitive)
- Removedhttpism@^2.7.0
- Removedagent-base@2.1.1(transitive)
- Removeddebug@2.2.0(transitive)
- Removeddom-walk@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedglobal@4.3.0(transitive)
- Removedhttpism@2.7.0(transitive)
- Removedhttps-proxy-agent@1.0.0(transitive)
- Removedmime-db@1.23.0(transitive)
- Removedmime-types@2.1.11(transitive)
- Removedmin-document@2.19.0(transitive)
- Removedms@0.7.1(transitive)
- Removedprocess@0.5.2(transitive)
- Removedrandom-string@0.1.2(transitive)
- Removedsemver@5.0.3(transitive)
- Removedtough-cookie@2.3.1(transitive)
- Removedunderscore@1.8.3(transitive)