Sha256: ac13aaaa83aff34e4a872081f1f0197bd35d3ff646791680b33de57d79df67e3

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

# frozen_string_literal: true

module MLBStatsAPI
  module Schedules
    SCHEDULE_TYPES = {
      default: '/schedule',
      postseason: '/schedule/postseason',
      tied: '/schedule/games/tied',
      postseason_series: '/schedule/postseason/series',
      tune_in: '/schedule/postseason/tuneIn'
    }.freeze

    def schedule(**options)
      endpoint = SCHEDULE_TYPES[options.delete(:type) || :default]

      raise ArgumentError, 'Invalid schedule type.' unless endpoint

      get endpoint, **{ sportId: 1 }.merge(options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mlb_stats_api-0.4.0 lib/mlb_stats_api/schedules.rb