Add DfcProvider::Address

Add our own address to include `region`, currently not supported
by the DFC connector.
`region` is already included in the next branch of data-model-uml:
729eba31a5
To me removed once the DFC connector is updated
This commit is contained in:
Gaetan Craig-Riou
2024-02-14 15:47:05 +11:00
parent affadbc05c
commit 17b13e75a8
2 changed files with 18 additions and 0 deletions

View File

@@ -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)

View File

@@ -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