lib/ecoportal/api/v2/page/components.rb in ecoportal-api-oozes-0.7.3 vs lib/ecoportal/api/v2/page/components.rb in ecoportal-api-oozes-0.7.4

- old
+ new

@@ -19,17 +19,17 @@ end end def get_by_name(name, type: nil) pool = type ? get_by_type(type) : self - + pool.select do |comp| comp.label.to_s.strip.downcase == name.to_s.strip.downcase end.first end def add(label:, type:) - fld_doc = Ecoportal::API::V2::Page::Component.new_doc(type: type) + fld_doc = component_class.new_doc(type: type) upsert!(fld_doc) do |fld| fld.label = label yield(fld) if block_given? end end