lifen 2.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +16 -16
- data/lib/lifen.rb +2 -2
- data/lib/lifen/communication_request.rb +2 -2
- data/lib/lifen/practitioner.rb +97 -0
- data/lib/lifen/user.rb +0 -78
- data/lib/lifen/version.rb +1 -1
- data/spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml +71 -0
- data/spec/cassettes/practitionner/create_channel/address/valid_attributes.yml +71 -0
- data/spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml +70 -0
- data/spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml +125 -0
- data/spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml +122 -0
- data/spec/cassettes/{communication/find/invalid_uuid.yml → practitionner/find_by_rpps/wrong_rpps.yml} +8 -10
- data/spec/communication_request_spec.rb +3 -3
- data/spec/practitionner_spec.rb +76 -0
- data/spec/user_spec.rb +0 -66
- metadata +17 -15
- data/lib/lifen/communication.rb +0 -92
- data/spec/cassettes/communication/find/valid_uuid.yml +0 -96
- data/spec/cassettes/communication/send/binary_and_content_string.yml +0 -75
- data/spec/cassettes/communication/send/binary_valid_attributes.yml +0 -74
- data/spec/cassettes/communication/send/valid_attributes.yml +0 -75
- data/spec/communication_spec.rb +0 -100
@@ -0,0 +1,70 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://develop.lifen.fr/fhir/Practitioner/11e5c85e-9bc0-4c6e-9b29-deb9993a92c0/$add-telecom
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"resourceType":"Practitioner","telecom":{"system":"fax","value":"+33102030405"}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.11.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Accept:
|
15
|
+
- application/json
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- Apache-Coyote/1.1
|
27
|
+
X-B3-Sampled:
|
28
|
+
- '1'
|
29
|
+
X-B3-Spanid:
|
30
|
+
- b68d00cd53303e01
|
31
|
+
X-B3-Traceid:
|
32
|
+
- b68d00cd53303e01
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Xss-Protection:
|
36
|
+
- 1; mode=block
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
Expires:
|
42
|
+
- '0'
|
43
|
+
X-Powered-By:
|
44
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
45
|
+
Content-Type:
|
46
|
+
- application/json+fhir;charset=UTF-8
|
47
|
+
Transfer-Encoding:
|
48
|
+
- chunked
|
49
|
+
Date:
|
50
|
+
- Fri, 19 May 2017 14:59:34 GMT
|
51
|
+
Connection:
|
52
|
+
- close
|
53
|
+
Access-Control-Allow-Credentials:
|
54
|
+
- 'true'
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: |-
|
58
|
+
{
|
59
|
+
"resourceType": "OperationOutcome",
|
60
|
+
"issue": [
|
61
|
+
{
|
62
|
+
"id": "11e73ca3-c56a-8e9b-b5c5-0242ac110002",
|
63
|
+
"severity": "information",
|
64
|
+
"diagnostics": "Fax created."
|
65
|
+
}
|
66
|
+
]
|
67
|
+
}
|
68
|
+
http_version:
|
69
|
+
recorded_at: Fri, 19 May 2017 14:59:04 GMT
|
70
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,125 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/fhir/Practitioner/?identifier=810004085790
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.11.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Accept:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
X-B3-Sampled:
|
26
|
+
- '1'
|
27
|
+
X-B3-Spanid:
|
28
|
+
- 6786028277bfd4e7
|
29
|
+
X-B3-Traceid:
|
30
|
+
- 6786028277bfd4e7
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
X-Xss-Protection:
|
34
|
+
- 1; mode=block
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
37
|
+
Pragma:
|
38
|
+
- no-cache
|
39
|
+
Expires:
|
40
|
+
- '0'
|
41
|
+
X-Powered-By:
|
42
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
43
|
+
Last-Modified:
|
44
|
+
- Fri, 19 May 2017 14:48:42 GMT
|
45
|
+
Content-Type:
|
46
|
+
- application/json+fhir;charset=UTF-8
|
47
|
+
Transfer-Encoding:
|
48
|
+
- chunked
|
49
|
+
Date:
|
50
|
+
- Fri, 19 May 2017 14:48:41 GMT
|
51
|
+
Connection:
|
52
|
+
- close
|
53
|
+
Access-Control-Allow-Credentials:
|
54
|
+
- 'true'
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: |-
|
58
|
+
{
|
59
|
+
"resourceType": "Bundle",
|
60
|
+
"id": "0e708d29-f29f-4378-a874-81c7a8579692",
|
61
|
+
"meta": {
|
62
|
+
"lastUpdated": "2017-05-19T14:48:42.087+00:00"
|
63
|
+
},
|
64
|
+
"type": "searchset",
|
65
|
+
"total": 1,
|
66
|
+
"link": [
|
67
|
+
{
|
68
|
+
"relation": "self",
|
69
|
+
"url": "http://rc.lifen.fr/fhir/Practitioner/?identifier=810004085790"
|
70
|
+
}
|
71
|
+
],
|
72
|
+
"entry": [
|
73
|
+
{
|
74
|
+
"fullUrl": "http://rc.lifen.fr/fhir/Practitioner/11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
75
|
+
"resource": {
|
76
|
+
"resourceType": "Practitioner",
|
77
|
+
"id": "11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
78
|
+
"identifier": [
|
79
|
+
{
|
80
|
+
"system": "http://honestica.com/fhir/identifier/fr/asip",
|
81
|
+
"value": "810004085790"
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"name": [
|
85
|
+
{
|
86
|
+
"text": "WILLIAM ECLANCHER",
|
87
|
+
"family": "ECLANCHER",
|
88
|
+
"given": [
|
89
|
+
"WILLIAM"
|
90
|
+
],
|
91
|
+
"prefix": [
|
92
|
+
"DR"
|
93
|
+
]
|
94
|
+
}
|
95
|
+
],
|
96
|
+
"telecom": [
|
97
|
+
{
|
98
|
+
"id": "11e61052-91cf-185b-8234-6accfa9deeee",
|
99
|
+
"system": "email",
|
100
|
+
"value": "William.ECLANCHER@medical75.apicrypt.org"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"id": "11e62721-8caa-da09-b2d8-6accfa9deeee",
|
104
|
+
"system": "email",
|
105
|
+
"value": "william.eclancher@medecin.mssante.fr"
|
106
|
+
}
|
107
|
+
],
|
108
|
+
"address": [
|
109
|
+
{
|
110
|
+
"id": "11e5c86e-adb9-5453-9b29-deb9993a92c0",
|
111
|
+
"line": [
|
112
|
+
"11 RUE CHARLES TELLIER"
|
113
|
+
],
|
114
|
+
"city": "Paris",
|
115
|
+
"postalCode": "75016",
|
116
|
+
"country": "FRANCE"
|
117
|
+
}
|
118
|
+
]
|
119
|
+
}
|
120
|
+
}
|
121
|
+
]
|
122
|
+
}
|
123
|
+
http_version:
|
124
|
+
recorded_at: Fri, 19 May 2017 14:48:11 GMT
|
125
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,122 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/fhir/Practitioner/?identifier=810004085790
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.11.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Accept:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
X-B3-Sampled:
|
26
|
+
- '1'
|
27
|
+
X-B3-Spanid:
|
28
|
+
- b3724b375a363665
|
29
|
+
X-B3-Traceid:
|
30
|
+
- b3724b375a363665
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
X-Xss-Protection:
|
34
|
+
- 1; mode=block
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
37
|
+
Pragma:
|
38
|
+
- no-cache
|
39
|
+
Expires:
|
40
|
+
- '0'
|
41
|
+
X-Powered-By:
|
42
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
43
|
+
Last-Modified:
|
44
|
+
- Fri, 19 May 2017 14:48:42 GMT
|
45
|
+
Content-Type:
|
46
|
+
- application/json+fhir;charset=UTF-8
|
47
|
+
Transfer-Encoding:
|
48
|
+
- chunked
|
49
|
+
Date:
|
50
|
+
- Fri, 19 May 2017 14:48:41 GMT
|
51
|
+
Connection:
|
52
|
+
- close
|
53
|
+
Access-Control-Allow-Credentials:
|
54
|
+
- 'true'
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: |-
|
58
|
+
{
|
59
|
+
"resourceType": "Bundle",
|
60
|
+
"id": "b7a03b48-612d-44aa-bacd-05f4f05b8d89",
|
61
|
+
"meta": {
|
62
|
+
"lastUpdated": "2017-05-19T14:48:42.500+00:00"
|
63
|
+
},
|
64
|
+
"type": "searchset",
|
65
|
+
"total": 1,
|
66
|
+
"link": [
|
67
|
+
{
|
68
|
+
"relation": "self",
|
69
|
+
"url": "http://rc.lifen.fr/fhir/Practitioner/?identifier=810004085790"
|
70
|
+
}
|
71
|
+
],
|
72
|
+
"entry": [
|
73
|
+
{
|
74
|
+
"fullUrl": "http://rc.lifen.fr/fhir/Practitioner/11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
75
|
+
"resource": {
|
76
|
+
"resourceType": "Practitioner",
|
77
|
+
"id": "11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
78
|
+
"identifier": [
|
79
|
+
{
|
80
|
+
"system": "http://honestica.com/fhir/identifier/fr/asip",
|
81
|
+
"value": "810004085790"
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"name": [
|
85
|
+
{
|
86
|
+
"text": "WILLIAM ECLANCHER",
|
87
|
+
"family": "ECLANCHER",
|
88
|
+
"given": [
|
89
|
+
"WILLIAM"
|
90
|
+
],
|
91
|
+
"prefix": [
|
92
|
+
"DR"
|
93
|
+
]
|
94
|
+
}
|
95
|
+
],
|
96
|
+
"telecom": [
|
97
|
+
{
|
98
|
+
"id": "11e61052-91cf-185b-8234-6accfa9deeee",
|
99
|
+
"system": "email",
|
100
|
+
"value": "William.ECLANCHER@medical75.apicrypt.org"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"id": "11e62721-8caa-da09-b2d8-6accfa9deeee",
|
104
|
+
"system": "email",
|
105
|
+
"value": "william.eclancher@medecin.mssante.fr"
|
106
|
+
}
|
107
|
+
],
|
108
|
+
"address": [
|
109
|
+
{
|
110
|
+
"id": "11e5c86e-adb9-5453-9b29-deb9993a92c0",
|
111
|
+
"city": "Paris",
|
112
|
+
"postalCode": "75016",
|
113
|
+
"country": "FRANCE"
|
114
|
+
}
|
115
|
+
]
|
116
|
+
}
|
117
|
+
}
|
118
|
+
]
|
119
|
+
}
|
120
|
+
http_version:
|
121
|
+
recorded_at: Fri, 19 May 2017 14:48:12 GMT
|
122
|
+
recorded_with: VCR 3.0.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://develop.lifen.fr/fhir/
|
5
|
+
uri: https://develop.lifen.fr/fhir/Practitioner/?identifier=8888888888
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: "{}"
|
@@ -11,8 +11,6 @@ http_interactions:
|
|
11
11
|
- Faraday v0.11.0
|
12
12
|
Authorization:
|
13
13
|
- Bearer valid_application_access_token
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
14
|
Accept:
|
17
15
|
- application/json
|
18
16
|
Accept-Encoding:
|
@@ -27,9 +25,9 @@ http_interactions:
|
|
27
25
|
X-B3-Sampled:
|
28
26
|
- '1'
|
29
27
|
X-B3-Spanid:
|
30
|
-
-
|
28
|
+
- a02774f0dfc94452
|
31
29
|
X-B3-Traceid:
|
32
|
-
-
|
30
|
+
- a02774f0dfc94452
|
33
31
|
X-Content-Type-Options:
|
34
32
|
- nosniff
|
35
33
|
X-Xss-Protection:
|
@@ -41,13 +39,13 @@ http_interactions:
|
|
41
39
|
Expires:
|
42
40
|
- '0'
|
43
41
|
X-Powered-By:
|
44
|
-
- HAPI FHIR 2.
|
42
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
45
43
|
Content-Type:
|
46
44
|
- application/json+fhir;charset=UTF-8
|
47
45
|
Transfer-Encoding:
|
48
46
|
- chunked
|
49
47
|
Date:
|
50
|
-
- Fri,
|
48
|
+
- Fri, 19 May 2017 15:35:06 GMT
|
51
49
|
Connection:
|
52
50
|
- close
|
53
51
|
Access-Control-Allow-Credentials:
|
@@ -60,11 +58,11 @@ http_interactions:
|
|
60
58
|
"issue": [
|
61
59
|
{
|
62
60
|
"severity": "error",
|
63
|
-
"code": "
|
64
|
-
"diagnostics": "
|
61
|
+
"code": "processing",
|
62
|
+
"diagnostics": "Failed to find practitioner from system"
|
65
63
|
}
|
66
64
|
]
|
67
65
|
}
|
68
66
|
http_version:
|
69
|
-
recorded_at: Fri,
|
67
|
+
recorded_at: Fri, 19 May 2017 15:34:36 GMT
|
70
68
|
recorded_with: VCR 3.0.3
|
@@ -6,10 +6,10 @@ describe Lifen::CommunicationRequest do
|
|
6
6
|
let(:medium1) { Lifen::Medium.new(uuid: "valid-medium-uuid-1") } #valid_channel_uuid
|
7
7
|
let(:medium2) { Lifen::Medium.new(uuid: "valid-medium-uuid-2") }
|
8
8
|
|
9
|
-
let(:sender) { Lifen::
|
9
|
+
let(:sender) { Lifen::Practitioner.new(uuid: "valid-sender-uuid") } #valid_sender_uuid
|
10
10
|
|
11
|
-
let(:recipient1) { Lifen::
|
12
|
-
let(:recipient2) { Lifen::
|
11
|
+
let(:recipient1) { Lifen::Practitioner.new(uuid: "valid-recipient-uuid-1") }
|
12
|
+
let(:recipient2) { Lifen::Practitioner.new(uuid: "valid-recipient-uuid-2") }#valid_recipient_uuid
|
13
13
|
|
14
14
|
let(:binary) { Lifen::Binary.new(uuid: "valid-binary-uuid") }
|
15
15
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lifen::Practitioner do
|
4
|
+
|
5
|
+
describe ':find_by_rpps' do
|
6
|
+
|
7
|
+
|
8
|
+
it 'finds the practitionners' do
|
9
|
+
VCR.use_cassette "practitionner/find_by_rpps/existing_rpps" do
|
10
|
+
@practitionner = Lifen::Practitioner.find_by_rpps("810004085790")
|
11
|
+
end
|
12
|
+
|
13
|
+
expect(@practitionner.channels.size).to eq(3)
|
14
|
+
|
15
|
+
address = @practitionner.channels.last
|
16
|
+
|
17
|
+
expect(address.value).to eq "11 RUE CHARLES TELLIER, 75016 Paris"
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'cannot find rpps' do
|
21
|
+
VCR.use_cassette "practitionner/find_by_rpps/wrong_rpps" do
|
22
|
+
expect { @practitionner = Lifen::Practitioner.find_by_rpps("8888888888") }.to raise_error Lifen::Error
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'missing lines attribute' do
|
29
|
+
|
30
|
+
it 'does not raise an issue' do
|
31
|
+
VCR.use_cassette "practitionner/find_by_rpps/missing_line_attribute" do
|
32
|
+
@practitionner = Lifen::Practitioner.find_by_rpps("810004085790")
|
33
|
+
end
|
34
|
+
|
35
|
+
address = @practitionner.channels.last
|
36
|
+
|
37
|
+
expect(address.value).to eq ", 75016 Paris"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ':create_address' do
|
42
|
+
|
43
|
+
let(:practitionner) { Lifen::Practitioner.new(uuid: "11e5c85e-9bc0-4c6e-9b29-deb9993a92c0") }
|
44
|
+
|
45
|
+
it 'creates the address' do
|
46
|
+
VCR.use_cassette "practitionner/create_channel/address/valid_attributes" do
|
47
|
+
@channel = practitionner.create_address(type: "address", lines: ["Honestica", "39 rue d'Aboukir"], city: "Paris", postal_code: "75002", country: "France")
|
48
|
+
end
|
49
|
+
|
50
|
+
expect(@channel.value).to eq "Honestica, 39 rue d'Aboukir, 75002 Paris"
|
51
|
+
expect(@channel.uuid).to eq "11e73ca3-c4b2-fe69-b5c5-0242ac110002"
|
52
|
+
expect(practitionner.channels.size).to eq 1
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'creates the channel - old version' do
|
56
|
+
VCR.use_cassette "practitionner/create_channel/address/old_valid_attributes" do
|
57
|
+
@channel = practitionner.create_address(type: "address", lines: ["Honestica", "39 rue d'Aboukir"], city: "Paris", postal_code: "75002", country: "France")
|
58
|
+
end
|
59
|
+
|
60
|
+
expect(@channel.value).to eq "Honestica, 39 rue d'Aboukir, 75002 Paris"
|
61
|
+
expect(@channel.uuid).to eq "11e73ca4-e3d4-8c5f-b5c5-0242ac110002"
|
62
|
+
expect(practitionner.channels.size).to eq 1
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'creates the telecom-fax channel' do
|
66
|
+
VCR.use_cassette "practitionner/create_channel/telecom/valid_attributes" do
|
67
|
+
@channel = practitionner.create_telecom(type: "telecom", system: "fax", value: "+33102030405")
|
68
|
+
end
|
69
|
+
|
70
|
+
expect(@channel.uuid).to eq "11e73ca3-c56a-8e9b-b5c5-0242ac110002"
|
71
|
+
expect(practitionner.channels.size).to eq 1
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
end
|