+ 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
+17 -1
+17 -1
View File
@@ -1,9 +1,25 @@
import request from 'request-promise';
export default class EndPoint{ export default class EndPoint{
constructor(client) { constructor(client, token) {
this.client = client; this.client = client;
this.token = token;
} }
method(name){ method(name){
return this.client[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));
}
} }