Skip to content

Commit

Permalink
Merge pull request #45 from alfg/private-flag
Browse files Browse the repository at this point in the history
Add private flag property for stats and profile pages.
  • Loading branch information
alfg authored Jun 27, 2018
2 parents 209b898 + f62b3bb commit d07feea
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "overwatch-api",
"version": "0.4.1",
"version": "0.5.0",
"description": "An Unoffical Overwatch API.",
"main": "lib/index.js",
"engines": {
Expand Down
2 changes: 2 additions & 0 deletions api/src/parser/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function(platform, region, tag, cb) {
const user = $('.header-masthead').text();
const level = $('.player-level div').first().text();
const portrait = $('.player-portrait').attr('src');
const permission = $('.masthead-permission-level-text').text();

// Get prestige level by matching .player-level background url hex.
const prestigeEl = $('.player-level').first().attr('style');
Expand Down Expand Up @@ -95,6 +96,7 @@ export default function(platform, region, tag, cb) {
username: user,
level: parseInt(level) + prestigeLevel,
portrait: portrait,
private: permission === 'Private Profile',
games: {
quickplay: {
won: parseInt(won.quickplay),
Expand Down
2 changes: 2 additions & 0 deletions api/src/parser/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function(platform, region, tag, cb) {
const user = $('.header-masthead').text();
const level = $('.player-level div').first().text();
const portrait = $('.player-portrait').attr('src');
const permission = $('.masthead-permission-level-text').text();

// Get prestige level by matching .player-level background url hex.
const prestigeEl = $('.player-level').first().attr('style');
Expand Down Expand Up @@ -122,6 +123,7 @@ export default function(platform, region, tag, cb) {
username: user,
level: parseInt(level) + prestigeLevel,
portrait: portrait,
private: permission === 'Private Profile',
stats: stats
}

Expand Down
6 changes: 3 additions & 3 deletions api/test/parser/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getProfile } from '../../src/parser';

const platform = 'pc'
const region = 'us'
const tag = 'Calvin-1337'
const tag = 'xQc-11273'

var result;

Expand Down Expand Up @@ -34,8 +34,8 @@ test('get information of games played by user', t => {
});

test('get information of user playtime', t => {
t.deepEqual(typeof(result.playtime.quickplay), 'string');
t.deepEqual(typeof(result.playtime.competitive), 'string');
t.not(typeof(result.playtime.quickplay), 'undefined');
t.not(typeof(result.playtime.competitive), 'undefined');
});

test('get information of user competitive stats', t => {
Expand Down
2 changes: 1 addition & 1 deletion api/test/parser/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getStats } from '../../src/parser';

const platform = 'pc'
const region = 'us'
const tag = 'Calvin-1337'
const tag = 'xQc-11273'

var result;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "overwatch-api-server",
"version": "0.4.0",
"version": "0.5.0",
"description": "An Unoffical Overwatch HTTP API",
"main": "server/index.js",
"engines": {
Expand Down

0 comments on commit d07feea

Please sign in to comment.