Sha256: 1d4de971dc997e59c48e532820692de63d711695e2b2b91045c9f68ba04a6d0d

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

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

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

      end
      private

      def set_matches
        if response["summary"]["matches"]["match"]
          if response["summary"]["matches"]["match"].is_a?(Array)
            @matches = response["summary"]["matches"]["match"].map {|x| Sportradar::Api::Soccer::Match.new x }
          elsif response["summary"]["matches"]["match"].is_a?(Hash)
            @matches = [ Sportradar::Api::Soccer::Match.new(response["summary"]["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/summary.rb
sportradar-api-0.1.3 lib/sportradar/api/soccer/summary.rb