mlb_stats_api 0.2.5 → 0.4.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: 8f1785568e2c7c97a04981d1f64b33aed72ea46788219c9c1adf6240532bfe7b
4
- data.tar.gz: 5357dde99f31c0cf5decad6147a8bac2cb5ff3e48570bfdc0b8a2d550bea3077
3
+ metadata.gz: 9e9bba45d360b519bccd1b22745067ffda8245672a11ec43a1320e11da22fb71
4
+ data.tar.gz: a4dabc6bccc1a4ed6751c7e6e29a0444814196abfc7208cf61e0109e9d542f61
5
5
  SHA512:
6
- metadata.gz: 3435b50ac963edf95ea2958d305efb266c7ca42352e2bd1443af6c7eda12ade4ed328fcab39b7f50f943613cfe2f51f1fb5fd0a3237eca9f126cf8dcd152bd94
7
- data.tar.gz: 5694e37addf8422ee99a180868b5bb66a1279056dd7fd078a6ffbc798d79ffe80c1585b9b34a3fa5639e68c06a8e564975ee0ba42db133dde5c548ca3e5c6a76
6
+ metadata.gz: 95614ebb018b8fa5c747cf68c250775a0daa87047505e36b8acb1f0f9347c942f71c33901edd2cd960e9c63845d24b77e8afc8378e849d8f4167f69b43ea6d5a
7
+ data.tar.gz: 8481c2e4fc37c84db1a25f7708e14be896a66c1f6507165e9869d52d89d9cf2528590c46c89ba9f089963503559de6f28bf2449ad3b94627be35255244ec30fe
@@ -0,0 +1,30 @@
1
+ name: RSpec
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu]
15
+ ruby: [3.1]
16
+
17
+ runs-on: ${{ matrix.os }}-latest
18
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically:
27
+ - name: Install dependencies
28
+ run: bundle install
29
+ - name: Run tests
30
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,9 +1,74 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.5
2
+ EnabledByDefault: true
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ # ----------------------------------------------------------------------------------------------------------------------
7
+ # Coding Style
8
+ # ----------------------------------------------------------------------------------------------------------------------
3
9
 
4
10
  Layout/MultilineMethodCallIndentation:
5
11
  EnforcedStyle: indented
6
12
 
7
- Metrics/BlockLength:
8
- Exclude:
9
- - 'spec/**/*'
13
+ # ----------------------------------------------------------------------------------------------------------------------
14
+ # Cops that should not be run
15
+ # ----------------------------------------------------------------------------------------------------------------------
16
+
17
+ # Recommends each array item be on its own line.
18
+ Layout/MultilineArrayLineBreaks:
19
+ Enabled: false
20
+
21
+ # Recommends right hand side of multi-line assignment be on a new line
22
+ Layout/MultilineAssignmentLayout:
23
+ Enabled: false
24
+
25
+ # Wants every argument in a multi-line method call to be on its own line
26
+ Layout/MultilineMethodArgumentLineBreaks:
27
+ Enabled: false
28
+
29
+ # Recommends squishing a multi-line hash into one line. I don't like that. It's not readable.
30
+ Layout/RedundantLineBreak:
31
+ Enabled: false
32
+
33
+ # Recommends `::File` instead of `File`
34
+ Lint/ConstantResolution:
35
+ Enabled: false
36
+
37
+ # Converts if-elsif to case-when.
38
+ Style/CaseLikeIf:
39
+ Enabled: false
40
+
41
+ # Wants every constant to be listed in #public_constant or #private_constant
42
+ Style/ConstantVisibility:
43
+ Enabled: false
44
+
45
+ Style/Copyright:
46
+ Enabled: false
47
+
48
+ # Every class and module *should* be documented, but I don't have the time
49
+ Style/Documentation:
50
+ Enabled: false
51
+
52
+ # Every method *should* be documented, but I don't have the time
53
+ Style/DocumentationMethod:
54
+ Enabled: false
55
+
56
+ # Converts [1, 2, three: 3] to [1, 2, { three: 3 }]
57
+ Style/HashAsLastArrayItem:
58
+ Enabled: false
59
+
60
+ # Converts `a_method 1` to `a_method(1)`
61
+ Style/MethodCallWithArgsParentheses:
62
+ Enabled: false
63
+
64
+ # Not every `if` needs an `else`
65
+ Style/MissingElse:
66
+ Enabled: false
67
+
68
+ # HTTP headers need to use string keys
69
+ Style/StringHashKeys:
70
+ Enabled: false
71
+
72
+ # I consider myself capable of understanding logical operators in an unless
73
+ Style/UnlessLogicalOperators:
74
+ Enabled: false
@@ -0,0 +1,12 @@
1
+ {
2
+ "[ruby]": {
3
+ "editor.tabSize": 2,
4
+ "editor.rulers": [120]
5
+ },
6
+ "[yaml]": {
7
+ "editor.tabSize": 2,
8
+ "editor.rulers": [120]
9
+ },
10
+ "files.trimTrailingWhitespace": true,
11
+ "files.insertFinalNewline": true
12
+ }
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { "https://github.com/#{_1}" }
6
6
 
