mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
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:
@@ -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)
|
||||
|
||||
17
engines/dfc_provider/lib/dfc_provider/address.rb
Normal file
17
engines/dfc_provider/lib/dfc_provider/address.rb
Normal 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
|
||||
Reference in New Issue
Block a user