Sha256: 37c7f7804b90a4c049111e65388769896404ace9181690800ed3627676dc13ff

Contents?: true

Size: 506 Bytes

Versions: 11

Compression:

Stored size: 506 Bytes

Contents

module SportsDataApi
  module Mlb
    class League < JsonData
      def divisions
        @divisions ||= league[:divisions].map do |data|
          Division.new(data)
        end
      end

      def teams
        @teams ||= divisions.flat_map do |division|
          division.teams.flat_map do |team|
            team.tap do |t|
              t.team[:conference] = league[:alias]
              t.team[:conference_name] = league[:name]
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sports_data_api-0.15.1 lib/sports_data_api/mlb/league.rb
sports_data_api-0.15.0 lib/sports_data_api/mlb/league.rb
sports_data_api-0.14.1 lib/sports_data_api/mlb/league.rb
sports_data_api-0.14.0 lib/sports_data_api/mlb/league.rb
sports_data_api-0.13.0 lib/sports_data_api/mlb/league.rb
sports_data_api-0.12.1 lib/sports_data_api/mlb/league.rb
sports_data_api-0.12.0 lib/sports_data_api/mlb/league.rb
sports_data_api-0.11.6 lib/sports_data_api/mlb/league.rb
sports_data_api-0.11.5 lib/sports_data_api/mlb/league.rb
sports_data_api-0.11.3 lib/sports_data_api/mlb/league.rb
sports_data_api-0.11.2 lib/sports_data_api/mlb/league.rb