7
7
  # Specify your gem's dependencies in mlb_stats_api.gemspec
8
8
  gemspec
data/Gemfile.lock CHANGED
@@ -1,47 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mlb_stats_api (0.2.5)
4
+ mlb_stats_api (0.4.0)
5
5
  hana (~> 1.3)
6
- httparty (~> 0.16)
7
- moneta (~> 1.0)
6
+ httparty (~> 0.20)
7
+ moneta (~> 1.5)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.7.0)
13
- public_suffix (>= 2.0.2, < 5.0)
14
- crack (0.4.3)
15
- safe_yaml (~> 1.0.0)
16
- diff-lcs (1.3)
17
- hana (1.3.5)
12
+ addressable (2.8.1)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
+ ast (2.4.2)
15
+ crack (0.4.5)
16
+ rexml
17
+ diff-lcs (1.5.0)
18
+ hana (1.3.7)
18
19
  hashdiff (1.0.1)
19
- httparty (0.18.0)
20
+ httparty (0.20.0)
20
21
  mime-types (~> 3.0)
21
22
  multi_xml (>= 0.5.2)
22
- mime-types (3.3.1)
23
+ json (2.6.2)
24
+ mime-types (3.4.1)
23
25
  mime-types-data (~> 3.2015)
24
- mime-types-data (3.2019.1009)
25
- moneta (1.2.1)
26
+ mime-types-data (3.2022.0105)
27
+ moneta (1.5.1)
26
28
  multi_xml (0.6.0)
27
- public_suffix (4.0.3)
28
- rake (13.0.1)
29
- rspec (3.9.0)
30
- rspec-core (~> 3.9.0)
31
- rspec-expectations (~> 3.9.0)
32
- rspec-mocks (~> 3.9.0)
33
- rspec-core (3.9.1)
34
- rspec-support (~> 3.9.1)
35
- rspec-expectations (3.9.1)
29
+ parallel (1.22.1)
30
+ parser (3.1.2.1)
31
+ ast (~> 2.4.1)
32
+ public_suffix (5.0.0)
33
+ rainbow (3.1.1)
34
+ rake (13.0.6)
35
+ regexp_parser (2.6.0)
36
+ rexml (3.2.5)
37
+ rspec (3.11.0)
38
+ rspec-core (~> 3.11.0)
39
+ rspec-expectations (~> 3.11.0)
40
+ rspec-mocks (~> 3.11.0)
41
+ rspec-core (3.11.0)
42
+ rspec-support (~> 3.11.0)
43
+ rspec-expectations (3.11.1)
36
44
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.9.0)
38
- rspec-mocks (3.9.1)
45
+ rspec-support (~> 3.11.0)
46
+ rspec-mocks (3.11.1)
39
47
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.9.0)
41
- rspec-support (3.9.2)
42
- safe_yaml (1.0.5)
43
- webmock (3.8.3)
44
- addressable (>= 2.3.6)
48
+ rspec-support (~> 3.11.0)
49
+ rspec-support (3.11.1)
50
+ rubocop (1.37.0)
51
+ json (~> 2.3)
52
+ parallel (~> 1.10)
53
+ parser (>= 3.1.2.1)
54
+ rainbow (>= 2.2.2, < 4.0)
55
+ regexp_parser (>= 1.8, < 3.0)
56
+ rexml (>= 3.2.5, < 4.0)
57
+ rubocop-ast (>= 1.22.0, < 2.0)
58
+ ruby-progressbar (~> 1.7)
59
+ unicode-display_width (>= 1.4.0, < 3.0)
60
+ rubocop-ast (1.23.0)
61
+ parser (>= 3.1.1.0)
62
+ ruby-progressbar (1.11.0)
63
+ unicode-display_width (2.3.0)
64
+ webmock (3.18.1)
65
+ addressable (>= 2.8.0)
45
66
  crack (>= 0.3.2)
