repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_all_starting_pitchers_for_detroit.rb
test/test_all_starting_pitchers_for_detroit.rb
# This test will print a list of the starting pitchers for each of the Detroit # Tigers games from the 2009 season. $: << File.expand_path(File.dirname(__FILE__) + "/../lib") require 'team' team = Team.new('det') pitchers = team.get_start_pitcher_appearances_by_year('2009') count = 1 pitchers.each do |appearance| ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_leadoff_and_cleanup_hitters.rb
test/test_leadoff_and_cleanup_hitters.rb
# This test will print two lists. The first list will be of the leadoff hitters for each of the Detroit # Tigers games from the 2009 season. The second list will be of the cleanup (4th) hitters for each of # the Tigers 2009 games. $: << File.expand_path(File.dirname(__FILE__) + "/../lib") require 'team' team = Te...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_boxscore.rb
test/unit_tests/test_boxscore.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'box_score' class TestBoxScore < Test::Unit::TestCase def setup end def test_load_from_id bs = BoxScore.new bs.load_from_id('2009_09_20_detmlb_minmlb_1') assert bs.gid == '2009_09_20_detmlb_minmlb_1' ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_inning.rb
test/unit_tests/test_inning.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'inning' class TestInning < Test::Unit::TestCase def test_load_from_id inning = Inning.new inning.load_from_id(get_gid, 3) assert inning.gid == get_gid assert inning.num == '3' assert inning.away_team...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_gameday_fetcher.rb
test/unit_tests/test_gameday_fetcher.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'gameday_fetcher' class TestGamedayFetcher < Test::Unit::TestCase def setup end def test_fetch_bench result = GamedayFetcher.fetch_bench('2009_09_20_detmlb_minmlb_1') assert_not_nil result assert r...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_media.rb
test/unit_tests/test_media.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'media' class TestTeam < Test::Unit::TestCase def test_load_from_id media = Media.new media.load_from_id('2009_09_20_detmlb_minmlb_1') assert_not_nil media.highlights assert_not_nil media.mobile asser...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_pitcher.rb
test/unit_tests/test_pitcher.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'pitcher' class TestPitcher < Test::Unit::TestCase def test_load_from_id pitcher = Pitcher.new pitcher.load_from_id('2010_04_13_kcamlb_detmlb_1','453286') assert pitcher.team_abbrev == 'det' assert pitche...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_team.rb
test/unit_tests/test_team.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'team' class TestTeam < Test::Unit::TestCase def setup @team = Team.new('det') end def test_intialize assert @team.city == 'Detroit' assert @team.name == 'Tigers' assert @team.league == 'America...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_pitching_appearance.rb
test/unit_tests/test_pitching_appearance.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'pitching_appearance' class TestPitchingAppearance < Test::Unit::TestCase def test_init end end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_gameday_util.rb
test/unit_tests/test_gameday_util.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'gameday_util' class TestGamedayUtil < Test::Unit::TestCase def test_parse_date_string date = '20100401' result = GamedayUtil.parse_date_string(date) assert_not_nil result assert result[0] == '2010' a...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_event_log.rb
test/unit_tests/test_event_log.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'event_log' class TestEventLog < Test::Unit::TestCase def test_load_from_id log = EventLog.new log.load_from_id(get_gid) assert_not_nil log.gid assert log.gid == get_gid assert_not_nil log.away_team ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_batter.rb
test/unit_tests/test_batter.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'batter' class TestBatter < Test::Unit::TestCase def test_load_from_id batter = Batter.new batter.load_from_id('2009_09_20_detmlb_minmlb_1','136722') assert batter.team_abbrev == 'det' assert batter.first...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_roster.rb
test/unit_tests/test_roster.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'roster' class TestRoster < Test::Unit::TestCase def test_find_player_by_last_name game = Game.new('2009_09_20_detmlb_minmlb_1') rosters = game.get_rosters player = rosters[0].find_player_by_last_name('Verlan...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_batting_appearance.rb
test/unit_tests/test_batting_appearance.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'batting_appearance' class TestBattingAppearance < Test::Unit::TestCase def test_init end end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_gameday_url_builder.rb
test/unit_tests/test_gameday_url_builder.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'gameday_url_builder' class TestGamedayUrlBuilder < Test::Unit::TestCase def setup end def test_build_eventlog_url url = GamedayUrlBuilder.build_eventlog_url('2009', '9', '20', '2009_09_20_detmlb_minmlb_1') ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_pitch.rb
test/unit_tests/test_pitch.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'pitch' class TestPitch < Test::Unit::TestCase def test_init end end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/all_tests.rb
test/unit_tests/all_tests.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'gameday_util' GamedayUtil.set_fetcher('remote') require 'test/unit' require 'test_gameday_util' require 'test_gameday_url_builder' require 'test_team' require 'test_game' require 'test_boxscore' require 'test_player' require 'test_gameday_fetcher...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_player.rb
test/unit_tests/test_player.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'player' class TestPlayer < Test::Unit::TestCase def test_load_from_id player = Player.new player.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') assert player.gid == '2009_09_20_detmlb_minmlb_1' ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/test_game.rb
test/unit_tests/test_game.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib") require 'test/unit' require 'game' class TestGame < Test::Unit::TestCase def setup end def test_initialize gid = '2008_04_07_atlmlb_colmlb_1' game = Game.new(gid) assert_not_nil game assert game.gid == '2008_04_07_atlmlb_...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/long_running/test_pitcher.rb
test/unit_tests/long_running/test_pitcher.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") require 'test/unit' require 'pitcher' class TestPitcher < Test::Unit::TestCase def setup if !@pitcher @pitcher = Pitcher.new @pitcher.load_from_id('2009_09_20_detmlb_minmlb_1', '434378') assert @pitcher.first_name == 'Justi...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/long_running/test_team.rb
test/unit_tests/long_running/test_team.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") require 'test/unit' require 'team' class TestTeam < Test::Unit::TestCase def setup if !@team @team = Team.new('det') end end def test_long_running all_games_test all_home_games_test all_away_games_test get...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/long_running/test_batter.rb
test/unit_tests/long_running/test_batter.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") require 'test/unit' require 'batter' class TestBatter < Test::Unit::TestCase def setup if !@batter @batter = Batter.new @batter.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') end end def test_long_running g...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/long_running/all_long_running.rb
test/unit_tests/long_running/all_long_running.rb
require 'test/unit' require 'test_team' require 'test_player' require 'test_batter' require 'test_pitcher'
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/unit_tests/long_running/test_player.rb
test/unit_tests/long_running/test_player.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") require 'test/unit' require 'player' class TestPlayer < Test::Unit::TestCase def setup if !@player @player = Player.new @player.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') end end def test_long_running ge...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api.rb
lib/gameday_api.rb
require "gameday_api/version" module GamedayApi # Your code goes here... end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/hip.rb
lib/gameday_api/hip.rb
module GamedayApi class Hip attr_accessor :des, :x, :y, :batter_id, :pitcher_id, :hip_type, :team, :inning def initialize(element) @des = element.attributes["des"] @x = element.attributes["x"] @y = element.attributes["y"] @batter_id = element.attributes["batter"] @pitch...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_remote_fetcher.rb
lib/gameday_api/gameday_remote_fetcher.rb
require 'gameday_api/gameday_url_builder' module GamedayApi class GamedayRemoteFetcher def self.fetch(url) resp = GamedayUtil.net_http.get_response(URI.parse(url)) case resp when Net::HTTPSuccess result = resp.body else result = nil end result en...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/media_highlight.rb
lib/gameday_api/media_highlight.rb
module GamedayApi class MediaHighlight attr_accessor :id, :date, :type, :v attr_accessor :headline, :duration, :thumb_url attr_accessor :res_400_url, :res_500_url, :res_800_url def initialize(element) @id = element.attributes['id'] @date = element.attributes['date'] @type = el...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/schedule_game.rb
lib/gameday_api/schedule_game.rb
module GamedayApi # This class represents a single game from a game schedule # This class is used in conjunction with the Schedule class. # This is not the class you would use to retrieve game statistics. class ScheduleGame attr_accessor :date, :day_of_week, :away_team_abbrev, :away_league, :away_game_n...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/import_data.rb
lib/gameday_api/import_data.rb
require 'gameday_api/db_importer' db = DbImporter.new('localhost','root','','pitchfx') #db.import_for_month('2010','04') db.import_for_date('2010','04', '05')
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/players.rb
lib/gameday_api/players.rb
require 'gameday_api/roster' module GamedayApi # This class represents the players.xml file found on the gameday server for each MLB game. # The players.xml file contains a listing of all players on the home and away teams for the specified game class Players attr_accessor :xml_data, :gid, :venue, :date...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/at_bat.rb
lib/gameday_api/at_bat.rb
require 'gameday_api/pitch' module GamedayApi # This class represents a single atbat during a single game class AtBat attr_accessor :gid, :inning, :away_team, :home_team attr_accessor :num, :b, :s, :o, :batter_id, :stand, :b_height, :pitcher_id, :p_throws, :des, :event attr_accessor :pitches ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/box_score.rb
lib/gameday_api/box_score.rb
require 'gameday_api/team' require 'gameday_api/pitching_appearance' require 'gameday_api/batting_appearance' require 'gameday_api/gameday_fetcher' require 'gameday_api/line_score' require 'hpricot' require 'rexml/document' require 'gameday_api/gameday_util' module GamedayApi # Parses the MLB Gameday XML representa...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/version.rb
lib/gameday_api/version.rb
module GamedayApi VERSION = "0.0.1" end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/event.rb
lib/gameday_api/event.rb
module GamedayApi class Event attr_accessor :number, :inning, :description, :team def load(element, home_or_away) @xml_doc = element @team = home_or_away @number = element.attributes["number"] @inning = element.attributes["inning"] @description = element.attributes["descripti...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/media.rb
lib/gameday_api/media.rb
require 'gameday_api/gameday_fetcher' require 'gameday_api/media_highlight' require 'gameday_api/media_mobile' module GamedayApi class Media attr_accessor :gid, :highlights, :mobile def load_from_id(gid) @gid = gid @highlights = [] @mobile = [] begin @xml_highlights...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday.rb
lib/gameday_api/gameday.rb
require 'rubygems' require 'net/http' require 'hpricot' require 'erb' require 'gameday_api/game' require 'gameday_api/team' require 'gameday_api/box_score' module GamedayApi class Gameday # Change this to point to the server you are reading Gameday data from GD2_MLB_BASE = "http://gd2.mlb.com/components/gam...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_util.rb
lib/gameday_api/gameday_util.rb
require 'open-uri' require 'yaml' module GamedayApi # This class provides a variety of utility methods that are used in other classes class GamedayUtil @@fetcher = '' # Returns an instance of the configured fetcher, either remote or local def self.fetcher if @@fetcher == '' rea...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/batting_appearance.rb
lib/gameday_api/batting_appearance.rb
require 'gameday_api/player' module GamedayApi # This class represents a batting record for a single player for a single game # Note that this does NOT represent a single atbat of a player, but rather an appearance is a player's stats over an entire game. class BattingAppearance attr_accessor :pid, :batte...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/event_log.rb
lib/gameday_api/event_log.rb
require 'gameday_api/event' require 'gameday_api/gameday_fetcher' module GamedayApi # Parses the MLB Gameday eventLog.xml file class EventLog attr_accessor :home_team, :away_team, :gid attr_accessor :home_events, :away_events attr_accessor :max_inning # Loads the eventLog XML from the MLB...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/game.rb
lib/gameday_api/game.rb
require 'gameday_api/gameday_util' require 'gameday_api/team' require 'gameday_api/players' require 'gameday_api/game_status' require 'gameday_api/event_log' require 'gameday_api/inning' require 'gameday_api/hitchart' require 'gameday_api/media' module GamedayApi # This class represents a single MLB game class Gam...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_parser.rb
lib/gameday_api/gameday_parser.rb
require 'rexml/document' module GamedayApi # This class parses various Gameday data files # This works with Rails and ActiveRecord class GamedayParser def self.parse_player_data(doc, team, logger) updated_player_count = 0 new_player_count = 0 doc.root.each_element do |player| gameday_id =...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/batter.rb
lib/gameday_api/batter.rb
require 'gameday_api/player' module GamedayApi # This class represents a single batter whom appeared in an MLB game class Batter < Player # attributes read from the batters/(pid).xml file attr_accessor :team_abbrev, :pid, :pos, :first_name, :last_name, :jersey_number attr_accessor :height, :weight...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/pitcher.rb
lib/gameday_api/pitcher.rb
require 'gameday_api/player' module GamedayApi # This class represents a single pitcher whom appeared in an MLB game class Pitcher < Player # attributes read from the pitchers/(pid).xml file attr_accessor :team_abbrev, :gid, :pid, :first_name, :last_name, :jersey_number attr_accessor :height, :weig...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/player.rb
lib/gameday_api/player.rb
require 'gameday_api/gameday_fetcher' module GamedayApi # This class represents a single MLB player from a single MLB game class Player # attributes from players.xml attr_accessor :gid, :pid, :first, :last, :num, :boxname, :rl, :position, :status, :bat_order, :game_position attr_accessor :avg, :hr...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/db_importer.rb
lib/gameday_api/db_importer.rb
require 'gameday_api/pitchfx_db_manager' require 'gameday_api/game' require 'date' module GamedayApi class DbImporter # player # team # game # atbat # pitch # pitch type # game type # umpire def initialize(host, user, password, db_name) @db = PitchfxDbManager.new(host, user, password...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/media_mobile.rb
lib/gameday_api/media_mobile.rb
module GamedayApi class MediaMobile attr_accessor :id, :date, :type, :top_play, :player_id attr_accessor :team_id, :headline, :duration, :thumb_url attr_accessor :iphone_low_url, :iphone_hi_url attr_accessor :h264_low_url, :h264_hi_url def initialize(element) end end end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_local_fetcher.rb
lib/gameday_api/gameday_local_fetcher.rb
require 'gameday_api/gameday_path_builder' module GamedayApi # This class is responsible for retrieving gameday data files from the local file system. # It contains methods that read or open a connection to the XML files that have been saved # to the local filesystem. class GamedayLocalFetcher # ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/cache_fetcher.rb
lib/gameday_api/cache_fetcher.rb
require 'net/http' require 'md5' module GamedayApi class CacheFetcher def initialize(cache_dir=File.expand_path(File.dirname(__FILE__)) + '/tmp') # this is the dir where we store our cache @cache_dir = cache_dir end def fetch(url) file = MD5.hexdigest(url) f...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_path_builder.rb
lib/gameday_api/gameday_path_builder.rb
require 'gameday_api/gameday' module GamedayApi class GamedayPathBuilder FILE_BASE_PATH = 'components/game/mlb' def self.year_month_day_path "year_" + @@year + "/month_" + @@month + "/day_" + @@day end def self.build_game_base_path(gid) gameday_info = GamedayUtil.parse_gameda...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/pitchfx_db_manager.rb
lib/gameday_api/pitchfx_db_manager.rb
require 'rubygems' require 'mysql2' require 'gameday_api/pitching_line' module GamedayApi # This class is used to insert data into the pitchfx database class PitchfxDbManager def initialize(host, user, password, db_name) @host = host @user = user @password = password @...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
true
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/line_score.rb
lib/gameday_api/line_score.rb
module GamedayApi # This class contains data representing a linescore for a single game. class LineScore attr_accessor :xml_doc attr_accessor :away_team_runs, :home_team_runs, :away_team_hits, :home_team_hits, :away_team_errors, :home_team_errors attr_accessor :innings # Initialize this insta...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/pitching_appearance.rb
lib/gameday_api/pitching_appearance.rb
module GamedayApi # This class holds data that represents a single pitching appearance by a pitcher. class PitchingAppearance attr_accessor :pid, :gid, :pitcher_name, :out, :inn, :er, :r, :h, :so, :hr, :bb, :bf attr_accessor :w, :l, :era, :note, :start, :game attr_accessor :pitches, :b, :s, :x, :max...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/hitchart.rb
lib/gameday_api/hitchart.rb
require 'gameday_api/hip' module GamedayApi class Hitchart attr_accessor :hips, :gid def initialize @hips = [] end def load_from_gid(gid) @gid = gid @xml_data = GamedayFetcher.fetch_inning_hit(gid) @xml_doc = REXML::Document.new(@xml_data) if @xml_doc.roo...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/coach.rb
lib/gameday_api/coach.rb
# This class represents a single MLB coach module GamedayApi class Coach attr_accessor :position, :first, :last, :id, :num def init(element) self.id = element.attributes['id'] self.first = element.attributes['first'] self.last = element.attributes['last'] self.num= ele...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_url_builder.rb
lib/gameday_api/gameday_url_builder.rb
require 'gameday_api/gameday' module GamedayApi class GamedayUrlBuilder def self.build_game_base_url(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) "#{Gameday::GD2_MLB_BASE}/mlb/year_" + gameday_info['year'] + "/month_" + gameday_info['month'] + "/day_" + gameday_info['day'] + "/...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/roster.rb
lib/gameday_api/roster.rb
require 'gameday_api/player' require 'gameday_api/coach' module GamedayApi # This class represents a team's roster for a single game. # Both players and coaches can be read from the roster. class Roster attr_accessor :gid, :id, :team_name, :type, :players, :coaches # type = home or away def in...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/team.rb
lib/gameday_api/team.rb
require 'gameday_api/gameday_util' require 'gameday_api/game' require 'gameday_api/gameday' require 'gameday_api/schedule' module GamedayApi # This class class Team START_MONTH = 4 # April END_MONTH = 10 # October attr_accessor :abrev, :city, :name, :league, :games # Setup team names, ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/pitch.rb
lib/gameday_api/pitch.rb
module GamedayApi # This class represents a single pitch in an MLB baseball game. # Most of the attributes represent the physics of the pitch thrown. # # Pitch Type Codes # FS = Splitter # SL = Slider # FF = Fastball # SI = Sinker # CH = Change # FA = Fastball # CU = Curve # FC ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/gameday_fetcher.rb
lib/gameday_api/gameday_fetcher.rb
require 'gameday_api/gameday_remote_fetcher' require 'gameday_api/gameday_local_fetcher' module GamedayApi # This class is responsible for retrieving the Gameday files. # It uses either a remote or a local fetcher to get the files from a # remote server or the local file system. # # The files that can be f...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/schedule.rb
lib/gameday_api/schedule.rb
require 'gameday_api/schedule_game' module GamedayApi # This class is used to retrieve season schedule information and to query # for information related to the schedule. class Schedule attr_accessor :games # Loads a single season schedule from a schedule text file def initialize(year) ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/game_status.rb
lib/gameday_api/game_status.rb
module GamedayApi class GameStatus attr_accessor :status, :ind, :reason, :inning, :top_inning, :b, :s, :o end end
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/pitching_line.rb
lib/gameday_api/pitching_line.rb
module GamedayApi class PitchingLine attr_accessor :line_id,:game_id, :pitcher_id, :name, :pos, :outs, :bf, :er, :r, :h, :so, :hr, :bb, :w, :l, :era, :note def init_from_db(line_id, db) res = db.get_pitcher_line(line_id) res.each do |row| @line_id = row[0] @game_id = row[1] ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/data_downloader.rb
lib/gameday_api/data_downloader.rb
require 'gameday_api/game' require 'gameday_api/batter' require 'gameday_api/pitcher' require 'fileutils' require 'gameday_api/gameday_fetcher' module GamedayApi # This class is used to download data files from the MLB Gameday site to # local storage. The data that is downloaded will be stored into a path that ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/inning.rb
lib/gameday_api/inning.rb
require 'gameday_api/at_bat' require 'gameday_api/gameday_fetcher' module GamedayApi # This class represents a single inning of an MLB game class Inning attr_accessor :gid, :num, :away_team, :home_team, :top_atbats, :bottom_atbats # loads an Inning object given a game id and an inning number ...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
timothyf/gameday_api
https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/scoreboard.rb
lib/gameday_api/scoreboard.rb
require 'gameday_api/gameday_fetcher' module GamedayApi class Scoreboard attr_accessor :games # An array of Game objects representing all of the games played on this date attr_accessor :year, :month, :day def load_for_date(year, month, day) @games = [] @year = year @month = mont...
ruby
MIT
7dc1e19d41723b998fdd9c8d6767011b7c2e9673
2026-01-04T17:34:15.959323Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/test_helper.rb
test/test_helper.rb
require 'bundler/setup' require 'pry' require 'pry-byebug' require 'minitest/autorun' require "minitest/reporters" require 'coveralls' Coveralls.wear! Minitest::Reporters.use! require 'spy' Dir.glob(File.expand_path("../support/*", __FILE__)).each do |file| require file end
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/support/pen.rb
test/support/pen.rb
class Pen attr_reader :written, :color def initialize(color = :black) @color = color @written = [] end def write(string) @written << string string end def write_block(&block) string = yield @written << string string end def write_hello write("hello") end def writ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/integration/test_instance_method.rb
test/integration/test_instance_method.rb
require 'test_helper' class TestAnyInstanceOf < Minitest::Test class Foo def bar "foobar" end end class Bar < Foo def bar super end end def teardown Spy::Agency.instance.dissolve! end def test_call_through_with_instance_method Spy.on_instance_method(Foo, :bar).and_c...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/integration/test_subroutine_spying.rb
test/integration/test_subroutine_spying.rb
require 'test_helper' class TestSpy < Minitest::Test def setup @pen = Pen.new end def teardown Spy::Agency.instance.dissolve! end def test_spy_on_hooks_and_saves_spy_with_array pen_write_spy, pen_write_hello_spy = Spy.on(@pen, :write, :write_hello) assert_nil @pen.write("hello") assert_...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/integration/test_class_method.rb
test/integration/test_class_method.rb
require 'test_helper' class TestClassMethod < Minitest::Test def teardown Spy::Agency.instance.dissolve! end def test_and_return klass = Class.new do def self.class_method(*args, &block) end end received_args = nil received_block = nil Spy.on(klass, :class_method).and_return ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/integration/test_constant_spying.rb
test/integration/test_constant_spying.rb
require 'test_helper' class TestConstantSpying < Minitest::Test class Foo HELLO = "hello world" def self.hello HELLO end module Bar def self.hello HELLO end end end class ChildFoo < Foo def self.hello HELLO end end def teardown Spy::Agency....
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/integration/test_api.rb
test/integration/test_api.rb
require 'test_helper' class TestApi < Minitest::Test include Spy::API def setup @pen = Pen.new Spy.on(@pen, :write) end def test_assert_received @pen.write(:hello) assert_received(@pen, :write) end def test_assert_received_with @pen.write(:world) assert_received_with(@pen, :write...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/integration/test_mocking.rb
test/integration/test_mocking.rb
require 'test_helper' class TestMocking < Minitest::Test def teardown Spy::Agency.instance.dissolve! end def test_spy_on_mock_does_not_raise mock = Spy.mock(Pen) spy = Spy.on(mock, :write).and_return(:awesome) assert_equal :awesome, mock.write("hello") assert spy.has_been_called? end de...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/spy/test_mock.rb
test/spy/test_mock.rb
require 'test_helper' module Spy class TestMock < Minitest::Test class BluePen < Pen def write_hello(other) end end def setup @pen_mock = Mock.new(BluePen) @pen = @pen_mock.new end def teardown Spy::Agency.instance.dissolve! end def test_class_methods ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/spy/test_unhook.rb
test/spy/test_unhook.rb
require 'test_helper' module Spy class TestUnhook < Minitest::Test module ModuleFunctionStyle extend self def hello 'hello world' end end module Injected def hello 'hello world' end end class ModuleInjectedStyle include Injected end ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/test/spy/test_subroutine.rb
test/spy/test_subroutine.rb
require 'test_helper' module Spy class TestSubroutine < Minitest::Test def spy_on(base_object, method_name) Subroutine.new(base_object, method_name).hook end def spy_on_instance_method(base_object, method_name) Subroutine.new(base_object, method_name, false).hook end def setup ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy.rb
lib/spy.rb
require "spy/exceptions" require "spy/core_ext/marshal" require "spy/agency" require "spy/api" require "spy/base" require "spy/call_log" require "spy/constant" require "spy/mock" require "spy/nest" require "spy/subroutine" require "spy/version" module Spy class << self # create a spy on given object # @para...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/agency.rb
lib/spy/agency.rb
require 'singleton' module Spy # Manages all the spies class Agency include Singleton # @private def initialize clear! end # given a spy ID it will return the associated spy # @param id [Integer] spy object id # @return [Nil, Subroutine, Constant, Double] def find(id) ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/version.rb
lib/spy/version.rb
module Spy VERSION = "1.0.5" end
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/exceptions.rb
lib/spy/exceptions.rb
module Spy Error = Class.new(StandardError) AlreadyStubbedError = Class.new(Error) AlreadyHookedError = Class.new(Error) NotHookedError = Class.new(Error) NeverHookedError = Class.new(Error) NoSpyError = Class.new(Error) end
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/call_log.rb
lib/spy/call_log.rb
module Spy class CallLog # @!attribute [r] object # @return [Object] object that the method was called from # # @!attribute [r] called_from # @return [String] where the method was called from # # @!attribute [r] args # @return [Array] arguments were sent to the method # ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/api.rb
lib/spy/api.rb
module Spy module API DidNotReceiveError = Class.new(Spy::Error) def assert_received(base_object, method_name) assert Subroutine.get(base_object, method_name).has_been_called?, "#{method_name} was not called on #{base_object.inspect}" end def assert_received_with(base_object, method_na...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/base.rb
lib/spy/base.rb
module Spy module Base end end
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/subroutine.rb
lib/spy/subroutine.rb
module Spy class Subroutine include Base # @!attribute [r] base_object # @return [Object] the object that is being watched # # @!attribute [r] method_name # @return [Symbol] the name of the method that is being watched # # @!attribute [r] singleton_method # @return [Boolean] ...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/nest.rb
lib/spy/nest.rb
module Spy # This class manages all the Constant Mutations for a given Module class Nest # @!attribute [r] base_module # @return [Module] The module that the Nest is managing # # @!attribute [r] constant_spies # @return [Hash<Symbol, Constant>] The module that the Nest is managing att...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/constant.rb
lib/spy/constant.rb
module Spy class Constant include Base # @!attribute [r] base_module # @return [Module] the module that is being watched # # @!attribute [r] constant_name # @return [Symbol] the name of the constant that is/will be stubbed # # @!attribute [r] original_value # @return [Object]...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/integration.rb
lib/spy/integration.rb
require 'spy' module Spy if defined?(::MiniTest::Unit::TestCase) || defined?(::Minitest::Test) module MiniTestAdapter include API def after_teardown super Spy.teardown end end if defined?(::MiniTest::Unit::TestCase) && !::MiniTest::Unit::TestCase.include?(MiniTestAdapte...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/mock.rb
lib/spy/mock.rb
module Spy # A Mock is an object that has all the same methods as the given class. # Each method however will raise a NeverHookedError if it hasn't been stubbed. # If you attempt to stub a method on the mock that doesn't exist on the # original class it will raise an error. module Mock include Base CL...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
ryanong/spy
https://github.com/ryanong/spy/blob/6ac9240b6b628421f573b6bfc6c30b93a26ba567/lib/spy/core_ext/marshal.rb
lib/spy/core_ext/marshal.rb
module Marshal class << self # @private def dump_with_mocks(*args) object = args.shift spies = Spy::Subroutine.get_spies(object) if spies.empty? return dump_without_mocks(*args.unshift(object)) end spy_hook_options = spies.map do |spy| [spy.hook_opts, spy.unhook]...
ruby
MIT
6ac9240b6b628421f573b6bfc6c30b93a26ba567
2026-01-04T17:34:30.876928Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/test/test_smtp_xoauth_authenticator.rb
test/test_smtp_xoauth_authenticator.rb
require 'helper' class TestSmtpXoauthAuthenticator < Test::Unit::TestCase def setup end def test_smtp_authenticator_is_enabled assert Net::SMTP.new(nil).respond_to?(:auth_xoauth), 'The Net::SMTP class should define the method :auth_xoauth' end def test_authenticate_with_invalid_credentials s...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/test/test_imap_xoauth_authenticator.rb
test/test_imap_xoauth_authenticator.rb
require 'helper' class TestImapXoauthAuthenticator < Test::Unit::TestCase def setup end def test_xoauth_authenticator_is_enabled authenticators = Net::IMAP.__send__('class_variable_get', '@@authenticators') assert_not_nil authenticators['XOAUTH'] assert_equal authenticators['XOAUTH'], GmailXoau...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/test/test_smtp_xoauth2_authenticator.rb
test/test_smtp_xoauth2_authenticator.rb
require 'helper' class TestSmtpXoauthAuthenticator < Test::Unit::TestCase def setup end def test_smtp_authenticator_is_enabled assert Net::SMTP.new(nil).respond_to?(:auth_xoauth2), 'The Net::SMTP class should define the method :auth_xoauth2' end def test_authenticate_with_invalid_credentials ...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/test/test_oauth_string.rb
test/test_oauth_string.rb
require 'helper' class TestOauthString < Test::Unit::TestCase def setup end def test_build_oauth_string_should_accept_custom_consumer OAuth::Helper.stubs(:generate_key).returns('abc') OAuth::Helper.stubs(:generate_timestamp).returns(1274215474) request_url = "https://mail.google.com/mail/b...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/test/helper.rb
test/helper.rb
require 'yaml' require 'rubygems' require 'test/unit' require 'mocha/test_unit' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'gmail_xoauth' # Wanna debug ? Activate the IMAP debug mode, it will show the client/server conversation # Net::IMAP.de...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/test/test_imap_xoauth2_authenticator.rb
test/test_imap_xoauth2_authenticator.rb
require 'helper' class TestImapXoauth2Authenticator < Test::Unit::TestCase def setup end def test_xoauth2_authenticator_is_enabled authenticators = Net::IMAP.__send__('class_variable_get', '@@authenticators') assert_not_nil authenticators['XOAUTH2'] assert_equal authenticators['XOAUTH2'], Gmail...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth.rb
lib/gmail_xoauth.rb
require 'gmail_xoauth/oauth_string' require 'gmail_xoauth/imap_xoauth_authenticator' require 'gmail_xoauth/imap_xoauth2_authenticator' require 'gmail_xoauth/smtp_xoauth_authenticator' require 'gmail_xoauth/smtp_xoauth2_authenticator'
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth/oauth_string.rb
lib/gmail_xoauth/oauth_string.rb
module GmailXoauth module OauthString private # # Builds the "oauth protocol parameter string". See https://developers.google.com/google-apps/gmail/oauth_protocol#sasl_initial_client_request # # +request_url+ https://mail.google.com/mail/b/user_name@gmail.com/{imap|smtp}/ # +oauth_p...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth/version.rb
lib/gmail_xoauth/version.rb
module GmailXoauth VERSION = "0.4.3" end
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false
nfo/gmail_xoauth
https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth/imap_xoauth2_authenticator.rb
lib/gmail_xoauth/imap_xoauth2_authenticator.rb
require 'net/imap' module GmailXoauth class ImapXoauth2Authenticator def process(data) build_oauth2_string(@user, @oauth2_token) end private # +user+ is an email address: roger@gmail.com # +oauth2_token+ is the OAuth2 token def initialize(user, oauth2_token) @user = u...
ruby
Unlicense
51da2ac78863cdff232521479a21d5be64d1ed25
2026-01-04T17:34:35.817576Z
false