Sha256: 2ba196f0afcd5afc4324cac1a248a3a666480981698003aa3dc5f160fbaa32b7
Contents?: true
Size: 829 Bytes
Versions: 2
Compression:
Stored size: 829 Bytes
Contents
module LifenFhir class Channel < Element attribute :type, String attribute :value, String attribute :telecom, LifenFhir::Telecom def fhir_payload(user) raise Error.new(message: "Invalid channel: an UUID is required") if !valid? { id: user.uuid, resourceType: "Practitioner", type => [ { id: uuid } ] } end def valid? uuid and uuid.length != 0 end def self.from_json(json, type = nil) if type == "telecom" telecom = Telecom.new.attributes_from_json(json) new(uuid: telecom.uuid, type: type, value: telecom.value) else new(uuid: json["id"], type: type, value: "#{Array(json["line"]).join(", ")}, #{json["postalCode"]} #{json["city"]}") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lifen_fhir-0.7.1 | lib/lifen_fhir/channel.rb |
lifen_fhir-0.7.0 | lib/lifen_fhir/channel.rb |