-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
4,003 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Sportradar | ||
module Api | ||
module Football | ||
class Situation < Data | ||
attr_accessor :response, :clock, :down, :yfd, :possession, :location, :team_id | ||
|
||
def initialize(data) | ||
@response = data | ||
@clock = data["clock"] | ||
@down = data["down"] | ||
@yfd = data["yfd"] | ||
@possession = OpenStruct.new(data["possession"]) if data["possession"] | ||
@location = OpenStruct.new(data["location"]) if data["location"] | ||
@team_id = possession.id if possession | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'test_helper' | ||
|
||
class Sportradar::Api::Football::Ncaafb::GameExtendedTest < Minitest::Test | ||
|
||
# ESPN box: http://www.espn.com/college-football/boxscore?gameId=400869167 | ||
# ESPN pbp: http://www.espn.com/college-football/playbyplay?gameId=400869167 | ||
def setup | ||
data = {"id"=>"f8ac7454-980d-496a-99af-5824d5f3eea2", | ||
"scheduled"=>"2016-11-26T02:30:00+00:00", | ||
"coverage"=>"full", | ||
"home_rotation"=>"", | ||
"away_rotation"=>"", | ||
"home"=>"ARI", | ||
"away"=>"ASU", | ||
"year"=>2016, | ||
"type"=>'REG', | ||
"week_number"=>13, | ||
} | ||
@game = Sportradar::Api::Football::Ncaafb::Game.new(data) | ||
VCR.use_cassette("ncaafb/game/extended_regulation") do | ||
@game.get_extended_box | ||
@home_id = @game.home_alias | ||
@away_id = @game.away_alias | ||
end | ||
end | ||
|
||
# def test_ncaafb_game_summary | ||
# assert_equal 4, @game.quarters.size | ||
# assert_equal 34, @game.drives.size | ||
# assert_equal 228, @game.plays.size | ||
# end | ||
|
||
# def test_ncaafb_game_play_timing | ||
# assert @game.plays.all?(&:clock) | ||
# end | ||
|
||
# def test_ncaafb_game_plays_have_required_attributes | ||
# assert @game.plays.all?(&:description) | ||
# end | ||
|
||
def test_ncaafb_game_has_score | ||
assert_equal ({"ARI"=>56, "ASU"=>35}), @game.score | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'test_helper' | ||
|
||
class Sportradar::Api::Football::Ncaafb::GameSummaryTest < Minitest::Test | ||
|
||
# ESPN box: http://www.espn.com/college-football/boxscore?gameId=400869167 | ||
# ESPN pbp: http://www.espn.com/college-football/playbyplay?gameId=400869167 | ||
def setup | ||
data = {"id"=>"f8ac7454-980d-496a-99af-5824d5f3eea2", | ||
"scheduled"=>"2016-11-26T02:30:00+00:00", | ||
"coverage"=>"full", | ||
"home_rotation"=>"", | ||
"away_rotation"=>"", | ||
"home"=>"ARI", | ||
"away"=>"ASU", | ||
"year"=>2016, | ||
"type"=>'REG', | ||
"week_number"=>13, | ||
} | ||
@game = Sportradar::Api::Football::Ncaafb::Game.new(data) | ||
VCR.use_cassette("ncaafb/game/summary_regulation") do | ||
@game.get_summary | ||
@home_id = @game.home_alias | ||
@away_id = @game.away_alias | ||
end | ||
end | ||
|
||
# def test_ncaafb_game_summary | ||
# assert_equal 4, @game.quarters.size | ||
# assert_equal 34, @game.drives.size | ||
# assert_equal 228, @game.plays.size | ||
# end | ||
|
||
# def test_ncaafb_game_play_timing | ||
# assert @game.plays.all?(&:clock) | ||
# end | ||
|
||
# def test_ncaafb_game_plays_have_required_attributes | ||
# assert @game.plays.all?(&:description) | ||
# end | ||
|
||
def test_ncaafb_game_has_score | ||
assert_equal ({"ARI"=>56, "ASU"=>35}), @game.score | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.