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.



246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/oddb2xml/fhir_support.rb', line 246

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.



244
245
246
# File 'lib/oddb2xml/fhir_support.rb', line 244

def description
  @description
end

#gtinObject (readonly)

Returns the value of attribute gtin.



244
245
246
# File 'lib/oddb2xml/fhir_support.rb', line 244

def gtin
  @gtin
end

Returns the value of attribute legal_status.



244
245
246
# File 'lib/oddb2xml/fhir_support.rb', line 244

def legal_status
  @legal_status
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



244
245
246
# File 'lib/oddb2xml/fhir_support.rb', line 244

def resource_id
  @resource_id
end

#swissmedic_no8Object (readonly)

Returns the value of attribute swissmedic_no8.



244
245
246
# File 'lib/oddb2xml/fhir_support.rb', line 244

def swissmedic_no8
  @swissmedic_no8
end