Sha256: a8b4b33f3a824f300c5982d0aa20455cb44f19a30fa3f7f0324700139421c034

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 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(type = :default, options = {})
      if type.is_a?(Hash) && options.empty?
        options = type
        type = :default
      end

      raise ArgumentError, 'invalid schedule type' unless SCHEDULE_TYPES[type]

      get SCHEDULE_TYPES[type], { sportId: 1 }.merge(options)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mlb_stats_api-0.2.5 lib/mlb_stats_api/schedules.rb
mlb_stats_api-0.2.4 lib/mlb_stats_api/schedules.rb
mlb_stats_api-0.2.3 lib/mlb_stats_api/schedules.rb
mlb_stats_api-0.2.2 lib/mlb_stats_api/schedules.rb