module Lifen module Communication class Channel < Lifen::Base attribute :uuid, String attribute :type, String attribute :value, String def fhir_payload(user) { id: user.uuid, resourceType: "Practitioner", type => [ { id: uuid } ] } end def self.from_json(json, type = nil) new(uuid: json["id"], type: type, value: json["value"] || json["line"][0]) end end end end