Sha256: 3aa41a3cde8daf4a2dd4c00c10def6a574dfe30e30b71d94093142224ca73441

Contents?: true

Size: 742 Bytes

Versions: 2

Compression:

Stored size: 742 Bytes

Contents

module Sportradar
  module Api
    class Soccer::Boxscore
      attr_accessor :response, :updated_at, :matches

      def initialize(data)
        @updated_at = data["boxscore"]["generated"]
        @response = data
        set_matches
      end

      private
      def set_matches
        if response["boxscore"]["matches"]["match"]
          if response["boxscore"]["matches"]["match"].is_a?(Array)
            @matches = response["boxscore"]["matches"]["match"].map {|x| Sportradar::Api::Soccer::Match.new x }
          elsif response["boxscore"]["matches"]["match"].is_a?(Hash)
            @matches = [ Sportradar::Api::Soccer::Match.new(response["boxscore"]["matches"]["match"]) ]
          end
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sportradar-api-0.1.4 lib/sportradar/api/soccer/boxscore.rb
sportradar-api-0.1.3 lib/sportradar/api/soccer/boxscore.rb