Class: DataFoodConsortium::Connector::ProductBatch

Inherits:
Object
  • Object
show all
Includes:
VirtualAssembly::Semantizer::SemanticObject
Defined in:
lib/datafoodconsortium/connector/product_batch.rb

Constant Summary collapse

SEMANTIC_TYPE =
"dfc-b:ProductBatch".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(semanticId, name: nil, description: nil, batchNumber: nil, realStock: nil, physicalProduct: nil, bestBeforeDate: nil, expirationDate: nil, productionDate: nil) ⇒ ProductBatch

Returns a new instance of ProductBatch.

Parameters:

  • semanticId (String)
  • name (String) (defaults to: nil)
  • description (String) (defaults to: nil)
  • batchNumber (String) (defaults to: nil)
  • realStock (IRealStock) (defaults to: nil)
  • physicalProduct (IPhysicalProduct) (defaults to: nil)
  • bestBeforeDate (DateTime) (defaults to: nil)
  • expirationDate (DateTime) (defaults to: nil)
  • productionDate (DateTime) (defaults to: nil)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 67

def initialize(semanticId, name: nil, description: nil, batchNumber: nil, realStock: nil, physicalProduct: nil, bestBeforeDate: nil, expirationDate: nil, productionDate: nil)
  super(semanticId)
  @name = name
  @description = description
  @batchNumber = batchNumber
  @realStock = realStock
  @physicalProduct = physicalProduct
  @bestBeforeDate = bestBeforeDate
  @expirationDate = expirationDate
  @productionDate = productionDate
  self.semanticType = "dfc-b:ProductBatch"
  registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
  registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
  registerSemanticProperty("dfc-b:batchNumber", &method("batchNumber")).valueSetter = method("batchNumber=")
  registerSemanticProperty("dfc-b:identifiedBy", &method("realStock")).valueSetter = method("realStock=")
  registerSemanticProperty("dfc-b:contains", &method("physicalProduct")).valueSetter = method("physicalProduct=")
  registerSemanticProperty("dfc-b:bestBeforeDate", &method("bestBeforeDate")).valueSetter = method("bestBeforeDate=")
  registerSemanticProperty("dfc-b:expirationDate", &method("expirationDate")).valueSetter = method("expirationDate=")
  registerSemanticProperty("dfc-b:productionDate", &method("productionDate")).valueSetter = method("productionDate=")
end

Instance Attribute Details

#batchNumberString

Returns:

  • (String)


41
42
43
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 41

def batchNumber
  @batchNumber
end

#bestBeforeDateDateTime

Returns:

  • (DateTime)


50
51
52
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 50

def bestBeforeDate
  @bestBeforeDate
end

#descriptionString

Returns:

  • (String)


38
39
40
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 38

def description
  @description
end

#expirationDateDateTime

Returns:

  • (DateTime)


53
54
55
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 53

def expirationDate
  @expirationDate
end

#nameString

Returns:

  • (String)


35
36
37
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 35

def name
  @name
end

#physicalProductIPhysicalProduct

Returns:

  • (IPhysicalProduct)


47
48
49
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 47

def physicalProduct
  @physicalProduct
end

#productionDateDateTime

Returns:

  • (DateTime)


56
57
58
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 56

def productionDate
  @productionDate
end

#realStockIRealStock

Returns:

  • (IRealStock)


44
45
46
# File 'lib/datafoodconsortium/connector/product_batch.rb', line 44

def realStock
  @realStock
end