lib/dmao/ingesters/generic/ingester.rb in dmao-generic-ingesters-0.6.0 vs lib/dmao/ingesters/generic/ingester.rb in dmao-generic-ingesters-0.7.0
- old
+ new
@@ -52,11 +52,11 @@
raise DMAO::Ingesters::Errors::GenericIngester.new("Calling ingest on generic ingester is not allowed.")
end
def ingest_entity attributes = {}
- raise DMAO::Ingesters::Errors::EmptyAttributes.new("Cannot ingest #{self.class.entity_name} without attributes.") if attributes.nil? || attributes.empty?
+ validate_attributes_present attributes
begin
entity = self.class::ENTITY.find_by_system_uuid attributes[:system_uuid]
@@ -90,9 +90,13 @@
raise self.class::ENTITY_ERROR.new("#{self.class::ENTITY_ERROR_MESSAGE}, #{error_messages}")
end
private
+
+ def validate_attributes_present attributes
+ raise DMAO::Ingesters::Errors::EmptyAttributes.new("Cannot ingest #{self.class.entity_name} without attributes.") if attributes.nil? || attributes.empty?
+ end
def perform_entity_action action, arguments
errors_to_handle = self.class::ERROR_HANDLING.nil? ? generic_errors : self.class::ERROR_HANDLING
\ No newline at end of file