46
67
  hashdiff (>= 0.4.0, < 2.0.0)
47
68
 
@@ -49,11 +70,12 @@ PLATFORMS
49
70
  ruby
50
71
 
51
72
  DEPENDENCIES
52
- bundler (> 1.16)
73
+ bundler (> 2.3)
53
74
  mlb_stats_api!
54
- rake (> 10.0)
55
- rspec (~> 3.8)
56
- webmock (~> 3.4)
75
+ rake (> 13.0)
76
+ rspec (~> 3.11)
77
+ rubocop (~> 1.37)
78
+ webmock (~> 3.18)
57
79
 
58
80
  BUNDLED WITH
59
- 1.17.2
81
+ 2.3.22
data/bin/console CHANGED
@@ -4,8 +4,8 @@
4
4
  require 'bundler/setup'
5
5
  require 'mlb_stats_api'
6
6
 
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
7
+ # You can add fixtures and/or initialization code here to make experimenting with your gem easier. You can also use a
8
+ # different console, if you like.
9
9
 
10
10
  @client = MLBStatsAPI::Client.new
11
11
 
@@ -8,12 +8,8 @@ module MLBStatsAPI
8
8
  @data = data
9
9
  end
10
10
 
11
- def [](key)
12
- @data[key]
13
- end
11
+ def [](key) = @data[key]
14
12
 
15
- def dig(*path)
16
- @data.dig(*path)
17
- end
13
+ def dig(*path) = @data.dig(*path)
18
14
  end
19
15
  end
@@ -46,7 +46,7 @@ module MLBStatsAPI
46
46
  @logger = logger.is_a?(::Logger) ? logger : ::Logger.new(logger)
47
47
  end
48
48
 
49
- def get(endpoint, query = {})
49
+ def get(endpoint, **query)
50
50
  url = "/api/v#{query.delete(:version) || DEFAULT_VERSION}#{endpoint}"
51
51
 
52
52
  args = normalize_query_args(query)
@@ -60,14 +60,9 @@ module MLBStatsAPI
60
60
  response.parsed_response
61
61
  end
62
62
 
63
- def normalize_query_args(query)
64
- query
65
- .reject { |_, v| v.nil? }
66
- .map { |key, val| [key, val.is_a?(Array) ? val.join(',') : val] }
67
- .to_h
68
- end
63
+ def normalize_query_args(query) = query.compact.transform_values { _1.is_a?(Array) ? _1.join(',') : _1 }
69
64
 
70
- def load(key, options = {})
65
+ def load(key, **options)
71
66
  value = @cache.load(key)
72
67
 
73
68
  return value if value
@@ -5,8 +5,9 @@ module MLBStatsAPI
5
5
  attr_reader :game_pk
6
6
 
7
7
  def initialize(api, game_pk, data)
8
+ super(data)
9
+
8
10
  @api = api
9
- @data = data
10
11
  @game_pk = game_pk
11
12
  end
12
13
 
@@ -2,18 +2,11 @@
2
2
 
3
3
  module MLBStatsAPI
4
4
  # Only the Pacific Coast League uses conferences
5
- # @see https://statsapi.mlb.com/docs/#tag/conference
6
5
  module Conferences
7
6
  # View all PCL conferences.
8
- # @see https://statsapi.mlb.com/docs/#operation/conferences
9
- def conferences(options = {})
10
- get '/conferences', options
11
- end
7
+ def conferences(**options) = get('/conferences', **options)
12
8
 
13
- # View PCL conferences by conferenceId.
14
- # @see https://statsapi.mlb.com/docs/#operation/conferences
15
- def conference(conference_id, options = {})
16
- get "/conferences/#{conference_id}", options
17
- end
9
+ # View PCL conferences by conference ID.
10
+ def conference(conference_id, **options) = get("/conferences/#{conference_id}", **options)
18
11
  end
19
12
  end
@@ -2,76 +2,33 @@
2
2
 
3
3
  module MLBStatsAPI
4
4
  # These methods all return lists of possible values
