Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
 - added support for multiple versions: 1.0, 1.1, and 1.2
 - amended list of vailable feeds for v1.x.
  • Loading branch information
bradbarkhouse committed Jan 30, 2018
1 parent 85dabff commit 04cad46
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Free for Non-Commercial Use.
Using composer, simply add it to the "require" section of your composer.json:

"require": {
"mysportsfeeds\mysportsfeeds-php": ">=0.1.0"
"mysportsfeeds\mysportsfeeds-php": ">=1.0.0"
}

If you haven't signed up for API access, do so here [https://www.mysportsfeeds.com/index.php/register/](https://www.mysportsfeeds.com/index.php/register/)
Expand All @@ -22,9 +22,9 @@ Create main MySportsFeeds object with API version as input parameter

use MySportsFeeds\MySportsFeeds;

$msf = new MySportsFeeds("1.0");
$msf = new MySportsFeeds("1.2");

Authenticate (v1.0 uses your MySportsFeeds account credentials)
Authenticate (v1.x uses your MySportsFeeds account credentials)

$msf->authenticate("YOUR_USERNAME", "YOUR_PASSWORD");

Expand Down
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use MySportsFeeds\MySportsFeeds;

$data_query = new MySportsFeeds('1.0', true);
$data_query = new MySportsFeeds('1.2', true);
$data_query->authenticate('YOUR_USERNAME', 'YOUR_PASSWORD');
$data = $data_query->getData(
'nba', // league
Expand Down
2 changes: 1 addition & 1 deletion src/API_v1_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
class API_v1_0 extends BaseApi {
protected function getBaseUrlForVersion($version)
{
return "https://www.mysportsfeeds.com/api/feed/pull";
return "https://api.mysportsfeeds.com/v1.0/pull";
}
}
10 changes: 10 additions & 0 deletions src/API_v1_1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace MySportsFeeds;

class API_v1_1 extends BaseApi {
protected function getBaseUrlForVersion($version)
{
return "https://api.mysportsfeeds.com/v1.1/pull";
}
}
10 changes: 10 additions & 0 deletions src/API_v1_2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace MySportsFeeds;

class API_v1_2 extends BaseApi {
protected function getBaseUrlForVersion($version)
{
return "https://api.mysportsfeeds.com/v1.2/pull";
}
}
6 changes: 6 additions & 0 deletions src/ApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ public static function create($version, $verbose, $storeType, $storeLocation)
case '1.0':
$apiVersion = new API_v1_0($version, $verbose, $storeType, $storeLocation);
break;
case '1.1':
$apiVersion = new API_v1_1($version, $verbose, $storeType, $storeLocation);
break;
case '1.2':
$apiVersion = new API_v1_2($version, $verbose, $storeType, $storeLocation);
break;
default:
$apiVersion = new BaseApi($version, $verbose, $storeType, $storeLocation);
break;
Expand Down
12 changes: 8 additions & 4 deletions src/BaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@ class BaseApi
protected $storeOutput;
protected $version;
protected $validFeeds = [
'current_season',
'cumulative_player_stats',
'full_game_schedule',
'daily_game_schedule',
'daily_player_stats',
'game_playbyplay',
'game_boxscore',
'scoreboard',
'game_playbyplay',
'player_gamelogs',
'team_gamelogs',
'roster_players',
'game_startinglineup',
'active_players',
'overall_team_standings',
'conference_team_standings',
'division_team_standings',
'playoff_team_standings',
'player_injuries',
'latest_updates',
'daily_dfs'
'daily_dfs',
'current_season',
'latest_updates'
];

# Constructor
Expand Down
4 changes: 2 additions & 2 deletions src/MySportsFeeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class MySportsFeeds {

public $buildVersion = "0.1.0";
public $buildVersion = "1.0.0";

private $version;
private $verbose;
Expand All @@ -15,7 +15,7 @@ class MySportsFeeds {

private $apiInstance;

public function __construct($version = "1.0", $verbose = false, $storeType = "file",
public function __construct($version = "1.2", $verbose = false, $storeType = "file",
$storeLocation = "results/") {

$this->__verifyStore($storeType, $storeLocation);
Expand Down

0 comments on commit 04cad46

Please sign in to comment.