lib/sportradar/api/soccer/summary.rb in sportradar-api-0.1.38 vs lib/sportradar/api/soccer/summary.rb in sportradar-api-0.9.0

- old
+ new

@@ -3,22 +3,10 @@ class Soccer::Summary < Data attr_accessor :response, :matches def initialize(data) @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 + @matches = parse_into_array(selector: response["summary"]["matches"]["match"], klass: Sportradar::Api::Soccer::Match) if response['summary'] && response['summary']['matches'] && response["summary"]["matches"]["match"] end end end end