lib/sportradar/api/data.rb in sportradar-api-0.9.59 vs lib/sportradar/api/data.rb in sportradar-api-0.10.0

- old
+ new

@@ -49,9 +49,11 @@ # @param existing [Hash{String=>Data}] Existing data hasb, ID => entity # @param data [Hash, Array] new data to update with def create_data(existing = {}, data, klass: nil, **opts) existing ||= {} # handles nil case, typically during object instantiation case data + when [], {} + existing when Array data.each do |hash| current = existing[hash['id']] current ? current.update(hash, **opts) : existing[hash['id']] = klass.new(hash, **opts) existing[hash['id']]