class DMAO::Ingesters::Generic::OrganisationIngester
Constants
- ENTITY
- ENTITY_ERROR
- ENTITY_ERROR_MESSAGE
- ERROR_HANDLING
Public Instance Methods
link_child_to_parent(child_system_uuid, parent_system_uuid)
click to toggle source
# File lib/dmao/ingesters/generic/organisation_ingester.rb, line 24 def link_child_to_parent child_system_uuid, parent_system_uuid child_unit = find_unit_or_raise_link_error child_system_uuid, "Organisation unit not found for child system uuid #{child_system_uuid}" parent_unit = find_unit_or_raise_link_error parent_system_uuid, "Organisation unit not found for parent system uuid #{parent_system_uuid}" attributes = { parent_id: parent_unit.id } update_organisation_unit child_unit.id, attributes end
Protected Instance Methods
find_unit_or_raise_link_error(unit_system_uuid, error_message)
click to toggle source
# File lib/dmao/ingesters/generic/organisation_ingester.rb, line 39 def find_unit_or_raise_link_error unit_system_uuid, error_message begin DMAO::API::OrganisationUnit.find_by_system_uuid unit_system_uuid rescue DMAO::API::Errors::OrganisationUnitNotFound raise DMAO::Ingesters::Errors::LinkOrganisationUnitError.new(error_message) end end