5
- # @see https://statsapi.mlb.com/docs/#tag/config
6
5
  module Config
7
- # @see https://statsapi.mlb.com/docs/#operation/gameStatus
8
- def game_status
9
- get '/gameStatus'
10
- end
6
+ def game_status = get('/gameStatus')
11
7
 
12
- # @see https://statsapi.mlb.com/docs/#operation/baseballStats
13
- def baseball_stats
14
- get '/baseballStats'
15
- end
8
+ def baseball_stats = get('/baseballStats')
16
9
 
17
- # @see https://statsapi.mlb.com/docs/#operation/gameTypes
18
- def game_types
19
- get '/gameTypes'
20
- end
10
+ def game_types = get('/gameTypes')
21
11
 
22
- # @see https://statsapi.mlb.com/docs/#operation/languages
23
- def languages
24
- get '/languages'
25
- end
12
+ def languages = get('/languages')
26
13
 
27
- # @see https://statsapi.mlb.com/docs/#operation/leagueLeaderTypes
28
- def league_leader_types
29
- get '/leagueLeaderTypes'
30
- end
14
+ def league_leader_types = get('/leagueLeaderTypes')
31
15
 
32
- # @see https://statsapi.mlb.com/docs/#operation/metrics
33
- def metrics
34
- get '/metrics'
35
- end
16
+ def metrics = get('/metrics')
36
17
 
37
- # @see https://statsapi.mlb.com/docs/#operation/platforms
38
- def platforms
39
- get '/platforms'
40
- end
18
+ def platforms = get('/platforms')
41
19
 
42
- # @see https://statsapi.mlb.com/docs/#operation/positions
43
- def positions
44
- get '/positions'
45
- end
20
+ def positions = get('/positions')
46
21
 
47
- # @see https://statsapi.mlb.com/docs/#operation/rosterTypes
48
- def roster_types
49
- get '/rosterTypes'
50
- end
22
+ def roster_types = get('/rosterTypes')
51
23
 
52
- # @see https://statsapi.mlb.com/docs/#operation/scheduleEventTypes
53
- def schedule_event_types
54
- get '/scheduleEventTypes'
55
- end
24
+ def schedule_event_types = get('/scheduleEventTypes')
56
25
 
57
- # @see https://statsapi.mlb.com/docs/#operation/sitCodes
58
- def situation_codes
59
- get '/situationCodes'
60
- end
26
+ def situation_codes = get('/situationCodes')
61
27
 
62
- # @see https://statsapi.mlb.com/docs/#operation/standingsTypes
63
- def standings_types
64
- get '/standingsTypes'
65
- end
28
+ def standings_types = get('/standingsTypes')
66
29
 
67
- # @see https://statsapi.mlb.com/docs/#operation/statGroups
68
- def stat_groups
69
- get '/statGroups'
70
- end
30
+ def stat_groups = get('/statGroups')
71
31
 
72
- # @see https://statsapi.mlb.com/docs/#operation/statTypes
73
- def stat_types
74
- get '/statTypes'
75
- end
32
+ def stat_types = get('/statTypes')
76
33
  end
77
34
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MLBStatsAPI
4
- # @see https://statsapi.mlb.com/docs/#tag/division
5
4
  module Divisions
6
5
  # There are actually far more divisions from other leagues in the API.
7
6
  # I don't think I'll add them until necessary.
@@ -15,9 +14,6 @@ module MLBStatsAPI
15
14
  }.freeze
16
15
 
17
16
  # View league division directorial information.
18
- # @see https://statsapi.mlb.com/docs/#operation/divisions
19
- def divisions(options = {})
20
- get '/divisions', options
21
- end
17
+ def divisions(**options) = get('/divisions', **options)
22
18
  end
23
19
  end
@@ -2,25 +2,14 @@
2
2
 
3
3
  module MLBStatsAPI
4
4
  # Operations pertaining to MLB Rule 4 Draft (First-Year Player Draft)
5
- # @see https://statsapi.mlb.com/docs/#tag/draft
6
5
  module Drafts
7
6
  # View drafted players by year.
8
- # @see https://statsapi.mlb.com/docs/#operation/draft
9
- def draft(year, options = {})
10
- get "/draft/#{year}", options
11
- end
7
+ def draft(year, **options) = get("/draft/#{year}", **options)
12
8
 
13
9
  # View draft eligible prospects by year.
