Use full product and variant name on DFC API

This commit is contained in:
Maikel Linke
2023-12-20 16:43:29 +11:00
parent 6d5f07c6a0
commit eb03235295
4 changed files with 7 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ class SuppliedProductBuilder < DfcBuilder
DfcProvider::SuppliedProduct.new(
id,
name: variant.name_to_display,
name: variant.product_and_full_name,
description: variant.description,
productType: product_type,
quantity: QuantitativeValueBuilder.quantity(variant),

View File

@@ -41,7 +41,7 @@ describe EnterpriseBuilder do
expect(variant).to be_persisted
expect(result.suppliedProducts.count).to eq 1
expect(result.suppliedProducts[0].name).to eq "Apple"
expect(result.suppliedProducts[0].name).to eq "Apple - 1g"
end
it "assigns an address" do

View File

@@ -38,7 +38,7 @@ describe SuppliedProductBuilder do
variant.display_name = "Granny Smith"
product = builder.supplied_product(variant)
expect(product.name).to eq "Granny Smith"
expect(product.name).to eq "Apple - Granny Smith"
end
it "assigns a product type" do

View File

@@ -108,7 +108,7 @@ paths:
dfc-b:offeredThrough: http://test.host/api/dfc/enterprises/10000/offers/10001
- "@id": http://test.host/api/dfc/enterprises/10000/supplied_products/10001
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple
dfc-b:name: Apple - 1g
dfc-b:description: Red
dfc-b:hasType: dfc-pt:non-local-vegetable
dfc-b:hasQuantity:
@@ -339,7 +339,7 @@ paths:
dfc-b:hasCountry: Australia
- "@id": http://test.host/api/dfc/enterprises/10000/supplied_products/10001
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple
dfc-b:name: Apple - 1g
dfc-b:description: Round
dfc-b:hasType: dfc-pt:non-local-vegetable
dfc-b:hasQuantity:
@@ -444,7 +444,7 @@ paths:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/10000/supplied_products/10001
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple
dfc-b:name: Apple - 6g
dfc-b:description: A delicious heritage apple
dfc-b:hasType: dfc-pt:non-local-vegetable
dfc-b:hasQuantity:
@@ -508,7 +508,7 @@ paths:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/10000/supplied_products/10001
"@type": dfc-b:SuppliedProduct
dfc-b:name: Pesto
dfc-b:name: Pesto - 1g
dfc-b:description: Basil Pesto
dfc-b:hasType: dfc-pt:non-local-vegetable
dfc-b:hasQuantity: