coinkraal-api-interface
Advanced tools
Comparing version 0.1.0 to 0.2.0
17
agent.js
@@ -10,2 +10,3 @@ | ||
this.apiRoot = apiRoot; | ||
this.superagent = superagentPromise(_superagent, global.Promise); | ||
@@ -16,3 +17,3 @@ | ||
this.superagent | ||
.del(`${apiRoot}${url}`) | ||
.del(getApi(url)) | ||
.use(tokenHandler) | ||
@@ -23,3 +24,3 @@ .end(errorHandler) | ||
this.superagent | ||
.get(`${apiRoot}${url}`) | ||
.get(getApi(url)) | ||
.use(tokenHandler) | ||
@@ -30,3 +31,3 @@ .end(errorHandler) | ||
this.superagent | ||
.get(`${apiRoot}${url}`) | ||
.get(getApi(url)) | ||
.use(tokenHandler) | ||
@@ -37,3 +38,3 @@ .end(errorHandler) | ||
this.superagent | ||
.put(`${apiRoot}${url}`, body) | ||
.put(getApi(url), body) | ||
.use(tokenHandler) | ||
@@ -44,3 +45,3 @@ .end(errorHandler) | ||
this.superagent | ||
.post(`${apiRoot}${url}`, body) | ||
.post(getApi(url), body) | ||
.use(tokenHandler) | ||
@@ -57,4 +58,10 @@ .end(errorHandler) | ||
getApi(api) { | ||
if(api.indexOf('http') == -1) | ||
return `${this.apiRoot}${api}`; | ||
return api; | ||
} | ||
} | ||
module.exports = Agent; |
15
api.js
var Agent = require('./agent') | ||
var Auth = require('./interface/auth') | ||
var Coin = require('./interface/coin') | ||
var CoinMarketCap = require('./interface/coin-market-cap') | ||
var CryptoCompare = require('./interface/crypto-compare') | ||
var Sale = require('./interface/sale') | ||
var Social = require('./interface/social') | ||
var Transaction = require('./interface/transaction') | ||
var User = require('./interface/user') | ||
@@ -12,2 +20,9 @@ class Api { | ||
this.Auth = new Auth(agent); | ||
this.Coin = new Coin(agent); | ||
this.CoinMarketCap = new CoinMarketCap(agent); | ||
this.CryptoCompare = new CryptoCompare(agent); | ||
this.Sale = new Sale(agent); | ||
this.Social = new Social(agent); | ||
this.Transaction = new Transaction(agent); | ||
this.User = new User(agent); | ||
} | ||
@@ -14,0 +29,0 @@ } |
let PortfolioChartService = require('./services/portfolio-chart/portfolio-chart-service'); | ||
let Api = require('./api'); | ||
module.exports = PortfolioChartService; | ||
module.exports = Api; |
@@ -11,7 +11,7 @@ | ||
googleLogin(googleTokenId) { | ||
return this.agent.requests.post('/auth/signin/google', { token: googleTokenId }) | ||
return this.agent.requests.post('/auth/signin/google', { token: googleTokenId }); | ||
} | ||
facebookLogin(accessToken, email, userID, name, picture) { | ||
return this.agent.requests.post('/auth/signin/facebook', { accessToken: accessToken, email: email, userId: userID, name: name, picture: picture }) | ||
return this.agent.requests.post('/auth/signin/facebook', { accessToken: accessToken, email: email, userId: userID, name: name, picture: picture }); | ||
} | ||
@@ -18,0 +18,0 @@ |
@@ -5,5 +5,5 @@ | ||
describe('Auth()', function () { | ||
describe('Auth', function () { | ||
it('googleLogin - valid url', function (done) { | ||
it('googleLogin()', function (done) { | ||
@@ -28,3 +28,3 @@ //Given: | ||
it('facebookLogin - valid url', function (done) { | ||
it('facebookLogin()', function (done) { | ||
@@ -31,0 +31,0 @@ //Given: |
{ | ||
"name": "coinkraal-api-interface", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Api Interface for CoinKraal Applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17413
21
456
1