14
- # @see https://statsapi.mlb.com/docs/#operation/draftProspects
15
- def draft_prospects(year, options = {})
16
- get "/draft/#{year}/prospects", options
17
- end
10
+ def draft_prospects(year, **options) = get("/draft/#{year}/prospects", **options)
18
11
 
19
- # View latest player drafted, endpoint best used when draft is currently
20
- # open.
21
- # @see https://statsapi.mlb.com/docs/#operation/latestDraftPicks
22
- def draft_latest(year, options = {})
23
- get "/draft/#{year}/latest", options
24
- end
12
+ # View latest player drafted, endpoint best used when draft is currently open.
13
+ def draft_latest(year, **options) = get("/draft/#{year}/latest", **options)
25
14
  end
26
15
  end
@@ -3,25 +3,25 @@
3
3
  module MLBStatsAPI
4
4
  class Error < ::RuntimeError
5
5
  def initialize(response)
6
+ super()
7
+
6
8
  @response = response
7
9
  end
8
10
 
9
11
  def to_s
12
+ # @response.response
10
13
  format(
11
14
  '%<code>s: %<message>s (%<uri>s)',
12
15
  code: @response.code,
13
- message: '', # @response.response,
16
+ message: '',
14
17
  uri: @response.request.last_uri.to_s
15
18
  )
16
19
  end
17
20
  end
18
21
 
19
- class ForbiddenError < Error
20
- end
22
+ class ForbiddenError < Error; end
21
23
 
22
- class NotFoundError < Error
23
- end
24
+ class NotFoundError < Error; end
24
25
 
25
- class UnauthorizedError < Error
26
- end
26
+ class UnauthorizedError < Error; end
27
27
  end
@@ -2,42 +2,26 @@
2
2
 
3
3
  module MLBStatsAPI
4
4
  module Games
5
- PREGAME_STATUSES = /
6
- Preview|Warmup|Pre-Game|Delayed Start|Scheduled
7
- /x.freeze
5
+ PREGAME_STATUSES = /Preview|Warmup|Pre-Game|Delayed Start|Scheduled/
6
+ POSTGAME_STATUSES = /Final|Game Over|Postponed|Completed Early/
8
7
 
9
- POSTGAME_STATUSES = /Final|Game Over|Postponed|Completed Early/.freeze
8
+ def self.pregame_status?(status) = PREGAME_STATUSES.match?(status)
10
9
 
11
- def self.pregame_status?(status)
12
- PREGAME_STATUSES.match?(status)
13
- end
10
+ def self.postgame_status?(status) = POSTGAME_STATUSES.match?(status)
14
11
 
15
- def self.postgame_status?(status)
16
- POSTGAME_STATUSES.match?(status)
17
- end
12
+ def boxscore(game_pk) = get("/game/#{game_pk}/boxscore")
18
13
 
19
- def boxscore(game_id)
20
- get "/game/#{game_id}/boxscore"
21
- end
22
-
23
- def content(game_id, limit: nil)
24
- get "/game/#{game_id}/content", highlightLimit: limit
25
- end
14
+ def content(game_pk, limit: nil) = get("/game/#{game_pk}/content", highlightLimit: limit)
26
15
 
27
- def context_metrics(game_id, timecode: nil)
28
- get "/game/#{game_id}/contextMetrics", timecode: timecode
29
- end
16
+ def context_metrics(game_pk, timecode: nil) = get("/game/#{game_pk}/contextMetrics", timecode:)
30
17
 
31
- # This endpoint can return very large payloads. It is STRONGLY recommended
32
- # that clients ask for diffs and use "Accept-Encoding: gzip" header.
33
- def live_feed(game_id, timecode: nil)
34
- MLBStatsAPI::LiveFeed.new(
35
- self,
36
- get("/game/#{game_id}/feed/live", version: '1.1', timecode: timecode)
37
- )
18
+ # This endpoint can return very large payloads. It is STRONGLY recommended that clients ask for diffs and use
19
+ # "Accept-Encoding: gzip" header.
20
+ def live_feed(game_pk, timecode: nil)
21
+ MLBStatsAPI::LiveFeed.new self, get("/game/#{game_pk}/feed/live", version: '1.1', timecode:)
38
22
  end
39
23
 
40
- def live_feed_diff(game_id, timecode: nil, snapshot_at: nil)
24
+ def live_feed_diff(game_pk, timecode: nil, snapshot_at: nil)
41
25
  query = { version: '1.1' }
