Sha256: cdc3d04ca36d842ff48bfe147c5311a5e7e9a796ebed170a3ee16df043fe611f

Contents?: true

Size: 655 Bytes

Versions: 32

Compression:

Stored size: 655 Bytes

Contents

module Sportradar
  module Api
    class Nfl::Division < Data
      attr_accessor :response, :id, :name, :alias, :teams

      def initialize(data)
        @response = data
        @id = data["id"]
        @name = data["name"]
        @alias = data["alias"]
        set_teams
      end

      private

      def set_teams
        if response["team"]
          if response["team"].is_a?(Array)
            @teams = response["team"].map {|team| Sportradar::Api::Nfl::Team.new team }
          elsif response["team"].is_a?(Hash)
            @teams = [ Sportradar::Api::Nfl::Team.new(response["team"]) ]
          end
        end
      end

    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
sportradar-api-0.1.17 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.16 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.15 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.14 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.13 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.12 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.11 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.10 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.8 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.7 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.6 lib/sportradar/api/nfl/division.rb
sportradar-api-0.1.5 lib/sportradar/api/nfl/division.rb