Class: Oddb2xml::FHIR::Package
- Inherits:
-
Object
- Object
- Oddb2xml::FHIR::Package
- Defined in:
- lib/oddb2xml/fhir_support.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#gtin ⇒ Object
readonly
Returns the value of attribute gtin.
-
#legal_status ⇒ Object
readonly
Returns the value of attribute legal_status.
-
#resource_id ⇒ Object
readonly
Returns the value of attribute resource_id.
-
#swissmedic_no8 ⇒ Object
readonly
Returns the value of attribute swissmedic_no8.
Instance Method Summary collapse
-
#initialize(resource) ⇒ Package
constructor
A new instance of Package.
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
#description ⇒ Object (readonly)
Returns the value of attribute description.
244 245 246 |
# File 'lib/oddb2xml/fhir_support.rb', line 244 def description @description end |
#gtin ⇒ Object (readonly)
Returns the value of attribute gtin.
244 245 246 |
# File 'lib/oddb2xml/fhir_support.rb', line 244 def gtin @gtin end |
#legal_status ⇒ Object (readonly)
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_id ⇒ Object (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_no8 ⇒ Object (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 |