mlb 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e82207f5345873c47ef01b18d32ed5dc131a7a2a2531b5c5adf2ca87e2c5d397
4
- data.tar.gz: 597c40742c137216cc3210362b9a157dc28ef25cd5dacff689489821323cb804
3
+ metadata.gz: d6e28a22c9b934399e0edab2d391ef9dacc66209850caae9ad8e70a6bd524e1e
4
+ data.tar.gz: dd0f65a56582ec130bf1d46371fdf72cc4c48b6371af994632f0d663a6851c53
5
5
  SHA512:
6
- metadata.gz: c9e096ebd1e2a1d88d618507c8e3d15b540f06c146b29c3dff1abe2dbf581521858fbf1b6362ad251c241db89330f3d2c4d6fb94753d8236056b5ec2910bfb69
7
- data.tar.gz: e962f38e4fc333cafb5618ab1c5bdf66e53aed74b12a2e8be708877a2a8100af96410bfd8e196ce51ad4570490da98c4ade2eaefee845c9cf9230dacb2a7f5a2
6
+ metadata.gz: 7b57c8c9eda053930153f421a9447c4cd65f4fd7a55612d027faa9633a61783660a338d0468a752d2666b83223f23b2c9649c9a977e72354cb21c879000e2543
7
+ data.tar.gz: 5c866fb121cc4d6972e717b7466474d97d7dd044418d84a573b19f6f94ffd5b65569d66bf2a2eca4997c3b6bfc64f93cadefac7e6501cc659bb256d975ab5d83
data/CHANGELOG.md CHANGED
@@ -1,2 +1,5 @@
1
- ## [0.8.0] - 2024-05-02
1
+ ## [0.8.0] - 2024-05-22
2
+ * Rewrite to use MLB Stats API
3
+
4
+ ## [0.8.0] - 2024-05-06
2
5
  * Rewrite
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  [![Tests](https://github.com/sferik/mlb-ruby/actions/workflows/test.yml/badge.svg)](https://github.com/sferik/mlb-ruby/actions/workflows/test.yml)
2
- [![Linter](https://github.com/sferik/mlb-ruby/actions/workflows/lint.yml/badge.svg)](https://github.com/sferik/mlb-ruby/actions/workflows/lint.yml)
2
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/fc32f80cb778b773a5b2/test_coverage)](https://codeclimate.com/github/sferik/mlb-ruby/test_coverage)
3
3
  [![Mutant](https://github.com/sferik/mlb-ruby/actions/workflows/mutant.yml/badge.svg)](https://github.com/sferik/mlb-ruby/actions/workflows/mutant.yml)
4
- [![Typer Checker](https://github.com/sferik/mlb-ruby/actions/workflows/steep.yml/badge.svg)](https://github.com/sferik/mlb-ruby/actions/workflows/steep.yml)
4
+ [![Linter](https://github.com/sferik/mlb-ruby/actions/workflows/lint.yml/badge.svg)](https://github.com/sferik/mlb-ruby/actions/workflows/lint.yml)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/fc32f80cb778b773a5b2/maintainability)](https://codeclimate.com/github/sferik/mlb-ruby/maintainability)
5
6
  [![Gem Version](https://badge.fury.io/rb/mlb.svg)](https://rubygems.org/gems/mlb)
6
7
 
7
- # A [Ruby](https://www.ruby-lang.org) interface to the [MLB Data API](https://appac.github.io/mlb-data-api-docs/)
8
+ # A [Ruby](https://www.ruby-lang.org) interface to the [MLB Stats API](https://statsapi.mlb.com)
8
9
 
9
10
  ## Follow
10
11
 
11
- For updates and announcements, follow [@sferik](https://x.com/sferik) on X.
12
+ For updates and announcements, follow [@sferik](https://x.com/sferik).
12
13
 
13
14
  ## Installation
14
15
 
@@ -25,33 +26,34 @@ Or, if Bundler is not being used to manage dependencies:
25
26
  ```ruby
26
27
  require "mlb"
27
28
 
28
- dbacks = MLB::Team.all(season: 2024).first
29
- dbacks.name_display_full # => "Arizona Diamondbacks"
30
- dbacks.name_display_brief # => "D-backs"
31
- dbacks.name_abbrev # => "AZ"
32
- dbacks.city # => "Phoenix"
33
- dbacks.league_full # => "National League"
34
- dbacks.league_abbrev # => "NL"
35
- dbacks.spring_league_full # => "Cactus League"
36
- dbacks.spring_league_abbrev # => "CL"
37
- dbacks.division_full # => "National League West"
38
- dbacks.division_abbrev # => "NLW"
39
- dbacks.first_year_of_play # => "1996"
40
- dbacks.venue_name # => "Chase Field"
41
-
42
- blaze = dbacks.roster.first
43
- blaze.name_display_first_last # => "Blaze Alexander"
44
- blaze.jersey_number # => "9"
45
- blaze.primary_position # => "6"
46
- blaze.position_txt # => "SS"
47
- blaze.height_feet # => "5"
48
- blaze.height_inches # => "11"
49
- blaze.weight # => "160"
50
- blaze.bats # => "R"
51
- blaze.throws # => "R"
52
- blaze.birth_date # => "1999-06-11T00:00:00"
53
- blaze.start_date # => "2022-11-15T00:00:00"
54
- blaze.pro_debut_date # => "2024-03-28T00:00:00"
29
+ mets = MLB::Teams.all(season: 2024).last
30
+ mets.name # => "New York Mets"
31
+ mets.short_name # => "NY Mets"
32
+ mets.abbreviation # => "NYM"
33
+ mets.league.name # => "National League"
34
+ mets.spring_league.name # => "Grapefruit League"
35
+ mets.division.name # => "National League East"
36
+ mets.first_year_of_play # => 1962
37
+ mets.location_name # => "Flushing"
38
+ mets.venue.name # => "Citi Field"
39
+
40
+ adam = MLB::Players.all(season: 2024).find { |player| player.id == mets.roster.first.player.id }
41
+
42
+ adam.full_name # => "Adam Ottavino"
43
+ adam.primary_number # => 0
44
+ adam.primary_position.name # => "Pitcher"
45
+ adam.pitch_hand.description # => "Right"
46
+ adam.bat_side.description # => "Switch"
47
+ adam.current_age # => 38
48
+ adam.birth_date.to_s # => "1985-11-22"
49
+ adam.birth_city # => "New York"
50
+ adam.birth_state_province # => "NY"
51
+ adam.birth_country # => "USA"
52
+ adam.draft_year # => 2006
53
+ adam.mlb_debut_date.to_s # => "2010-05-29"
54
+ adam.height # => "6' 5\""
55
+ adam.weight # => 246
56
+ adam.active? # => true
55
57
  ```
56
58
 
57
59
  ## Sponsorship
@@ -112,10 +114,6 @@ Pull requests will only be accepted if they meet all the following criteria:
112
114
 
113
115
  bundle exec rake mutant
114
116
 
115
- 5. RBS type signatures (in `sig/mlb.rbs`). This can be verified with:
116
-
117
- bundle exec rake steep
118
-
119
117
  ## License
120
118
 
121
119
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/lib/mlb/client.rb CHANGED
@@ -2,17 +2,15 @@ require "forwardable"
2
2
  require_relative "connection"
3
3
  require_relative "redirect_handler"
4
4
  require_relative "request_builder"
5
- require_relative "response_parser"
5
+ require_relative "error_handler"
6
6
 
7
7
  module MLB
8
8
  class Client
9
9
  extend Forwardable
10
10
 
11
- DEFAULT_BASE_URL = "https://lookup-service-prod.mlb.com/json/".freeze
12
- DEFAULT_ARRAY_CLASS = Array
13
- DEFAULT_OBJECT_CLASS = Hash
11
+ DEFAULT_BASE_URL = "https://statsapi.mlb.com/api/v1/".freeze
14
12
 
15
- attr_accessor :base_url, :default_array_class, :default_object_class
13
+ attr_accessor :base_url
16
14
 
17
15
  def_delegators :@connection, :open_timeout, :read_timeout, :write_timeout, :proxy_url, :debug_output
18
16
  def_delegators :@connection, :open_timeout=, :read_timeout=, :write_timeout=, :proxy_url=, :debug_output=
@@ -25,47 +23,39 @@ module MLB
25
23
  write_timeout: Connection::DEFAULT_WRITE_TIMEOUT,
26
24
  debug_output: Connection::DEFAULT_DEBUG_OUTPUT,
27
25
  proxy_url: nil,
28
- default_array_class: DEFAULT_ARRAY_CLASS,
29
- default_object_class: DEFAULT_OBJECT_CLASS,
30
26
  max_redirects: RedirectHandler::DEFAULT_MAX_REDIRECTS)
31
27
 
32
28
  @base_url = base_url
33
- initialize_default_classes(default_array_class, default_object_class)
34
29
  @connection = Connection.new(open_timeout:, read_timeout:, write_timeout:, debug_output:, proxy_url:)
35
30
  @request_builder = RequestBuilder.new
36
31
  @redirect_handler = RedirectHandler.new(connection: @connection, request_builder: @request_builder, max_redirects:)
37
- @response_parser = ResponseParser.new
32
+ @error_handler = ErrorHandler.new
38
33
  end
39
34
 
40
- def get(endpoint, headers: {}, array_class: default_array_class, object_class: default_object_class)
41
- execute_request(:get, endpoint, headers:, array_class:, object_class:)
35
+ def get(endpoint, headers: {})
36
+ execute_request(:get, endpoint, headers:)
42
37
  end
43
38
 
44
- def post(endpoint, body = nil, headers: {}, array_class: default_array_class, object_class: default_object_class)
45
- execute_request(:post, endpoint, body:, headers:, array_class:, object_class:)
39
+ def post(endpoint, body = nil, headers: {})
40
+ execute_request(:post, endpoint, body:, headers:)
46
41
  end
47
42
 
48
- def put(endpoint, body = nil, headers: {}, array_class: default_array_class, object_class: default_object_class)
49
- execute_request(:put, endpoint, body:, headers:, array_class:, object_class:)
43
+ def put(endpoint, body = nil, headers: {})
44
+ execute_request(:put, endpoint, body:, headers:)
50
45
  end
51
46
 
52
- def delete(endpoint, headers: {}, array_class: default_array_class, object_class: default_object_class)
53
- execute_request(:delete, endpoint, headers:, array_class:, object_class:)
47
+ def delete(endpoint, headers: {})
48
+ execute_request(:delete, endpoint, headers:)
54
49
  end
55
50
 
56
51
  private
57
52
 
58
- def initialize_default_classes(default_array_class, default_object_class)
59
- @default_array_class = default_array_class
60
- @default_object_class = default_object_class
61
- end
62
-
63
- def execute_request(http_method, endpoint, body: nil, headers: {}, array_class: default_array_class, object_class: default_object_class)
53
+ def execute_request(http_method, endpoint, headers:, body: nil)
64
54
  uri = URI.join(base_url, endpoint)
65
55
  request = @request_builder.build(http_method:, uri:, body:, headers:)
66
56
  response = @connection.perform(request:)
67
57
  response = @redirect_handler.handle(response:, request:, base_url:)
68
- @response_parser.parse(response:, array_class:, object_class:)
58
+ @error_handler.handle(response:)
69
59
  end
70
60
  end
71
61
 
@@ -8,7 +8,7 @@ module MLB
8
8
  class Connection
9
9
  extend Forwardable
10
10
 
11
- DEFAULT_HOST = "lookup-service-prod.mlb.com".freeze
11
+ DEFAULT_HOST = "statsapi.mlb.com".freeze
12
12
  DEFAULT_PORT = 443
13
13
  DEFAULT_OPEN_TIMEOUT = 60 # seconds
14
14
  DEFAULT_READ_TIMEOUT = 60 # seconds
@@ -0,0 +1,42 @@
1
+ require "shale"
2
+ require_relative "league"
3
+ require_relative "sport"
4
+
5
+ module MLB
6
+ class Division < Shale::Mapper
7
+ include Comparable
8
+
9
+ attribute :id, Shale::Type::Integer
10
+ attribute :name, Shale::Type::String
11
+ attribute :season, Shale::Type::String
12
+ attribute :name_short, Shale::Type::String
13
+ attribute :link, Shale::Type::String
14
+ attribute :abbreviation, Shale::Type::String
15
+ attribute :league, League
16
+ attribute :sport, Sport
17
+ attribute :has_wildcard, Shale::Type::Boolean
18
+ attribute :sort_order, Shale::Type::Integer
19
+ attribute :active, Shale::Type::Boolean
20
+
21
+ alias_method :active?, :active
22
+ alias_method :wildcard?, :has_wildcard
23
+
24
+ json do
25
+ map "id", to: :id
26
+ map "name", to: :name
27
+ map "season", to: :season
28
+ map "nameShort", to: :name_short
29
+ map "link", to: :link
30
+ map "abbreviation", to: :abbreviation
31
+ map "league", to: :league
32
+ map "sport", to: :sport
33
+ map "hasWildcard", to: :has_wildcard
34
+ map "sortOrder", to: :sort_order
35
+ map "active", to: :active
36
+ end
37
+
38
+ def <=>(other)
39
+ sort_order <=> other.sort_order
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,30 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "sport"
4
+ require_relative "division"
5
+
6
+ module MLB
7
+ class Divisions < Shale::Mapper
8
+ attribute :copyright, Shale::Type::String
9
+ attribute :divisions, Division, collection: true
10
+
11
+ def self.all(sport: Sport.new(id: 1))
12
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
13
+ params = {sportId: sport_id}
14
+ query_string = URI.encode_www_form(params)
15
+ response = CLIENT.get("divisions?#{query_string}")
16
+ divisions = from_json(response)
17
+ divisions.divisions.sort!
18
+ end
19
+
20
+ def self.find(division, sport: Sport.new(id: 1))
21
+ id = division.respond_to?(:id) ? division.id : division
22
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
23
+ params = {sportId: sport_id}
24
+ query_string = URI.encode_www_form(params)
25
+ response = CLIENT.get("divisions/#{id}?#{query_string}")
26
+ divisions = from_json(response)
27
+ divisions.divisions.first
28
+ end
29
+ end
30
+ end
@@ -1,4 +1,3 @@
1
- require "json"
2
1
  require "net/http"
3
2
  require_relative "errors/bad_gateway"
4
3
  require_relative "errors/bad_request"
@@ -17,7 +16,7 @@ require_relative "errors/unauthorized"
17
16
  require_relative "errors/unprocessable_entity"
18
17
 
19
18
  module MLB
20
- class ResponseParser
19
+ class ErrorHandler
21
20
  ERROR_MAP = {
22
21
  400 => BadRequest,
23
22
  401 => Unauthorized,
@@ -34,14 +33,11 @@ module MLB
34
33
  503 => ServiceUnavailable,
35
34
  504 => GatewayTimeout
36
35
  }.freeze
37
- JSON_CONTENT_TYPE_REGEXP = %r{application/json}
38
36
 
39
- def parse(response:, array_class: nil, object_class: nil)
37
+ def handle(response:)
40
38
  raise error(response) unless response.is_a?(Net::HTTPSuccess)
41
39
 
42
- return unless json?(response)
43
-
44
- JSON.parse(response.body, array_class:, object_class:, symbolize_names: true)
40
+ response.body
45
41
  end
46
42
 
47
43
  private
@@ -53,9 +49,5 @@ module MLB
53
49
  def error_class(response)
54
50
  ERROR_MAP[Integer(response.code)] || HTTPError
55
51
  end
56
-
57
- def json?(response)
58
- JSON_CONTENT_TYPE_REGEXP.match?(response["content-type"])
59
- end
60
52
  end
61
53
  end
@@ -0,0 +1,13 @@
1
+ require "shale"
2
+
3
+ module MLB
4
+ class Handedness < Shale::Mapper
5
+ attribute :code, Shale::Type::String
6
+ attribute :description, Shale::Type::String
7
+
8
+ json do
9
+ map "code", to: :code
10
+ map "description", to: :description
11
+ end
12
+ end
13
+ end
data/lib/mlb/league.rb ADDED
@@ -0,0 +1,66 @@
1
+ require "shale"
2
+ require_relative "season_date_info"
3
+ require_relative "sport"
4
+
5
+ module MLB
6
+ class League < Shale::Mapper
7
+ include Comparable
8
+
9
+ attribute :id, Shale::Type::Integer
10
+ attribute :name, Shale::Type::String
11
+ attribute :link, Shale::Type::String
12
+ attribute :abbreviation, Shale::Type::String
13
+ attribute :name_short, Shale::Type::String
14
+ attribute :season_state, Shale::Type::String
15
+ attribute :has_wild_card, Shale::Type::Boolean
16
+ attribute :has_split_season, Shale::Type::Boolean
17
+ attribute :num_games, Shale::Type::Integer
18
+ attribute :has_playoff_points, Shale::Type::Boolean
19
+ attribute :num_teams, Shale::Type::Integer
20
+ attribute :num_wildcard_teams, Shale::Type::Integer
21
+ attribute :season_date_info, SeasonDateInfo
22
+ attribute :season, Shale::Type::Integer
23
+ attribute :org_code, Shale::Type::String
24
+ attribute :conferences_in_use, Shale::Type::Boolean
25
+ attribute :divisions_in_use, Shale::Type::Boolean
26
+ attribute :sport, Sport
27
+ attribute :sort_order, Shale::Type::Integer
28
+ attribute :active, Shale::Type::Boolean
29
+
30
+ alias_method :active?, :active
31
+ alias_method :wild_card?, :has_wild_card
32
+ alias_method :has_wildcard, :has_wild_card
33
+ alias_method :wildcard?, :has_wild_card
34
+ alias_method :split_season?, :has_split_season
35
+ alias_method :playoff_points?, :has_playoff_points
36
+ alias_method :conferences?, :conferences_in_use
37
+ alias_method :divisions?, :divisions_in_use
38
+
39
+ json do
40
+ map "id", to: :id
41
+ map "name", to: :name
42
+ map "link", to: :link
43
+ map "abbreviation", to: :abbreviation
44
+ map "nameShort", to: :name_short
45
+ map "seasonState", to: :season_state
46
+ map "hasWildCard", to: :has_wild_card
47
+ map "hasSplitSeason", to: :has_split_season
48
+ map "numGames", to: :num_games
49
+ map "hasPlayoffPoints", to: :has_playoff_points
50
+ map "numTeams", to: :num_teams
51
+ map "numWildcardTeams", to: :num_wildcard_teams
52
+ map "seasonDateInfo", to: :season_date_info
53
+ map "season", to: :season
54
+ map "orgCode", to: :org_code
55
+ map "conferencesInUse", to: :conferences_in_use
56
+ map "divisionsInUse", to: :divisions_in_use
57
+ map "sport", to: :sport
58
+ map "sortOrder", to: :sort_order
59
+ map "active", to: :active
60
+ end
61
+
62
+ def <=>(other)
63
+ sort_order <=> other.sort_order
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,30 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "sport"
4
+ require_relative "league"
5
+
6
+ module MLB
7
+ class Leagues < Shale::Mapper
8
+ attribute :copyright, Shale::Type::String
9
+ attribute :leagues, League, collection: true
10
+
11
+ def self.all(sport: Sport.new(id: 1))
12
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
13
+ params = {sportId: sport_id}
14
+ query_string = URI.encode_www_form(params)
15
+ response = CLIENT.get("leagues?#{query_string}")
16
+ leagues = from_json(response)
17
+ leagues.leagues.sort!
18
+ end
19
+
20
+ def self.find(league, sport: Sport.new(id: 1))
21
+ id = league.respond_to?(:id) ? league.id : league
22
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
23
+ params = {sportId: sport_id}
24
+ query_string = URI.encode_www_form(params)
25
+ response = CLIENT.get("leagues/#{id}?#{query_string}")
26
+ leagues = from_json(response)
27
+ leagues.leagues.first
28
+ end
29
+ end
30
+ end
data/lib/mlb/player.rb CHANGED
@@ -1,21 +1,68 @@
1
+ require "shale"
2
+ require_relative "position"
3
+ require_relative "handedness"
4
+ require_relative "team"
5
+
1
6
  module MLB
2
- Player = Struct.new(:bats, :birth_date, :college, :end_date, :height_feet,
3
- :height_inches, :jersey_number, :name_display_first_last,
4
- :name_display_last_first, :name_first, :name_full, :name_last, :name_use,
5
- :player_id, :position_txt, :primary_position, :pro_debut_date, :start_date,
6
- :starter_sw, :status_code, :team_abbrev, :team_code, :team_id, :team_name,
7
- :throws, :weight, keyword_init: true) do
8
- def team
9
- require_relative "team"
10
- sport_code = "'mlb'"
11
- season = Time.now.year
12
- all_star_sw = "'N'"
13
- params = {sport_code:, season:, all_star_sw:}
14
- query_string = URI.encode_www_form(params)
15
- response = CLIENT.get("named.team_all_season.bam?#{query_string}")
16
- teams = response[:team_all_season][:queryResults][:row]
17
- team = teams.find { |t| t[:team_id] == team_id.to_s }
18
- Team.new(**team)
7
+ class Player < Shale::Mapper
8
+ attribute :id, Shale::Type::Integer
9
+ attribute :full_name, Shale::Type::String
10
+ attribute :link, Shale::Type::String
11
+ attribute :first_name, Shale::Type::String
12
+ attribute :last_name, Shale::Type::String
13
+ attribute :primary_number, Shale::Type::Integer
14
+ attribute :birth_date, Shale::Type::Date
15
+ attribute :current_age, Shale::Type::Integer
16
+ attribute :birth_city, Shale::Type::String
17
+ attribute :birth_state_province, Shale::Type::String
18
+ attribute :birth_country, Shale::Type::String
19
+ attribute :height, Shale::Type::String
20
+ attribute :weight, Shale::Type::Integer
21
+ attribute :active, Shale::Type::Boolean
22
+ attribute :current_team, Team
23
+ attribute :primary_position, Position
24
+ attribute :use_name, Shale::Type::String
25
+ attribute :middle_name, Shale::Type::String
26
+ attribute :boxscore_name, Shale::Type::String
27
+ attribute :gender, Shale::Type::String
28
+ attribute :is_player, Shale::Type::Boolean
29
+ attribute :is_verified, Shale::Type::Boolean
30
+ attribute :draft_year, Shale::Type::Integer
31
+ attribute :mlb_debut_date, Shale::Type::Date
32
+ attribute :bat_side, Handedness
33
+ attribute :pitch_hand, Handedness
34
+
35
+ alias_method :verified?, :is_verified
36
+ alias_method :player?, :is_player
37
+ alias_method :active?, :active
38
+
39
+ json do
40
+ map "id", to: :id
41
+ map "fullName", to: :full_name
42
+ map "link", to: :link
43
+ map "firstName", to: :first_name
44
+ map "lastName", to: :last_name
45
+ map "primaryNumber", to: :primary_number
46
+ map "birthDate", to: :birth_date
47
+ map "currentAge", to: :current_age
48
+ map "birthCity", to: :birth_city
49
+ map "birthStateProvince", to: :birth_state_province
50
+ map "birthCountry", to: :birth_country
51
+ map "height", to: :height
52
+ map "weight", to: :weight
53
+ map "active", to: :active
54
+ map "currentTeam", to: :current_team
55
+ map "primaryPosition", to: :primary_position
56
+ map "useName", to: :use_name
57
+ map "middleName", to: :middle_name
58
+ map "boxscoreName", to: :boxscore_name
59
+ map "gender", to: :gender
60
+ map "isPlayer", to: :is_player
61
+ map "isVerified", to: :is_verified
62
+ map "draftYear", to: :draft_year
63
+ map "mlbDebutDate", to: :mlb_debut_date
64
+ map "batSide", to: :bat_side
65
+ map "pitchHand", to: :pitch_hand
19
66
  end
20
67
  end
21
68
  end
@@ -0,0 +1,25 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "sport"
4
+ require_relative "player"
5
+
6
+ module MLB
7
+ class Players < Shale::Mapper
8
+ attribute :copyright, Shale::Type::String
9
+ attribute :players, Player, collection: true
10
+
11
+ json do
12
+ map "copyright", to: :copyright
13
+ map "people", to: :players
14
+ end
15
+
16
+ def self.all(season: Time.now.year, sport: Sport.new(id: 1))
17
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
18
+ params = {season:}
19
+ query_string = URI.encode_www_form(params)
20
+ response = CLIENT.get("sports/#{sport_id}/players?#{query_string}")
21
+ players = from_json(response)
22
+ players.players
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ require "shale"
2
+
3
+ module MLB
4
+ class Position < Shale::Mapper
5
+ attribute :code, Shale::Type::String
6
+ attribute :name, Shale::Type::String
7
+ attribute :type, Shale::Type::String
8
+ attribute :abbreviation, Shale::Type::String
9
+
10
+ json do
11
+ map "code", to: :code
12
+ map "name", to: :name
13
+ map "type", to: :type
14
+ map "abbreviation", to: :abbreviation
15
+ end
16
+ end
17
+ end
data/lib/mlb/roster.rb ADDED
@@ -0,0 +1,22 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "roster_entry"
4
+ require_relative "sport"
5
+ require_relative "team"
6
+
7
+ module MLB
8
+ class Roster < Shale::Mapper
9
+ attribute :copyright, Shale::Type::String
10
+ attribute :roster, RosterEntry, collection: true
11
+
12
+ def self.find(team:, season: Time.now.year, sport: Sport.new(id: 1))
13
+ team_id = team.respond_to?(:id) ? team.id : team
14
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
15
+ params = {season:, sportId: sport_id}
16
+ query_string = URI.encode_www_form(params)
17
+ response = CLIENT.get("teams/#{team_id}/roster?#{query_string}")
18
+ roster = from_json(response)
19
+ roster.roster
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require "shale"
2
+ require_relative "player"
3
+ require_relative "position"
4
+ require_relative "status"
5
+
6
+ module MLB
7
+ class RosterEntry < Shale::Mapper
8
+ attribute :player, Player
9
+ attribute :jersey_number, Shale::Type::Integer
10
+ attribute :position, Position
11
+ attribute :status, Status
12
+ attribute :team_id, Shale::Type::Integer
13
+
14
+ json do
15
+ map "person", to: :player
16
+ map "jerseyNumber", to: :jersey_number
17
+ map "position", to: :position
18
+ map "status", to: :status
19
+ map "parentTeamId", to: :team_id
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,49 @@
1
+ require "shale"
2
+
3
+ module MLB
4
+ class SeasonDateInfo < Shale::Mapper
5
+ attribute :season_id, Shale::Type::String
6
+ attribute :pre_season_start_date, Shale::Type::Date
7
+ attribute :pre_season_end_date, Shale::Type::Date
8
+ attribute :season_start_date, Shale::Type::Date
9
+ attribute :spring_start_date, Shale::Type::Date
10
+ attribute :spring_end_date, Shale::Type::Date
11
+ attribute :regular_season_start_date, Shale::Type::Date
12
+ attribute :last_date_1st_half, Shale::Type::Date
13
+ attribute :all_star_date, Shale::Type::Date
14
+ attribute :first_date_2nd_half, Shale::Type::Date
15
+ attribute :regular_season_end_date, Shale::Type::Date
16
+ attribute :post_season_start_date, Shale::Type::Date
17
+ attribute :post_season_end_date, Shale::Type::Date
18
+ attribute :season_end_date, Shale::Type::Date
19
+ attribute :offseason_start_date, Shale::Type::Date
20
+ attribute :off_season_end_date, Shale::Type::Date
21
+ attribute :season_level_gameday_type, Shale::Type::String
22
+ attribute :game_level_gameday_type, Shale::Type::String
23
+ attribute :qualifier_plate_appearances, Shale::Type::Float
24
+ attribute :qualifier_outs_pitched, Shale::Type::Float
25
+
26
+ json do
27
+ map "seasonId", to: :season_id
28
+ map "preSeasonStartDate", to: :pre_season_start_date
29
+ map "preSeasonEndDate", to: :pre_season_end_date
30
+ map "seasonStartDate", to: :season_start_date
31
+ map "springStartDate", to: :spring_start_date
32
+ map "springEndDate", to: :spring_end_date
33
+ map "regularSeasonStartDate", to: :regular_season_start_date
34
+ map "lastDate1stHalf", to: :last_date_1st_half
35
+ map "allStarDate", to: :all_star_date
36
+ map "firstDate2ndHalf", to: :first_date_2nd_half
37
+ map "regularSeasonEndDate", to: :regular_season_end_date
38
+ map "postSeasonStartDate", to: :post_season_start_date
39
+ map "postSeasonEndDate", to: :post_season_end_date
40
+ map "seasonEndDate", to: :season_end_date
41
+ map "offseasonStartDate", to: :offseason_start_date
42
+ map "offSeasonEndDate", to: :off_season_end_date
43
+ map "seasonLevelGamedayType", to: :season_level_gameday_type
44
+ map "gameLevelGamedayType", to: :game_level_gameday_type
45
+ map "qualifierPlateAppearances", to: :qualifier_plate_appearances
46
+ map "qualifierOutsPitched", to: :qualifier_outs_pitched
47
+ end
48
+ end
49
+ end
data/lib/mlb/sport.rb ADDED
@@ -0,0 +1,31 @@
1
+ require "shale"
2
+
3
+ module MLB
4
+ class Sport < Shale::Mapper
5
+ include Comparable
6
+
7
+ attribute :id, Shale::Type::Integer
8
+ attribute :code, Shale::Type::String
9
+ attribute :link, Shale::Type::String
10
+ attribute :name, Shale::Type::String
11
+ attribute :abbreviation, Shale::Type::String
12
+ attribute :sort_order, Shale::Type::Integer
13
+ attribute :active, Shale::Type::Boolean
14
+
15
+ alias_method :active?, :active
16
+
17
+ json do
18
+ map "id", to: :id
19
+ map "code", to: :code
20
+ map "link", to: :link
21
+ map "name", to: :name
22
+ map "abbreviation", to: :abbreviation
23
+ map "sortOrder", to: :sort_order
24
+ map "activeStatus", to: :active
25
+ end
26
+
27
+ def <=>(other)
28
+ sort_order <=> other.sort_order
29
+ end
30
+ end
31
+ end
data/lib/mlb/sports.rb ADDED
@@ -0,0 +1,22 @@
1
+ require "shale"
2
+ require_relative "sport"
3
+
4
+ module MLB
5
+ class Sports < Shale::Mapper
6
+ attribute :copyright, Shale::Type::String
7
+ attribute :sports, Sport, collection: true
8
+
9
+ def self.all
10
+ response = CLIENT.get("sports")
11
+ sports = from_json(response)
12
+ sports.sports.sort!
13
+ end
14
+
15
+ def self.find(sport)
16
+ id = sport.respond_to?(:id) ? sport.id : sport
17
+ response = CLIENT.get("sports/#{id}")
18
+ sports = from_json(response)
19
+ sports.sports.first
20
+ end
21
+ end
22
+ end
data/lib/mlb/status.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "shale"
2
+
3
+ module MLB
4
+ class Status < Shale::Mapper
5
+ attribute :code, Shale::Type::String
6
+ attribute :description, Shale::Type::String
7
+ end
8
+ end
data/lib/mlb/team.rb CHANGED
@@ -1,38 +1,65 @@
1
- require "uri"
1
+ require "shale"
2
+ require_relative "division"
3
+ require_relative "league"
4
+ require_relative "sport"
5
+ require_relative "venue"
2
6
 
3
7
  module MLB
4
- Team = Struct.new(:active_sw, :address, :address_city,
5
- :address_country, :address_intl, :address_line1, :address_line2,
6
- :address_line3, :address_province, :address_state, :address_zip, :all_star_sw,
7
- :base_url, :bis_team_code, :city, :division, :division_abbrev, :division_full,
8
- :division_id, :file_code, :first_year_of_play, :franchise_code, :home_opener,
9
- :home_opener_time, :last_year_of_play, :league, :league_abbrev, :league_full,
10
- :league_id, :mlb_org, :mlb_org_abbrev, :mlb_org_brief, :mlb_org_id,
11
- :mlb_org_short, :name, :name_abbrev, :name_display_brief, :name_display_full,
12
- :name_display_long, :name_display_short, :name_short, :phone_number, :season,
13
- :sport_code, :sport_code_display, :sport_code_name, :sport_id, :spring_league,
14
- :spring_league_abbrev, :spring_league_full, :spring_league_id, :state,
15
- :store_url, :team_code, :team_id, :time_zone, :time_zone_alt,
16
- :time_zone_generic, :time_zone_num, :time_zone_text, :venue_id, :venue_name,
17
- :venue_short, :website_url, keyword_init: true) do
18
- def self.all(season: Time.now.year, sort_order: "name_asc", all_star: false)
19
- sport_code = "'mlb'"
20
- season = "'#{season}'"
21
- all_star_sw = all_star ? "'Y'" : "'N'"
22
- params = {sport_code:, season:, sort_order:, all_star_sw:}
23
- query_string = URI.encode_www_form(params)
24
- response = CLIENT.get("named.team_all_season.bam?#{query_string}")
25
- teams = response[:team_all_season][:queryResults][:row]
26
- teams.collect { |team| Team.new(**team) }
8
+ class Team < Shale::Mapper
9
+ attribute :spring_league, League
10
+ attribute :all_star_status, Shale::Type::String
11
+ attribute :id, Shale::Type::Integer
12
+ attribute :name, Shale::Type::String
13
+ attribute :link, Shale::Type::String
14
+ attribute :season, Shale::Type::Integer
15
+ attribute :venue, Venue
16
+ attribute :spring_venue, Venue
17
+ attribute :team_code, Shale::Type::String
18
+ attribute :file_code, Shale::Type::String
19
+ attribute :abbreviation, Shale::Type::String
20
+ attribute :team_name, Shale::Type::String
21
+ attribute :location_name, Shale::Type::String
22
+ attribute :first_year_of_play, Shale::Type::Integer
23
+ attribute :league, League
24
+ attribute :division, Division
25
+ attribute :sport, Sport
26
+ attribute :short_name, Shale::Type::String
27
+ attribute :franchise_name, Shale::Type::String
28
+ attribute :club_name, Shale::Type::String
29
+ attribute :active, Shale::Type::Boolean
30
+
31
+ alias_method :active?, :active
32
+
33
+ json do
34
+ map "springLeague", to: :spring_league
35
+ map "allStarStatus", to: :all_star_status
36
+ map "id", to: :id
37
+ map "name", to: :name
38
+ map "link", to: :link
39
+ map "season", to: :season
40
+ map "venue", to: :venue
41
+ map "springVenue", to: :spring_venue
42
+ map "teamCode", to: :team_code
43
+ map "fileCode", to: :file_code
44
+ map "abbreviation", to: :abbreviation
45
+ map "teamName", to: :team_name
46
+ map "locationName", to: :location_name
47
+ map "firstYearOfPlay", to: :first_year_of_play
48
+ map "league", to: :league
49
+ map "division", to: :division
50
+ map "sport", to: :sport
51
+ map "shortName", to: :short_name
52
+ map "franchiseName", to: :franchise_name
53
+ map "clubName", to: :club_name
54
+ map "active", to: :active
27
55
  end
28
56
 
29
- def roster
30
- require_relative "player"
31
- params = {team_id:}
57
+ def roster(season: Time.now.year)
58
+ params = {season:}
32
59
  query_string = URI.encode_www_form(params)
33
- response = CLIENT.get("named.roster_40.bam?#{query_string}")
34
- players = response[:roster_40][:queryResults][:row]
35
- players.collect { |player| Player.new(**player) }
60
+ response = CLIENT.get("teams/#{id}/roster?#{query_string}")
61
+ roster = Roster.from_json(response)
62
+ roster.roster
36
63
  end
37
64
  end
38
65
  end
data/lib/mlb/teams.rb ADDED
@@ -0,0 +1,30 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "sport"
4
+ require_relative "team"
5
+
6
+ module MLB
7
+ class Teams < Shale::Mapper
8
+ attribute :copyright, Shale::Type::String
9
+ attribute :teams, Team, collection: true
10
+
11
+ def self.all(season: Time.now.year, sport: Sport.new(id: 1))
12
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
13
+ params = {sportId: sport_id, season:}
14
+ query_string = URI.encode_www_form(params)
15
+ response = CLIENT.get("teams?#{query_string}")
16
+ teams = from_json(response)
17
+ teams.teams
18
+ end
19
+
20
+ def self.find(team, season: Time.now.year, sport: Sport.new(id: 1))
21
+ id = team.respond_to?(:id) ? team.id : team
22
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
23
+ params = {sportId: sport_id, season:}
24
+ query_string = URI.encode_www_form(params)
25
+ response = CLIENT.get("teams/#{id}?#{query_string}")
26
+ teams = from_json(response)
27
+ teams.teams.first
28
+ end
29
+ end
30
+ end
@@ -1,37 +1,31 @@
1
- require "date"
2
- require "uri"
1
+ require "shale"
2
+ require_relative "player"
3
+ require_relative "team"
3
4
 
4
5
  module MLB
5
- Transaction = Struct.new(:conditional_sw, :effective_date, :final_asset,
6
- :final_asset_type, :from_team, :from_team_id, :name_display_first_last,
7
- :name_display_last_first, :name_sort, :note, :orig_asset, :orig_asset_type,
8
- :player, :player_id, :resolution_cd, :resolution_date, :team, :team_id,
9
- :trans_date, :trans_date_cd, :transaction_id, :type, :type_cd, keyword_init: true) do
10
- def self.all(start_date: Date.today, end_date: Date.today)
11
- sport_code = "'mlb'"
12
- start_date = Date.parse(start_date.to_s).strftime("%Y%m%d")
13
- end_date = Date.parse(end_date.to_s).strftime("%Y%m%d")
14
- params = {sport_code:, start_date:, end_date:}
15
- query_string = URI.encode_www_form(params)
16
- response = CLIENT.get("named.transaction_all.bam?#{query_string}")
17
- transactions = response.fetch(:transaction_all, {}).fetch(:queryResults, {}).fetch(:row, [])
18
- transactions.collect { |transaction| Transaction.new(**transaction) }
19
- end
20
-
21
- def team
22
- require_relative "team"
23
- teams = effective_date.to_s.empty? ? Team.all : Team.all(season: effective_date.to_s[0...4].to_i)
24
- teams.find { |t| t[:team_id] == team_id.to_s }
25
- end
6
+ class Transaction < Shale::Mapper
7
+ attribute :id, Shale::Type::Integer
8
+ attribute :player, Player
9
+ attribute :from_team, Team, default: nil
10
+ attribute :to_team, Team
11
+ attribute :date, Shale::Type::Date
12
+ attribute :effective_date, Shale::Type::Date
13
+ attribute :resolution_date, Shale::Type::Date
14
+ attribute :type_code, Shale::Type::String
15
+ attribute :type_desc, Shale::Type::String
16
+ attribute :description, Shale::Type::String
26
17
 
27
- def player
28
- params = {team_id:}
29
- query_string = URI.encode_www_form(params)
30
- response = CLIENT.get("named.roster_40.bam?#{query_string}")
31
- players = response[:roster_40][:queryResults][:row]
32
- player = players.find { |p| p[:player_id] == player_id.to_s }
33
- require_relative "player"
34
- Player.new(**player)
18
+ json do
19
+ map "id", to: :id
20
+ map "person", to: :player
21
+ map "fromTeam", to: :from_team
22
+ map "toTeam", to: :to_team
23
+ map "date", to: :date
24
+ map "effectiveDate", to: :effective_date
25
+ map "resolutionDate", to: :resolution_date
26
+ map "typeCode", to: :type_code
27
+ map "typeDesc", to: :type_desc
28
+ map "description", to: :description
35
29
  end
36
30
  end
37
31
  end
@@ -0,0 +1,18 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "transaction"
4
+
5
+ module MLB
6
+ class Transactions < Shale::Mapper
7
+ attribute :copyright, Shale::Type::String
8
+ attribute :transactions, Transaction, collection: true
9
+
10
+ def self.between(start_date: Date.today, end_date: start_date)
11
+ params = {startDate: start_date, endDate: end_date}
12
+ query_string = URI.encode_www_form(params)
13
+ response = CLIENT.get("transactions?#{query_string}")
14
+ transactions = from_json(response)
15
+ transactions.transactions
16
+ end
17
+ end
18
+ end
data/lib/mlb/venue.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "shale"
2
+
3
+ module MLB
4
+ class Venue < Shale::Mapper
5
+ attribute :id, Shale::Type::Integer
6
+ attribute :name, Shale::Type::String
7
+ attribute :link, Shale::Type::String
8
+ attribute :active, Shale::Type::Boolean
9
+ attribute :season, Shale::Type::Integer
10
+
11
+ alias_method :active?, :active
12
+ end
13
+ end
data/lib/mlb/venues.rb ADDED
@@ -0,0 +1,30 @@
1
+ require "shale"
2
+ require "uri"
3
+ require_relative "sport"
4
+ require_relative "venue"
5
+
6
+ module MLB
7
+ class Venues < Shale::Mapper
8
+ attribute :copyright, Shale::Type::String
9
+ attribute :venues, Venue, collection: true
10
+
11
+ def self.all(season: Time.now.year, sport: Sport.new(id: 1))
12
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
13
+ params = {sportId: sport_id, season:}
14
+ query_string = URI.encode_www_form(params)
15
+ response = CLIENT.get("venues?#{query_string}")
16
+ venues = from_json(response)
17
+ venues.venues
18
+ end
19
+
20
+ def self.find(venue, season: Time.now.year, sport: Sport.new(id: 1))
21
+ id = venue.respond_to?(:id) ? venue.id : venue
22
+ sport_id = sport.respond_to?(:id) ? sport.id : sport
23
+ params = {sportId: sport_id, season:}
24
+ query_string = URI.encode_www_form(params)
25
+ response = CLIENT.get("venues/#{id}?#{query_string}")
26
+ venues = from_json(response)
27
+ venues.venues.first
28
+ end
29
+ end
30
+ end
data/lib/mlb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "rubygems/version"
2
2
 
3
3
  module MLB
4
- VERSION = Gem::Version.create("0.8.0")
4
+ VERSION = Gem::Version.create("0.9.0")
5
5
  end
data/lib/mlb.rb CHANGED
@@ -1,3 +1,9 @@
1
1
  require_relative "mlb/client"
2
- require_relative "mlb/team"
3
- require_relative "mlb/transaction"
2
+ require_relative "mlb/divisions"
3
+ require_relative "mlb/leagues"
4
+ require_relative "mlb/players"
5
+ require_relative "mlb/roster"
6
+ require_relative "mlb/sports"
7
+ require_relative "mlb/teams"
8
+ require_relative "mlb/transactions"
9
+ require_relative "mlb/venues"
data/sig/mlb.rbs CHANGED
@@ -127,11 +127,11 @@ module MLB
127
127
  def send_new_request: (URI::Generic new_uri, Net::HTTPRequest new_request) -> Net::HTTPResponse
128
128
  end
129
129
 
130
- class ResponseParser
130
+ class ErrorHandler
131
131
  ERROR_MAP: Hash[Integer, singleton(BadGateway) | singleton(BadRequest) | singleton(ConnectionException) | singleton(Forbidden) | singleton(GatewayTimeout) | singleton(Gone) | singleton(InternalServerError) | singleton(NotAcceptable) | singleton(NotFound) | singleton(PayloadTooLarge) | singleton(ServiceUnavailable) | singleton(TooManyRequests) | singleton(Unauthorized) | singleton(UnprocessableEntity)]
132
132
  JSON_CONTENT_TYPE_REGEXP: Regexp
133
133
 
134
- def parse: (response: Net::HTTPResponse, ?array_class: Class?, ?object_class: Class?) -> untyped
134
+ def parse: (response: Net::HTTPResponse) -> untyped
135
135
 
136
136
  private
137
137
  def error: (Net::HTTPResponse response) -> HTTPError
@@ -141,26 +141,21 @@ module MLB
141
141
 
142
142
  class Client
143
143
  DEFAULT_BASE_URL: String
144
- DEFAULT_ARRAY_CLASS: singleton(Array)
145
- DEFAULT_OBJECT_CLASS: singleton(Hash)
146
144
  extend Forwardable
147
145
  @connection: Connection
148
146
  @request_builder: RequestBuilder
149
147
  @redirect_handler: RedirectHandler
150
- @response_parser: ResponseParser
148
+ @error_handler: ErrorHandler
151
149
 
152
150
  attr_accessor base_url: String
153
- attr_accessor default_array_class: singleton(Array)
154
- attr_accessor default_object_class: singleton(Hash)
155
- def initialize: (?base_url: String, ?open_timeout: Integer, ?read_timeout: Integer, ?write_timeout: Integer, ?debug_output: untyped, ?proxy_url: nil, ?default_array_class: singleton(Array), ?default_object_class: singleton(Hash), ?max_redirects: Integer) -> void
156
- def get: (String endpoint, ?headers: Hash[String, String], ?array_class: Class, ?object_class: Class) -> untyped
157
- def post: (String endpoint, ?String? body, ?headers: Hash[String, String], ?array_class: Class, ?object_class: Class) -> untyped
158
- def put: (String endpoint, ?String? body, ?headers: Hash[String, String], ?array_class: Class, ?object_class: Class) -> untyped
159
- def delete: (String endpoint, ?headers: Hash[String, String], ?array_class: Class, ?object_class: Class) -> untyped
151
+ def initialize: (?base_url: String, ?open_timeout: Integer, ?read_timeout: Integer, ?write_timeout: Integer, ?debug_output: untyped, ?proxy_url: nil, ?max_redirects: Integer) -> void
152
+ def get: (String endpoint, ?headers: Hash[String, String]) -> untyped
153
+ def post: (String endpoint, ?String? body, ?headers: Hash[String, String]) -> untyped
154
+ def put: (String endpoint, ?String? body, ?headers: Hash[String, String]) -> untyped
155
+ def delete: (String endpoint, ?headers: Hash[String, String]) -> untyped
160
156
 
161
157
  private
162
- def initialize_default_classes: (singleton(Array) default_array_class, singleton(Hash) default_object_class) -> singleton(Hash)
163
- def execute_request: (:delete | :get | :post | :put http_method, String endpoint, ?body: String?, ?headers: Hash[String, String], ?array_class: Class, ?object_class: Class) -> nil
158
+ def execute_request: (:delete | :get | :post | :put http_method, String endpoint, ?body: String?, ?headers: Hash[String, String]) -> nil
164
159
  end
165
160
 
166
161
  attr_accessor effective_date: String
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Berlin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-06 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2024-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shale
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
13
27
  description:
14
28
  email: sferik@gmail.com
15
29
  executables: []
@@ -24,6 +38,9 @@ files:
24
38
  - lib/mlb.rb
25
39
  - lib/mlb/client.rb
26
40
  - lib/mlb/connection.rb
41
+ - lib/mlb/division.rb
42
+ - lib/mlb/divisions.rb
43
+ - lib/mlb/error_handler.rb
27
44
  - lib/mlb/errors/bad_gateway.rb
28
45
  - lib/mlb/errors/bad_request.rb
29
46
  - lib/mlb/errors/client_error.rb
@@ -44,12 +61,26 @@ files:
44
61
  - lib/mlb/errors/too_many_requests.rb
45
62
  - lib/mlb/errors/unauthorized.rb
46
63
  - lib/mlb/errors/unprocessable_entity.rb
64
+ - lib/mlb/handedness.rb
65
+ - lib/mlb/league.rb
66
+ - lib/mlb/leagues.rb
47
67
  - lib/mlb/player.rb
68
+ - lib/mlb/players.rb
69
+ - lib/mlb/position.rb
48
70
  - lib/mlb/redirect_handler.rb
49
71
  - lib/mlb/request_builder.rb
50
- - lib/mlb/response_parser.rb
72
+ - lib/mlb/roster.rb
73
+ - lib/mlb/roster_entry.rb
74
+ - lib/mlb/season_date_info.rb
75
+ - lib/mlb/sport.rb
76
+ - lib/mlb/sports.rb
77
+ - lib/mlb/status.rb
51
78
  - lib/mlb/team.rb
79
+ - lib/mlb/teams.rb
52
80
  - lib/mlb/transaction.rb
81
+ - lib/mlb/transactions.rb
82
+ - lib/mlb/venue.rb
83
+ - lib/mlb/venues.rb
53
84
  - lib/mlb/version.rb
54
85
  - sig/mlb.rbs
55
86
  homepage: https://sferik.github.io/mlb-ruby
@@ -78,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
109
  - !ruby/object:Gem::Version
79
110
  version: '0'
80
111
  requirements: []
81
- rubygems_version: 3.5.9
112
+ rubygems_version: 3.5.10
82
113
  signing_key:
83
114
  specification_version: 4
84
- summary: A Ruby interface to the MLB Data API.
115
+ summary: A Ruby interface to the MLB Stats API.
85
116
  test_files: []