Sha256: ed7bbb1b933ce0284f2736ddeffd8aec4a98f5a57e176b01531d27df65df6d0e

Contents?: true

Size: 577 Bytes

Versions: 10

Compression:

Stored size: 577 Bytes

Contents

module Sportradar
  module Api
    class Soccer::Schedule < Data
      attr_accessor :response, :matches

      def initialize(data)
        @response = data
        @matches = data["schedule"]["matches"]["match"].map {|x| Sportradar::Api::Soccer::Match.new x } if data["schedule"]["matches"]["match"]
      end

      def league(league_name)
        matches.select{ |match| match.tournament_group.name.parameterize == league_name.parameterize}
      end

      def available_leagues
        matches.map {|match| match.tournament_group.name}.uniq
      end


    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sportradar-api-0.1.17 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.16 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.15 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.14 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.13 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.12 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.11 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.10 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.8 lib/sportradar/api/soccer/schedule.rb
sportradar-api-0.1.7 lib/sportradar/api/soccer/schedule.rb