class Lifen::Channel

Public Class Methods

from_json(json, type = nil) click to toggle source
# File lib/lifen/channel.rb, line 26
def self.from_json(json, type = nil)
  new(uuid: json["id"], type: type, value: json["value"] || "#{Array(json["line"]).join(", ")}, #{json["postalCode"]} #{json["city"]}")
end

Public Instance Methods

fhir_payload(user) click to toggle source
# File lib/lifen/channel.rb, line 8
def fhir_payload(user)
  raise Lifen::Error, "Invalid channel: an UUID is required" if !valid?

  {
    id: user.uuid,
    resourceType: "Practitioner",
    type => [
      {
        id: uuid
      }
    ]
  }
end
valid?() click to toggle source
# File lib/lifen/channel.rb, line 22
def valid?
  uuid and uuid.length != 0
end