Sha256: fceb38542d0d2986b14e85649468b71f347d4f1f4c645079c20b76b84b50f2f6

Contents?: true

Size: 1.19 KB

Versions: 32

Compression:

Stored size: 1.19 KB

Contents

module Sportradar
  module Api
    class Nfl::Changelog < Data
      attr_accessor :response, :start_time, :end_time, :players, :games

      def initialize(data)
        @response = data
        @start_time = data["start_time"]
        @end_time = data["end_time"]
        set_players
        set_games
      end

      private

      def set_games
        if response["game"]
          if response["game"].is_a?(Array)
            @games = response["game"].map {|game| Sportradar::Api::Nfl::Game.new game }
          elsif response["game"].is_a?(Hash)
            @games = [ Sportradar::Api::Nfl::Game.new(response["game"]) ]
          end
        end
      end


      def set_players
        if response["profiles"] && response["profiles"]["players"] && response["profiles"]["players"]["player"]
          if response["profiles"]["players"]["player"].is_a?(Array)
            @players = response["profiles"]["players"]["player"].map {|player| Sportradar::Api::Nfl::Player.new player }
          elsif response["profiles"]["players"]["player"].is_a?(Hash)
            @players = [ Sportradar::Api::Nfl::Player.new(response["profiles"]["players"]["player"]) ]
          end
        end
      end

    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
sportradar-api-0.1.38 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.37 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.36 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.35 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.34 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.33 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.32 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.31 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.30 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.29 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.28 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.27 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.26 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.25 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.24 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.23 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.22 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.21 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.19 lib/sportradar/api/nfl/changelog.rb
sportradar-api-0.1.18 lib/sportradar/api/nfl/changelog.rb