lib/sportradar/api/nfl/division.rb in sportradar-api-0.1.38 vs lib/sportradar/api/nfl/division.rb in sportradar-api-0.9.0
- old
+ new
@@ -6,22 +6,10 @@
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
+ @teams = parse_into_array(selector: response["team"], klass: Sportradar::Api::Nfl::Team) if response["team"]
end
end
end
end