Class: Oddb2xml::FHIR::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/oddb2xml/fhir_support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Package

Returns a new instance of Package.



275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/oddb2xml/fhir_support.rb', line 275

def initialize(resource)
  @resource_id = resource["id"]
  @gtin = resource.dig("packaging", "identifier", 0, "value")
  @description = resource["description"]

  # Extract SwissmedicNo8 from GTIN (last 8 digits)
  if @gtin && @gtin.length >= 8
    @swissmedic_no8 = @gtin[-8..-1]
  end

  @legal_status = resource.dig("legalStatusOfSupply", 0, "code", "coding", 0, "code")
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



273
274
275
# File 'lib/oddb2xml/fhir_support.rb', line 273

def description
  @description
end

#gtinObject (readonly)

Returns the value of attribute gtin.



273
274
275
# File 'lib/oddb2xml/fhir_support.rb', line 273

def gtin
  @gtin
end

Returns the value of attribute legal_status.



273
274
275
# File 'lib/oddb2xml/fhir_support.rb', line 273

def legal_status
  @legal_status
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



273
274
275
# File 'lib/oddb2xml/fhir_support.rb', line 273

def resource_id
  @resource_id
end

#swissmedic_no8Object (readonly)

Returns the value of attribute swissmedic_no8.



273
274
275
# File 'lib/oddb2xml/fhir_support.rb', line 273

def swissmedic_no8
  @swissmedic_no8
end