+ Instagram Service EndPoint request method

This commit is contained in:
tmshv committed 2016-03-26 01:45:15 +03:00
1 parent 9851f856e3
commit 1e03cd012a
1 file changed
+18 -2
+18 -2
View File
@@ -1,9 +1,25 @@
import request from 'request-promise';
export default class EndPoint{
constructor(client) {
constructor(client, token) {
this.client = client;
this.token = token;
}
method(name){
return this.client[name];
}
}
request(method, path, data=null) {
let buildPath = path => `https://api.instagram.com/v1${path}`;
let options = {
method: method,
uri: buildPath(path),
headers: {}
};
if(data) options.body = data;
return request(options)
.then(i => JSON.parse(i));
}
}