Skip to content

Commit

Permalink
Fix #1 : PS4 and Xboxlive is now managed
Browse files Browse the repository at this point in the history
  • Loading branch information
gclement authored and gclement committed Mar 6, 2017
1 parent 3012242 commit 05e5305
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lib/overwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ const _ = require('lodash/core');
const url = 'https://playoverwatch.com/en-us/career/';
const searchUrl = 'https://playoverwatch.com/en-us/search/account-by-name/';

const gametypes = ['competitive', 'quickplay'];
const GAMETYPES = ['competitive', 'quickplay'];
const PLATFORMS = {
XboxLive : "xbl",
Playstation : "psn",
PC : "pc"
}

let OverwatchProvider = function() {
var self = this;
Expand All @@ -28,7 +33,21 @@ let OverwatchProvider = function() {
}

let getUrl = (platform, region, tag) => {
return url + `${platform}/${region}/${tag}`;

switch(platform)
{
case PLATFORMS.PC :
region = "/" + region
break;
case PLATFORMS.Playstation :
case PLATFORMS.XboxLive :
default :
//// No region must be specified
region = "";
break;
}

return url + `${platform}${region}/${tag}`;
};

let getSearchUrl = (nickname) => {
Expand Down Expand Up @@ -124,7 +143,7 @@ let OverwatchProvider = function() {
promises.push(p);

//// Getting stats
_.each(gametypes, (type) => {
_.each(GAMETYPES, (type) => {
var p = new Promise((resolve, reject) => {
result[type] = {};
result[type].global = parseFeaturedStats($, type);
Expand Down

0 comments on commit 05e5305

Please sign in to comment.