lifen_fhir 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/lifen_fhir/patient.rb +2 -6
- data/lib/lifen_fhir/version.rb +1 -1
- data/spec/cassettes/communication_request/send/invalid_medium.yml +1 -1
- data/spec/cassettes/communication_request/send/patient/valid_attributes_binary.yml +7 -5
- data/spec/cassettes/communication_request/send/valid_attributes.yml +1 -1
- data/spec/cassettes/communication_request/send/valid_attributes_binary.yml +1 -1
- data/spec/communication_request_spec.rb +34 -34
- data/spec/spec_helper.rb +2 -0
- metadata +2 -2
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://develop.lifen.fr/fhir/CommunicationRequest
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"resourceType":"CommunicationRequest","sender":[{"reference":"Practitioner/valid-sender-uuid"}],"recipient":[{"reference":"Practitioner/valid-recipient-uuid-1"},{"reference":"Practitioner/valid-recipient-uuid-2"}],"contained":[{"id":"patient","resourceType":"Patient","name":[{"family":
|
8
|
+
string: '{"resourceType":"CommunicationRequest","sender":[{"reference":"Practitioner/valid-sender-uuid"}],"recipient":[{"reference":"Practitioner/valid-recipient-uuid-1"},{"reference":"Practitioner/valid-recipient-uuid-2"}],"contained":[{"id":"patient","resourceType":"Patient","name":[{"family":"Dupond","given":["Jean"]}],"birthDate":"2000-01-01"}],"medium":[{"coding":[{"id":"valid-medium-uuid-1"}]},{"coding":[{"id":"valid-medium-uuid-2"}]}],"category":[{"coding":[{"system":"http://honestica.com/fhir/communication/category","code":"MEDICAL_REPORT"}]}],"payload":[{"contentReference":{"reference":"Binary/valid-binary-uuid"}}],"subject":[{"reference":"patient"}]}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.11.0
|
@@ -15,64 +15,64 @@ describe LifenFhir::CommunicationRequest do
|
|
15
15
|
|
16
16
|
let(:attachment) { LifenFhir::Attachment.new(title: "Master Plan", path: File.dirname(__FILE__) + "/support/master_plan.pdf", content_type: "application/pdf") }
|
17
17
|
|
18
|
-
|
18
|
+
let(:patient) { LifenFhir::Patient.new(uuid: "valid-patient-id", first_name: "Jean", last_name: "Dupond", birth_date: Date.new(2000,1,1)) }
|
19
19
|
|
20
|
-
|
20
|
+
let(:invalid_patient) { LifenFhir::Patient.new(uuid: "invalid-patient-id", first_name: "Jean", last_name: "Dupond", birth_date: Date.new(2000,1,1)) }
|
21
21
|
|
22
|
-
|
22
|
+
describe ':send multi-recipients with a binary' do
|
23
23
|
|
24
|
-
|
24
|
+
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [medium1, medium2], binary: binary, patient: patient) }
|
25
25
|
|
26
|
+
it 'works' do
|
27
|
+
VCR.use_cassette "communication_request/send/valid_attributes_binary" do
|
28
|
+
communication_request.send
|
29
|
+
end
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
communication_request.send
|
31
|
+
expect(communication_request.uuid).to_not be_nil
|
32
|
+
expect(communication_request.number_communications).to eq(2)
|
30
33
|
end
|
31
34
|
|
32
|
-
expect(communication_request.uuid).to_not be_nil
|
33
|
-
expect(communication_request.number_communications).to eq(2)
|
34
35
|
end
|
35
36
|
|
36
|
-
end
|
37
37
|
|
38
|
+
describe ':send to patient with a binary' do
|
38
39
|
|
39
|
-
|
40
|
-
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: patient, recipients: [patient], binary: binary) }
|
40
|
+
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [patient], binary: binary) }
|
41
41
|
|
42
|
-
|
42
|
+
it 'works' do
|
43
|
+
VCR.use_cassette "communication_request/send/patient/valid_attributes_binary" do
|
44
|
+
communication_request.send
|
45
|
+
end
|
43
46
|
|
44
|
-
|
45
|
-
|
46
|
-
communication_request.send
|
47
|
+
expect(communication_request.uuid).to_not be_nil
|
48
|
+
expect(communication_request.number_communications).to eq(1)
|
47
49
|
end
|
48
50
|
|
49
|
-
|
50
|
-
expect(communication_request.number_communications).to eq(1)
|
51
|
-
end
|
51
|
+
let(:wrong_communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [invalid_patient], binary: binary) }
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
it 'does not work' do
|
54
|
+
VCR.use_cassette "communication_request/send/patient/invalid_attributes_binary" do
|
55
|
+
expect{wrong_communication_request.send}.to raise_error LifenFhir::Error
|
56
|
+
end
|
56
57
|
end
|
57
58
|
end
|
58
|
-
end
|
59
59
|
|
60
|
-
|
60
|
+
describe ':send to patient and practitioner with a binary' do
|
61
61
|
|
62
|
-
|
62
|
+
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, patient], binary: binary, medium: [medium1]) }
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
it 'works' do
|
65
|
+
VCR.use_cassette("communication_request/send/to_patient_also") do
|
66
|
+
communication_request.send
|
67
|
+
end
|
68
68
|
|
69
|
-
|
70
|
-
|
69
|
+
expect(communication_request.uuid).to_not be_nil
|
70
|
+
expect(communication_request.number_communications).to eq(2)
|
71
|
+
end
|
71
72
|
end
|
72
|
-
end
|
73
73
|
|
74
74
|
|
75
|
-
|
75
|
+
describe ':send multi-recipients with an attachment' do
|
76
76
|
|
77
77
|
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [medium1, medium2], attachment: attachment, patient: patient) }
|
78
78
|
|
@@ -89,7 +89,7 @@ describe LifenFhir::CommunicationRequest do
|
|
89
89
|
|
90
90
|
describe 'invalid medium' do
|
91
91
|
|
92
|
-
let(:invalid_medium)
|
92
|
+
let(:invalid_medium) { LifenFhir::Medium.new(uuid: "invalid-medium-uuid") }
|
93
93
|
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [invalid_medium, medium2], binary: binary, patient: patient) }
|
94
94
|
|
95
95
|
it 'raises an error' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifen_fhir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonard Sellam
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|