Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yahoo-fantasy

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yahoo-fantasy - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

jasmine-runner.js

6

collections/gamesCollection.js

@@ -28,3 +28,3 @@ var _ = require('lodash');

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/games';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/games';

@@ -98,3 +98,3 @@ if ( _.isString(gameKeys) && !_.isEmpty(gameKeys) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games';

@@ -141,3 +141,3 @@ if ( !( _.isEmpty(filters) ) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=';

@@ -144,0 +144,0 @@ if ( _.isString(gameKeys) ) {

@@ -16,3 +16,3 @@ var _ = require('lodash');

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=';

@@ -19,0 +19,0 @@ if ( _.isString(leagueKeys) ) {

@@ -15,3 +15,3 @@ var _ = require('lodash');

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/players;player_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/players;player_keys=';

@@ -59,3 +59,3 @@ if ( _.isString(playerKeys) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=';

@@ -109,3 +109,3 @@ if ( _.isString(leagueKeys) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/teams;team_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/teams;team_keys=';

@@ -112,0 +112,0 @@ if ( _.isString(teamKeys) ) {

@@ -15,3 +15,3 @@ var _ = require('lodash');

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/teams;team_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/teams;team_keys=';

@@ -57,3 +57,3 @@ if ( _.isString(teamKeys) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=';

@@ -99,3 +99,3 @@ if ( _.isString(leagueKeys) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/teams';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/teams';

@@ -135,3 +135,3 @@ if ( !( _.isEmpty(subresources) ) ) {

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=';

@@ -138,0 +138,0 @@ if ( _.isString(gameKeys) ) {

@@ -11,3 +11,3 @@ var _ = require('lodash');

TransactionsCollection.prototype.fetch = function(transactionKeys, resources, filters, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/transactions;transaction_keys=',
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/transactions;transaction_keys=',
apiCallback = this._fetch_callback.bind(this, cb);

@@ -54,3 +54,3 @@

TransactionsCollection.prototype.leagueFetch = function(leagueKeys, resources, filters, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=',
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=',
apiCallback = this._leagueFetch_callback.bind(this, cb);

@@ -97,6 +97,6 @@

// todo: http://fantasysports.yahooapis.com/fantasy/v2/league/{league_key}/transactions;types=waiver,pending_trade;team_key={team_key}
// todo: https://fantasysports.yahooapis.com/fantasy/v2/league/{league_key}/transactions;types=waiver,pending_trade;team_key={team_key}
TransactionsCollection.prototype.add_player = function(leagueKey, teamKey, playerKey, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json';
var apiCallback = this._add_player_callback.bind(this, cb);

@@ -142,3 +142,3 @@ var xmlData = ' \

TransactionsCollection.prototype.drop_player = function(leagueKey, teamKey, playerKey, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json';
var apiCallback = this._drop_player_callback.bind(this, cb);

@@ -184,3 +184,3 @@ var xmlData = ' \

TransactionsCollection.prototype.adddrop_players = function(leagueKey, teamKey, addPlayerKey, dropPlayerKey, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json';
var apiCallback = this._adddrop_players_callback.bind(this, cb);

@@ -187,0 +187,0 @@ var xmlData = ' \

@@ -16,3 +16,3 @@ var _ = require('lodash');

var url = 'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1';

@@ -19,0 +19,0 @@ if ( !( _.isEmpty(subresources) ) ) {

@@ -7,6 +7,3 @@ /* global module, require */

var OAuth = require('oauth').OAuth,
https = require('https'),
querystring = require('querystring'),
util = require('util'),
var request = require('request'),
GameResource = require('./resources/gameResource.js'),

@@ -27,16 +24,5 @@ LeagueResource = require('./resources/leagueResource.js'),

function YahooFantasy(consumerKey, consumerSecret) {
var oauth = new OAuth(
'https://api.login.yahoo.com/oauth/v2/get_request_token',
'https://api.login.yahoo.com/oauth/v2/get_token',
consumerKey,
consumerSecret,
'1.0',
null,
'HMAC-SHA1'
);
this.GET = 'get';
this.POST = 'post';
this.GET = 'GET';
this.POST = 'POST';
this.oauth = oauth;
this.game = new GameResource(this);

@@ -56,18 +42,7 @@ this.games = new GamesCollection(this);

this.yuser = {
token: null,
secret: null,
sessionHandle: null
};
this.consumer = {
key: consumerKey,
secret: consumerSecret
};
this.yahooUserToken = null;
}
YahooFantasy.prototype.setUserToken = function(userToken, userSecret, userSession) {
this.yuser.token = userToken;
this.yuser.secret = userSecret;
this.yuser.sessionHandle = userSession;
YahooFantasy.prototype.setUserToken = function(token) {
this.yahooUserToken = token;
};

@@ -82,38 +57,26 @@

var callback = this.apiCallback.bind(this, method, url, postData, cb);
if ( this.POST == method ) {
this.oauth.post(
url,
this.yuser.token,
this.yuser.secret,
postData,
'application/xml',
callback
);
} else {
this.oauth.get(
url,
this.yuser.token,
this.yuser.secret,
callback
);
}
var options = {
url: url,
method: method,
json: true,
auth: {
'bearer': this.yahooUserToken
}
};
request(options, callback);
};
YahooFantasy.prototype.apiCallback = function(method, url, postData, cb, e, data, resp) {
try {
data = JSON.parse(data);
YahooFantasy.prototype.apiCallback = function(method, url, postData, cb, e, resp, data) {
if (e) {
return cb(e);
} else {
if ( data.error ) {
// i hate regex so if anyone has a better way to do this...
data.error.reason = String(data.error.description).match( /"(.*?)"/ )[1];
return cb(data.error);
}
if (e) {
return cb(e);
} else {
if ( data.error ) {
return cb(data.error);
}
return cb(null, data);
}
} catch (error) {
return cb(error);
return cb(null, data);
}
};
{
"name": "yahoo-fantasy",
"version": "1.0.2",
"version": "2.0.0",
"description": "An API to help facilitate the use of the Yahoo! Fantasy Sports API in NodeJS projects.",

@@ -27,8 +27,10 @@ "main": "index.js",

"dependencies": {
"lodash": "^4.16.6",
"request": "^2.78.0"
},
"devDependencies": {
"istanbul": "^0.4.3",
"jasmine": "^2.4.1",
"lodash": "^4.11.1",
"nock": "^3.3.2",
"oauth": "^0.9.14"
"nock": "^3.3.2"
}
}

@@ -58,2 +58,5 @@ Yahoo! Fantasy API Node Module

#### 2.0.0
* Moved to Yahoo!'s OAuth2.0 authentication mechanism.
#### 1.0.2

@@ -60,0 +63,0 @@ * Fixed game resource roster postions callback bug.

@@ -17,3 +17,3 @@ var gameHelper = require('../helpers/gameHelper.js');

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/metadata?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/metadata?format=json',
apiCallback

@@ -42,3 +42,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/leagues;league_keys=' + leagueKey.join(',') + '?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/leagues;league_keys=' + leagueKey.join(',') + '?format=json',
apiCallback

@@ -70,3 +70,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/players;player_keys=' + playerKey.join(',') + '?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/players;player_keys=' + playerKey.join(',') + '?format=json',
apiCallback

@@ -94,3 +94,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/game_weeks?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/game_weeks?format=json',
apiCallback

@@ -118,3 +118,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/stat_categories?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/stat_categories?format=json',
apiCallback

@@ -142,3 +142,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/position_types?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/position_types?format=json',
apiCallback

@@ -166,3 +166,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/roster_positions?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/roster_positions?format=json',
apiCallback

@@ -169,0 +169,0 @@ );

@@ -16,3 +16,3 @@ var leagueHelper = require('../helpers/leagueHelper.js');

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/metadata?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/metadata?format=json',
apiCallback

@@ -36,3 +36,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/settings?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/settings?format=json',
apiCallback

@@ -59,3 +59,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/standings?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/standings?format=json',
apiCallback

@@ -78,3 +78,3 @@ );

LeagueResource.prototype.scoreboard = function(leagueKey, week, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/scoreboard'
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/scoreboard'

@@ -120,3 +120,3 @@ if ( 2 == arguments.length ) {

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/teams?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/teams?format=json',
apiCallback

@@ -144,3 +144,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/players?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/players?format=json',
apiCallback

@@ -164,3 +164,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/draftresults?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/draftresults?format=json',
apiCallback

@@ -188,3 +188,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/transactions?format=json',
apiCallback

@@ -191,0 +191,0 @@ );

@@ -20,3 +20,3 @@ var playerHelper = require('../helpers/playerHelper.js');

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/metadata?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/metadata?format=json',
apiCallback

@@ -37,3 +37,3 @@ );

PlayerResource.prototype.stats = function(playerKey, week, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/stats';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/stats';

@@ -80,3 +80,3 @@ if ( 2 == arguments.length ) {

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/percent_owned?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/percent_owned?format=json',
apiCallback

@@ -108,3 +108,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/players;player_keys=' + playerKey + '/ownership?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/players;player_keys=' + playerKey + '/ownership?format=json',
apiCallback

@@ -139,3 +139,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/draft_analysis?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/draft_analysis?format=json',
apiCallback

@@ -142,0 +142,0 @@ );

@@ -10,3 +10,3 @@ var teamHelper = require('../helpers/teamHelper.js');

RosterResource.prototype.players = function(teamKey, date, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/roster';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/roster';

@@ -13,0 +13,0 @@ if ( 2 == arguments.length ) {

@@ -16,3 +16,3 @@ var teamHelper = require('../helpers/teamHelper.js');

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/metadata?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/metadata?format=json',
apiCallback

@@ -36,3 +36,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/stats?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/stats?format=json',
apiCallback

@@ -59,3 +59,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/standings?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/standings?format=json',
apiCallback

@@ -82,3 +82,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/roster?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/roster?format=json',
apiCallback

@@ -105,3 +105,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/draftresults?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/draftresults?format=json',
apiCallback

@@ -123,3 +123,3 @@ );

TeamResource.prototype.matchups = function(teamKey, weeks, cb) {
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/matchups';
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/matchups';

@@ -126,0 +126,0 @@ if ( 2 == arguments.length ) {

@@ -16,3 +16,3 @@ var transactionHelper = require('../helpers/transactionHelper.js');

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/transaction/' + transactionKey + '/players?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/transaction/' + transactionKey + '/players?format=json',
apiCallback

@@ -19,0 +19,0 @@ );

@@ -16,3 +16,3 @@ var userHelper = require('../helpers/userHelper.js');

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games?format=json',
apiCallback

@@ -44,3 +44,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=' + gameKeys.join(',') + '/leagues?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=' + gameKeys.join(',') + '/leagues?format=json',
apiCallback

@@ -71,3 +71,3 @@ );

this.yf.GET,
'http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=' + gameKeys.join(',') + '/teams?format=json',
'https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=' + gameKeys.join(',') + '/teams?format=json',
apiCallback

@@ -74,0 +74,0 @@ );

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc