lifen_fhir 0.2.0 → 0.3.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 +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/lifen_fhir/binary.rb +10 -0
- data/lib/lifen_fhir/communication_request.rb +56 -33
- data/lib/lifen_fhir/version.rb +1 -1
- data/spec/cassettes/communication_request/find_by_uuid/invalid_uuid.yml +60 -0
- data/spec/cassettes/communication_request/find_by_uuid/valid_uuid_with_a_status.yml +93 -0
- data/spec/cassettes/communication_request/find_by_uuid/valid_uuid_with_no_status.yml +92 -0
- data/spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml +2 -2
- data/spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml +2 -2
- data/spec/communication_request_spec.rb +69 -26
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6e9cc27391f2a2ca45aa80e3c7577d345d5f265
|
4
|
+
data.tar.gz: 7c6ed9d68019892246b3412125f874ade9ba23d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021a874fee8606735c51be90303a45ca69750c01b854b390fdc9780799cbd3e13ab889ccdf42adfbc28874210fc0fae82dec74971092b0f12dc2795b17f7b553
|
7
|
+
data.tar.gz: afe404699c29e053bca25206788026902f609005d2575f85c83b74aa34ebdb809b13dde914ae03850d5ac598b588795db6a9be29eafe5b90757c7262de6ac0c4
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -47,7 +47,7 @@ binary = LifenFhir::Binary.new(uuid: "b7c7dae671b93e951ce6a4f530736276")
|
|
47
47
|
binary.download
|
48
48
|
```
|
49
49
|
|
50
|
-
### Communication
|
50
|
+
### Managing Communication Requests
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
sender = LifenFhir::Practitioner.find_by_rpps("899900018483")
|
@@ -61,6 +61,7 @@ communication_request = LifenFhir::CommunicationRequest.new(sender: sender, reci
|
|
61
61
|
|
62
62
|
communication_request.send
|
63
63
|
|
64
|
+
communication_request = LifenFhir::CommunicationRequest.find_by_uuid("b77d-ae67-1b9e-951c-af54")
|
64
65
|
```
|
65
66
|
|
66
67
|
#### Communication Request with multiple recipients
|
data/lib/lifen_fhir/binary.rb
CHANGED
@@ -15,6 +15,16 @@ module LifenFhir
|
|
15
15
|
application_client.get("fhir/#{reference}", { accept: "application/pdf" })
|
16
16
|
end
|
17
17
|
|
18
|
+
def attributes_from_json(json)
|
19
|
+
first_binary = Array(json).first
|
20
|
+
|
21
|
+
reference = first_binary["contentReference"]["reference"]
|
22
|
+
|
23
|
+
self.uuid = reference.gsub('Binary/', '')
|
24
|
+
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
18
28
|
private
|
19
29
|
|
20
30
|
def application_client
|
@@ -14,6 +14,8 @@ module LifenFhir
|
|
14
14
|
attribute :binary, LifenFhir::Binary
|
15
15
|
attribute :content_string, LifenFhir::ContentString
|
16
16
|
|
17
|
+
attribute :status, String
|
18
|
+
|
17
19
|
def send
|
18
20
|
json = application_client.post("fhir/CommunicationRequest", fhir_payload)
|
19
21
|
|
@@ -23,45 +25,66 @@ module LifenFhir
|
|
23
25
|
self
|
24
26
|
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
def fhir_payload
|
29
|
-
|
30
|
-
payload = {
|
31
|
-
resourceType: "CommunicationRequest",
|
32
|
-
sender: [ sender.fhir_payload ],
|
33
|
-
recipient: recipients.map(&:fhir_payload),
|
34
|
-
contained: [],
|
35
|
-
medium: medium.map(&:fhir_payload) ,
|
36
|
-
category: [ category.fhir_payload],
|
37
|
-
payload: [ document_content ]
|
38
|
-
}
|
39
|
-
|
40
|
-
if patient
|
41
|
-
payload[:contained] << patient.fhir_payload
|
42
|
-
payload[:subject] = [
|
43
|
-
{reference: "patient"}
|
44
|
-
]
|
45
|
-
end
|
28
|
+
def self.find_by_uuid(uuid)
|
29
|
+
json = application_client.get("fhir/CommunicationRequest/#{uuid}")
|
46
30
|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
31
|
+
communication_request = new
|
32
|
+
communication_request.attributes_from_json(json)
|
50
33
|
|
51
|
-
|
34
|
+
communication_request
|
52
35
|
end
|
53
36
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
binary.fhir_payload
|
59
|
-
end
|
60
|
-
end
|
37
|
+
def attributes_from_json(json)
|
38
|
+
self.uuid = json["id"]
|
39
|
+
|
40
|
+
self.status = json.fetch("status") { "unknown" }
|
61
41
|
|
62
|
-
|
63
|
-
@application_client ||= AppAuthenticatedClient.new
|
42
|
+
self.binary = Binary.new.attributes_from_json(json["payload"])
|
64
43
|
end
|
65
44
|
|
45
|
+
private
|
46
|
+
|
47
|
+
def fhir_payload
|
48
|
+
|
49
|
+
payload = {
|
50
|
+
resourceType: "CommunicationRequest",
|
51
|
+
sender: [ sender.fhir_payload ],
|
52
|
+
recipient: recipients.map(&:fhir_payload),
|
53
|
+
contained: [],
|
54
|
+
medium: medium.map(&:fhir_payload) ,
|
55
|
+
category: [ category.fhir_payload],
|
56
|
+
payload: [ document_content ]
|
57
|
+
}
|
58
|
+
|
59
|
+
if patient
|
60
|
+
payload[:contained] << patient.fhir_payload
|
61
|
+
payload[:subject] = [
|
62
|
+
{reference: "patient"}
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
if content_string
|
67
|
+
payload[:payload] << content_string.fhir_payload
|
68
|
+
end
|
69
|
+
|
70
|
+
payload
|
71
|
+
end
|
72
|
+
|
73
|
+
def document_content
|
74
|
+
if !attachment.nil?
|
75
|
+
attachment.fhir_payload
|
76
|
+
else
|
77
|
+
binary.fhir_payload
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def application_client
|
82
|
+
@application_client ||= AppAuthenticatedClient.new
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.application_client
|
86
|
+
@application_client ||= AppAuthenticatedClient.new
|
87
|
+
end
|
88
|
+
|
66
89
|
end
|
67
90
|
end
|
data/lib/lifen_fhir/version.rb
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/fhir/CommunicationRequest/invalid_uuid
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.12.1
|
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: 404
|
21
|
+
message: Not Found
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
X-Content-Type-Options:
|
26
|
+
- nosniff
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
31
|
+
Pragma:
|
32
|
+
- no-cache
|
33
|
+
Expires:
|
34
|
+
- '0'
|
35
|
+
X-Powered-By:
|
36
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
37
|
+
Content-Type:
|
38
|
+
- application/json+fhir;charset=UTF-8
|
39
|
+
Transfer-Encoding:
|
40
|
+
- chunked
|
41
|
+
Date:
|
42
|
+
- Wed, 31 May 2017 12:59:23 GMT
|
43
|
+
Access-Control-Allow-Credentials:
|
44
|
+
- 'true'
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: |-
|
48
|
+
{
|
49
|
+
"resourceType": "OperationOutcome",
|
50
|
+
"issue": [
|
51
|
+
{
|
52
|
+
"severity": "error",
|
53
|
+
"code": "processing",
|
54
|
+
"diagnostics": "Resource CommunicationRequest/invalid_uuid is not known"
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}
|
58
|
+
http_version:
|
59
|
+
recorded_at: Wed, 31 May 2017 12:59:01 GMT
|
60
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,93 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/fhir/CommunicationRequest/2d217345-6ce8-4412-a03d-076a37c6661a
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.12.1
|
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-Content-Type-Options:
|
26
|
+
- nosniff
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
31
|
+
Pragma:
|
32
|
+
- no-cache
|
33
|
+
Expires:
|
34
|
+
- '0'
|
35
|
+
X-Powered-By:
|
36
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
37
|
+
Location:
|
38
|
+
- https://develop.lifen.fr/fhir/CommunicationRequest/2d217345-6ce8-4412-a03d-076a37c6661a
|
39
|
+
Content-Type:
|
40
|
+
- application/json+fhir;charset=UTF-8
|
41
|
+
Transfer-Encoding:
|
42
|
+
- chunked
|
43
|
+
Date:
|
44
|
+
- Wed, 31 May 2017 13:07:15 GMT
|
45
|
+
Access-Control-Allow-Credentials:
|
46
|
+
- 'true'
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: |-
|
50
|
+
{
|
51
|
+
"resourceType": "CommunicationRequest",
|
52
|
+
"id": "2d217345-6ce8-4412-a03d-076a37c6661a",
|
53
|
+
"contained": [
|
54
|
+
{
|
55
|
+
"resourceType": "Practitioner",
|
56
|
+
"id": "11e5b841-4ff8-2dbb-9643-eabb809fa654",
|
57
|
+
"telecom": [
|
58
|
+
{
|
59
|
+
"id": "ddb5496a-d1cb-49e5-bd83-361583448410"
|
60
|
+
}
|
61
|
+
]
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"category": [
|
65
|
+
{
|
66
|
+
"coding": [
|
67
|
+
{
|
68
|
+
"system": "http://honestica.com/fhir/communication/category",
|
69
|
+
"code": "MEDICAL_REPORT"
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
73
|
+
],
|
74
|
+
"recipient": [
|
75
|
+
{
|
76
|
+
"reference": "#11e5b841-4ff8-2dbb-9643-eabb809fa654"
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"payload": [
|
80
|
+
{
|
81
|
+
"contentReference": {
|
82
|
+
"reference": "Binary/11e7317b-d85e-5aa9-bdf4-0242ac110004"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
],
|
86
|
+
"sender": {
|
87
|
+
"reference": "11e5b841-4ff1-2dbb-9643-eabb809fa654"
|
88
|
+
},
|
89
|
+
"status": "cancelled"
|
90
|
+
}
|
91
|
+
http_version:
|
92
|
+
recorded_at: Wed, 31 May 2017 13:06:54 GMT
|
93
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,92 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/fhir/CommunicationRequest/2d217345-6ce8-4412-a03d-076a37c6661a
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.12.1
|
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-Content-Type-Options:
|
26
|
+
- nosniff
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
31
|
+
Pragma:
|
32
|
+
- no-cache
|
33
|
+
Expires:
|
34
|
+
- '0'
|
35
|
+
X-Powered-By:
|
36
|
+
- HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
|
37
|
+
Location:
|
38
|
+
- https://develop.lifen.fr/fhir/CommunicationRequest/2d217345-6ce8-4412-a03d-076a37c6661a
|
39
|
+
Content-Type:
|
40
|
+
- application/json+fhir;charset=UTF-8
|
41
|
+
Transfer-Encoding:
|
42
|
+
- chunked
|
43
|
+
Date:
|
44
|
+
- Wed, 31 May 2017 13:07:15 GMT
|
45
|
+
Access-Control-Allow-Credentials:
|
46
|
+
- 'true'
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: |-
|
50
|
+
{
|
51
|
+
"resourceType": "CommunicationRequest",
|
52
|
+
"id": "2d217345-6ce8-4412-a03d-076a37c6661a",
|
53
|
+
"contained": [
|
54
|
+
{
|
55
|
+
"resourceType": "Practitioner",
|
56
|
+
"id": "11e5b841-4ff8-2dbb-9643-eabb809fa654",
|
57
|
+
"telecom": [
|
58
|
+
{
|
59
|
+
"id": "ddb5496a-d1cb-49e5-bd83-361583448410"
|
60
|
+
}
|
61
|
+
]
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"category": [
|
65
|
+
{
|
66
|
+
"coding": [
|
67
|
+
{
|
68
|
+
"system": "http://honestica.com/fhir/communication/category",
|
69
|
+
"code": "MEDICAL_REPORT"
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
73
|
+
],
|
74
|
+
"recipient": [
|
75
|
+
{
|
76
|
+
"reference": "#11e5b841-4ff8-2dbb-9643-eabb809fa654"
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"payload": [
|
80
|
+
{
|
81
|
+
"contentReference": {
|
82
|
+
"reference": "Binary/11e7317b-d85e-5aa9-bdf4-0242ac110004"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
],
|
86
|
+
"sender": {
|
87
|
+
"reference": "11e5b841-4ff1-2dbb-9643-eabb809fa654"
|
88
|
+
}
|
89
|
+
}
|
90
|
+
http_version:
|
91
|
+
recorded_at: Wed, 31 May 2017 13:06:53 GMT
|
92
|
+
recorded_with: VCR 3.0.3
|
@@ -66,12 +66,12 @@ http_interactions:
|
|
66
66
|
"link": [
|
67
67
|
{
|
68
68
|
"relation": "self",
|
69
|
-
"url": "
|
69
|
+
"url": "https://develop.lifen.fr/fhir/Practitioner/?identifier=810004085790"
|
70
70
|
}
|
71
71
|
],
|
72
72
|
"entry": [
|
73
73
|
{
|
74
|
-
"fullUrl": "
|
74
|
+
"fullUrl": "https://develop.lifen.fr/fhir/Practitioner/11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
75
75
|
"resource": {
|
76
76
|
"resourceType": "Practitioner",
|
77
77
|
"id": "11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
@@ -66,12 +66,12 @@ http_interactions:
|
|
66
66
|
"link": [
|
67
67
|
{
|
68
68
|
"relation": "self",
|
69
|
-
"url": "
|
69
|
+
"url": "https://develop.lifen.fr/fhir/Practitioner/?identifier=810004085790"
|
70
70
|
}
|
71
71
|
],
|
72
72
|
"entry": [
|
73
73
|
{
|
74
|
-
"fullUrl": "
|
74
|
+
"fullUrl": "https://develop.lifen.fr/fhir/Practitioner/11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
75
75
|
"resource": {
|
76
76
|
"resourceType": "Practitioner",
|
77
77
|
"id": "11e5c86b-e4ba-eee4-9b29-deb9993a92c0",
|
@@ -2,52 +2,53 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe LifenFhir::CommunicationRequest do
|
4
4
|
|
5
|
+
context ':send' do
|
6
|
+
let(:medium1) { LifenFhir::Medium.new(uuid: "valid-medium-uuid-1") } #valid_channel_uuid
|
7
|
+
let(:medium2) { LifenFhir::Medium.new(uuid: "valid-medium-uuid-2") }
|
5
8
|
|
6
|
-
|
7
|
-
let(:medium2) { LifenFhir::Medium.new(uuid: "valid-medium-uuid-2") }
|
9
|
+
let(:sender) { LifenFhir::Practitioner.new(uuid: "valid-sender-uuid") } #valid_sender_uuid
|
8
10
|
|
9
|
-
|
11
|
+
let(:recipient1) { LifenFhir::Practitioner.new(uuid: "valid-recipient-uuid-1") }
|
12
|
+
let(:recipient2) { LifenFhir::Practitioner.new(uuid: "valid-recipient-uuid-2") }#valid_recipient_uuid
|
10
13
|
|
11
|
-
|
12
|
-
let(:recipient2) { LifenFhir::Practitioner.new(uuid: "valid-recipient-uuid-2") }#valid_recipient_uuid
|
14
|
+
let(:binary) { LifenFhir::Binary.new(uuid: "valid-binary-uuid") }
|
13
15
|
|
14
|
-
|
16
|
+
let(:attachment) { LifenFhir::Attachment.new(title: "Master Plan", path: File.dirname(__FILE__) + "/support/master_plan.pdf", content_type: "application/pdf") }
|
15
17
|
|
16
|
-
|
18
|
+
let(:patient) { LifenFhir::Patient.new(first_name: "Jean", last_name: "Dupond", birth_date: Date.new(2000,1,1)) }
|
17
19
|
|
18
|
-
|
20
|
+
describe ':send multi-recipients with a binary' do
|
19
21
|
|
22
|
+
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [medium1, medium2], binary: binary, patient: patient) }
|
20
23
|
|
24
|
+
it 'works' do
|
25
|
+
VCR.use_cassette "communication_request/send/valid_attributes_binary" do
|
26
|
+
communication_request.send
|
27
|
+
end
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [medium1, medium2], binary: binary, patient: patient) }
|
25
|
-
|
26
|
-
it 'works' do
|
27
|
-
VCR.use_cassette "communication_request/send/valid_attributes_binary" do
|
28
|
-
communication_request.send
|
29
|
+
expect(communication_request.uuid).to_not be_nil
|
30
|
+
expect(communication_request.number_communications).to eq(2)
|
29
31
|
end
|
30
32
|
|
31
|
-
expect(communication_request.uuid).to_not be_nil
|
32
|
-
expect(communication_request.number_communications).to eq(2)
|
33
33
|
end
|
34
|
-
end
|
35
34
|
|
36
|
-
|
35
|
+
describe ':send multi-recipients with an attachment' do
|
37
36
|
|
38
|
-
|
37
|
+
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [medium1, medium2], attachment: attachment, patient: patient) }
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
it 'works' do
|
40
|
+
VCR.use_cassette "communication_request/send/valid_attributes" do
|
41
|
+
communication_request.send
|
42
|
+
end
|
43
|
+
|
44
|
+
expect(communication_request.uuid).to_not be_nil
|
45
|
+
expect(communication_request.number_communications).to eq(2)
|
43
46
|
end
|
44
47
|
|
45
|
-
expect(communication_request.uuid).to_not be_nil
|
46
|
-
expect(communication_request.number_communications).to eq(2)
|
47
48
|
end
|
48
|
-
end
|
49
49
|
|
50
50
|
describe 'invalid medium' do
|
51
|
+
|
51
52
|
let(:invalid_medium) { LifenFhir::Medium.new(uuid: "invalid-medium-uuid") }
|
52
53
|
let(:communication_request) { LifenFhir::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [invalid_medium, medium2], binary: binary, patient: patient) }
|
53
54
|
|
@@ -59,6 +60,48 @@ describe LifenFhir::CommunicationRequest do
|
|
59
60
|
}.to raise_error LifenFhir::Error
|
60
61
|
end
|
61
62
|
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
context ':find_by_uuid' do
|
69
|
+
|
70
|
+
it 'works' do
|
71
|
+
|
72
|
+
VCR.use_cassette "communication_request/find_by_uuid/valid_uuid_with_no_status" do
|
73
|
+
@communication_request = LifenFhir::CommunicationRequest.find_by_uuid("2d217345-6ce8-4412-a03d-076a37c6661a")
|
74
|
+
end
|
75
|
+
|
76
|
+
expect(@communication_request.status).to eq "unknown"
|
77
|
+
expect(@communication_request.binary.uuid).to eq "11e7317b-d85e-5aa9-bdf4-0242ac110004"
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with a cancelled status' do
|
82
|
+
it 'works' do
|
83
|
+
|
84
|
+
VCR.use_cassette "communication_request/find_by_uuid/valid_uuid_with_a_status" do
|
85
|
+
@communication_request = LifenFhir::CommunicationRequest.find_by_uuid("2d217345-6ce8-4412-a03d-076a37c6661a")
|
86
|
+
end
|
87
|
+
|
88
|
+
expect(@communication_request.status).to eq "cancelled"
|
89
|
+
|
90
|
+
end
|
62
91
|
end
|
63
92
|
|
93
|
+
context 'with invalid uuid' do
|
94
|
+
|
95
|
+
it 'raises an error' do
|
96
|
+
expect{
|
97
|
+
VCR.use_cassette "communication_request/find_by_uuid/invalid_uuid" do
|
98
|
+
@communication_request = LifenFhir::CommunicationRequest.find_by_uuid("invalid_uuid")
|
99
|
+
end
|
100
|
+
}.to raise_error LifenFhir::Error, "Error 404, Page not found, App Client, GET 'https://develop.lifen.fr/fhir/CommunicationRequest/invalid_uuid' with params '{}' and bearer 'valid_application_access******'"
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
64
107
|
end
|
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
|
+
version: 0.3.0
|
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-05-
|
12
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -175,6 +175,9 @@ files:
|
|
175
175
|
- spec/binary_spec.rb
|
176
176
|
- spec/cassettes/binary/download/invalid.yml
|
177
177
|
- spec/cassettes/binary/download/valid.yml
|
178
|
+
- spec/cassettes/communication_request/find_by_uuid/invalid_uuid.yml
|
179
|
+
- spec/cassettes/communication_request/find_by_uuid/valid_uuid_with_a_status.yml
|
180
|
+
- spec/cassettes/communication_request/find_by_uuid/valid_uuid_with_no_status.yml
|
178
181
|
- spec/cassettes/communication_request/send/invalid_medium.yml
|
179
182
|
- spec/cassettes/communication_request/send/valid_attributes.yml
|
180
183
|
- spec/cassettes/communication_request/send/valid_attributes_binary.yml
|
@@ -221,6 +224,9 @@ test_files:
|
|
221
224
|
- spec/binary_spec.rb
|
222
225
|
- spec/cassettes/binary/download/invalid.yml
|
223
226
|
- spec/cassettes/binary/download/valid.yml
|
227
|
+
- spec/cassettes/communication_request/find_by_uuid/invalid_uuid.yml
|
228
|
+
- spec/cassettes/communication_request/find_by_uuid/valid_uuid_with_a_status.yml
|
229
|
+
- spec/cassettes/communication_request/find_by_uuid/valid_uuid_with_no_status.yml
|
224
230
|
- spec/cassettes/communication_request/send/invalid_medium.yml
|
225
231
|
- spec/cassettes/communication_request/send/valid_attributes.yml
|
226
232
|
- spec/cassettes/communication_request/send/valid_attributes_binary.yml
|