Sha256: e73c14a4ccbb453e24082bee43baac0927d37800621f4ede2ed718b6419e265c
Contents?: true
Size: 923 Bytes
Versions: 17
Compression:
Stored size: 923 Bytes
Contents
module Sportradar module Api class Nfl::Season < Data attr_accessor :response, :id, :year, :type, :name, :weeks, :injuries, :team def initialize(data) @response = data @id = data["id"] @year = data["year"] @type = data["type"] @name = data["name"] @team = Sportradar::Api::Nfl::Team.new data["team"] if data["team"] @injuries = data["injuries"]["team"].map {|team| Sportradar::Api::Nfl::Team.new team } if data["injuries"] && data["injuries"]["team"] set_weeks end private def set_weeks if response["week"] if response["week"].is_a?(Array) @weeks = response["week"].map {|week| Sportradar::Api::Nfl::Week.new week } elsif response["week"].is_a?(Hash) @weeks = [ Sportradar::Api::Nfl::Week.new(response["week"]) ] end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems