28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/lifen/communication.rb', line 28
def self.find(uuid)
json = application_client.get("fhir/Communication/#{uuid}")
resource_type = json["resourceType"]
raise Error, "Invalid resourceType (#{resource_type})" if resource_type != "Communication"
attributes = {}
attributes[:uuid] = json["id"]
attributes[:status] = json["status"]
attributes[:sent_at] = json["sent"]
attributes[:received_at] = json["received"]
attributes[:sender] = User.from_json(json["sender"])
attributes[:recipient] = User.from_json(Array(json["recipient"]).first)
new(attributes)
end
|