42
26
 
43
27
  if timecode
@@ -48,22 +32,16 @@ module MLBStatsAPI
48
32
  raise ArgumentError, 'Please pass either a timecode or a snapshot.'
49
33
  end
50
34
 
51
- get "/game/#{game_id}/feed/live/diffPatch", query
35
+ get "/game/#{game_pk}/feed/live/diffPatch", query
52
36
  end
53
37
 
54
- def live_feed_timestamps(game_id)
55
- get "/game/#{game_id}/feed/live/timestamps", version: '1.1'
56
- end
38
+ def live_feed_timestamps(game_pk) = get("/game/#{game_pk}/feed/live/timestamps", version: '1.1')
57
39
 
58
- def color_feed(game_id, timecode: nil)
59
- MLBStatsAPI::ColorFeed.new(
60
- self,
61
- game_id,
62
- get("/game/#{game_id}/feed/color", timecode: timecode)
63
- )
40
+ def color_feed(game_pk, timecode: nil)
41
+ MLBStatsAPI::ColorFeed.new self, game_pk, get("/game/#{game_pk}/feed/color", timecode:)
64
42
  end
65
43
 
66
- # def color_feed_diff(game_id, timecode: nil, snapshot_at: nil)
44
+ # def color_feed_diff(game_pk, timecode: nil, snapshot_at: nil)
67
45
  # query = {}
68
46
 
69
47
  # if timecode
@@ -74,23 +52,17 @@ module MLBStatsAPI
74
52
  # raise ArgumentError, 'Please pass either a timecode or a snapshot.'
75
53
  # end
76
54
 
77
- # get "/game/#{game_id}/feed/color/diffPatch", query
55
+ # get "/game/#{game_pk}/feed/color/diffPatch", query
78
56
  # end
79
57
 
80
- # def color_feed_timestamps(game_id)
81
- # get "/game/#{game_id}/feed/color/timestamps"
58
+ # def color_feed_timestamps(game_pk)
59
+ # get "/game/#{game_pk}/feed/color/timestamps"
82
60
  # end
83
61
 
84
- def linescore(game_id)
85
- get "/game/#{game_id}/linescore"
86
- end
62
+ def linescore(game_pk) = get("/game/#{game_pk}/linescore")
87
63
 
88
- def play_by_play(game_id, timecode: nil)
89
- get "/game/#{game_id}/playByPlay", timecode: timecode
90
- end
64
+ def play_by_play(game_pk, timecode: nil) = get("/game/#{game_pk}/playByPlay", timecode:)
91
65
 
92
- def win_probability(game_id, timecode: nil)
93
- get "/game/#{game_id}/winProbability", timecode: timecode
94
- end
66
+ def win_probability(game_pk, timecode: nil) = get("/game/#{game_pk}/winProbability", timecode:)
95
67
  end
96
68
  end
@@ -1,24 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MLBStatsAPI
4
- # @see https://statsapi.mlb.com/docs/#tag/homerunderby
5
4
  module HomeRunDerby
6
5
  # View a home run derby object based on gamePk.
7
- # @see https://statsapi.mlb.com/docs/#operation/homeRunDerbyBracket
8
- def home_run_derby(game_pk, options = {})
9
- get "/homeRunDerby/#{game_pk}", options
10
- end
6
+ def home_run_derby(game_pk, **options) = get("/homeRunDerby/#{game_pk}", **options)
11
7
 
12
8
  # View a home run derby object based on bracket.
13
- # @see https://statsapi.mlb.com/docs/#operation/homeRunDerbyBracket
14
- def home_run_derby_bracket(game_pk, options = {})
15
- get "/homeRunDerby/#{game_pk}/bracket", options
16
- end
9
+ def home_run_derby_bracket(game_pk, **options) = get("/homeRunDerby/#{game_pk}/bracket", **options)
17
10
 
18
11
  # View a home run derby object based on pool.
19
- # @see https://statsapi.mlb.com/docs/#operation/homeRunDerbyPool
20
- def home_run_derby_pool(game_pk, options = {})
21
- get "/homeRunDerby/#{game_pk}/pool", options
22
- end
12
+ def home_run_derby_pool(game_pk, **options) = get("/homeRunDerby/#{game_pk}/pool", **options)
23
13
  end
24
14
  end