mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Publish phone numbers as objects
The standard introduced this a while ago but I didn't notice. We have to update integrations like Disco Regen now.
This commit is contained in:
@@ -19,7 +19,7 @@ class EnterpriseBuilder < DfcBuilder
|
||||
catalogItems: catalog_items,
|
||||
emails: [enterprise.email_address].compact,
|
||||
localizations: [address],
|
||||
phoneNumbers: [enterprise.phone].compact,
|
||||
phoneNumbers: phone_numbers(enterprise),
|
||||
socialMedias: SocialMediaBuilder.social_medias(enterprise),
|
||||
logo: enterprise.logo_url(:small),
|
||||
mainContact: contact(enterprise),
|
||||
@@ -71,4 +71,15 @@ class EnterpriseBuilder < DfcBuilder
|
||||
lastName:, # rubocop:disable Naming/VariableName
|
||||
)
|
||||
end
|
||||
|
||||
def self.phone_numbers(enterprise)
|
||||
return [] if enterprise.phone.blank?
|
||||
|
||||
number = DataFoodConsortium::Connector::PhoneNumber.new(
|
||||
nil,
|
||||
phoneNumber: enterprise.phone,
|
||||
)
|
||||
|
||||
[number]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -435,7 +435,9 @@ paths:
|
||||
- "@id": http://test.host/api/dfc/enterprises/10000
|
||||
"@type": dfc-b:Enterprise
|
||||
dfc-b:hasAddress: http://test.host/api/dfc/addresses/40000
|
||||
dfc-b:hasPhoneNumber: 0404 444 000 200
|
||||
dfc-b:hasPhoneNumber:
|
||||
"@type": dfc-b:PhoneNumber
|
||||
dfc-b:phoneNumber: 0404 444 000 200
|
||||
dfc-b:email: hello@example.org
|
||||
dfc-b:websitePage: https://openfoodnetwork.org
|
||||
dfc-b:hasSocialMedia: http://test.host/api/dfc/enterprises/10000/social_medias/facebook
|
||||
@@ -520,7 +522,9 @@ paths:
|
||||
- "@id": http://test.host/api/dfc/enterprises/10000
|
||||
"@type": dfc-b:Enterprise
|
||||
dfc-b:hasAddress: http://test.host/api/dfc/addresses/40000
|
||||
dfc-b:hasPhoneNumber: 0404 444 000 200
|
||||
dfc-b:hasPhoneNumber:
|
||||
"@type": dfc-b:PhoneNumber
|
||||
dfc-b:phoneNumber: 0404 444 000 200
|
||||
dfc-b:email: hello@example.org
|
||||
dfc-b:websitePage: https://openfoodnetwork.org
|
||||
dfc-b:hasSocialMedia: http://test.host/api/dfc/enterprises/10000/social_medias/facebook
|
||||
|
||||
Reference in New Issue
Block a user