diff --git a/engines/dfc_provider/lib/dfc_provider.rb b/engines/dfc_provider/lib/dfc_provider.rb index 9e917a5701..526cceb9c3 100644 --- a/engines/dfc_provider/lib/dfc_provider.rb +++ b/engines/dfc_provider/lib/dfc_provider.rb @@ -8,6 +8,7 @@ require "dfc_provider/engine" # Custom data types require "dfc_provider/supplied_product" +require "dfc_provider/address" module DfcProvider DataFoodConsortium::Connector::Importer.register_type(SuppliedProduct) diff --git a/engines/dfc_provider/lib/dfc_provider/address.rb b/engines/dfc_provider/lib/dfc_provider/address.rb new file mode 100644 index 0000000000..02ecc5ca3b --- /dev/null +++ b/engines/dfc_provider/lib/dfc_provider/address.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Temporary solution to add `region` to Address, to be removed once the DFC connector supports it + +module DfcProvider + class Address < DataFoodConsortium::Connector::Address + # @return [String] + attr_accessor :region + + def initialize(semantic_id, region: "", **properties) + super(semantic_id, **properties) + @region = region + + registerSemanticProperty("dfc-b:region", &method("region")).valueSetter = method("region=") + end + end +end