Sha256: 4f22fd6798b176c4da11f6fc3867c2401bf946929140b07b6e84d96146b20437
Contents?: true
Size: 826 Bytes
Versions: 4
Compression:
Stored size: 826 Bytes
Contents
module LifenFhir class Channel < Element attribute :type, String attribute :value, String attribute :telecom, LifenFhir::Telecom def fhir_payload(user) raise LifenFhir::Error, "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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lifen_fhir-0.6.1 | lib/lifen_fhir/channel.rb |
lifen_fhir-0.6.0 | lib/lifen_fhir/channel.rb |
lifen_fhir-0.5.0 | lib/lifen_fhir/channel.rb |
lifen_fhir-0.4.2 | lib/lifen_fhir/channel.rb |