lifen 2.4.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -242,70 +242,4 @@ describe Lifen::User do
242
242
 
243
243
  end
244
244
 
245
- describe ':find_by_rpps' do
246
-
247
- it 'finds the users' do
248
- VCR.use_cassette "users/find_by_rpps/existing_rpps" do
249
- @user = Lifen::User.find_by_rpps("810004085790")
250
- end
251
-
252
- expect(@user.channels.size).to eq(3)
253
-
254
- address = @user.channels.last
255
-
256
- expect(address.value).to eq "Batiment Nord, 11 RUE CHARLES TELLIER, 75016 Paris"
257
- end
258
-
259
- context 'missing lines attribute' do
260
-
261
- it 'does not raise an issue' do
262
- VCR.use_cassette "users/find_by_rpps/missing_line_attribute" do
263
- @user = Lifen::User.find_by_rpps("810004085790")
264
- end
265
-
266
- address = @user.channels.last
267
-
268
- expect(address.value).to eq ", 75016 Paris"
269
- end
270
- end
271
-
272
-
273
- end
274
-
275
- describe ':create_address' do
276
-
277
- let(:user) { Lifen::User.new(uuid: "11e5c85e-9bc0-4c6e-9b29-deb9993a92c0") }
278
-
279
- it 'creates the address' do
280
- VCR.use_cassette "users/create_channel/address/valid_attributes" do
281
- @channel = user.create_address(type: "address", lines: ["Honestica", "39 rue d'Aboukir"], city: "Paris", postal_code: "75002", country: "France")
282
- end
283
-
284
- expect(@channel.value).to eq "Honestica, 39 rue d'Aboukir, 75002 Paris"
285
- expect(@channel.uuid).to eq "11e70577-f114-5cde-b13b-0242ac110002"
286
- expect(user.channels.size).to eq 1
287
- end
288
-
289
- it 'creates the channel - old version' do
290
- VCR.use_cassette "users/create_channel/address/old_valid_attributes" do
291
- @channel = user.create_channel(type: "address", lines: ["Honestica", "39 rue d'Aboukir"], city: "Paris", postal_code: "75002", country: "France")
292
- end
293
-
294
- expect(@channel.value).to eq "Honestica, 39 rue d'Aboukir, 75002 Paris"
295
- expect(@channel.uuid).to eq "11e70577-f114-5cde-b13b-0242ac110002"
296
- expect(user.channels.size).to eq 1
297
- end
298
-
299
- it 'creates the telecom-fax channel' do
300
- VCR.use_cassette "users/create_channel/telecom/valid_attributes" do
301
- @channel = user.create_telecom(type: "telecom", system: "fax", value: "+33102030405")
302
- end
303
-
304
- expect(@channel.uuid).to eq "11e71475-fd0b-fdaf-b133-0242ac110005"
305
- expect(user.channels.size).to eq 1
306
- end
307
- end
308
-
309
-
310
-
311
245
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifen
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Etienne Depaulis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,7 +160,6 @@ files:
160
160
  - lib/lifen/category.rb
161
161
  - lib/lifen/channel.rb
162
162
  - lib/lifen/client.rb
163
- - lib/lifen/communication.rb
164
163
  - lib/lifen/communication_request.rb
165
164
  - lib/lifen/configuration.rb
166
165
  - lib/lifen/content_string.rb
@@ -170,6 +169,7 @@ files:
170
169
  - lib/lifen/medium.rb
171
170
  - lib/lifen/message.rb
172
171
  - lib/lifen/patient.rb
172
+ - lib/lifen/practitioner.rb
173
173
  - lib/lifen/settings.rb
174
174
  - lib/lifen/status.rb
175
175
  - lib/lifen/token.rb
@@ -180,11 +180,6 @@ files:
180
180
  - spec/binary_spec.rb
181
181
  - spec/cassettes/binary/download/invalid.yml
182
182
  - spec/cassettes/binary/download/valid.yml
183
- - spec/cassettes/communication/find/invalid_uuid.yml
184
- - spec/cassettes/communication/find/valid_uuid.yml
185
- - spec/cassettes/communication/send/binary_and_content_string.yml
186
- - spec/cassettes/communication/send/binary_valid_attributes.yml
187
- - spec/cassettes/communication/send/valid_attributes.yml
188
183
  - spec/cassettes/communication_request/send/invalid_medium.yml
189
184
  - spec/cassettes/communication_request/send/valid_attributes.yml
190
185
  - spec/cassettes/communication_request/send/valid_attributes_binary.yml
@@ -200,6 +195,12 @@ files:
200
195
  - spec/cassettes/flows/update_valid_title.yml
201
196
  - spec/cassettes/flows/valid_token.yml
202
197
  - spec/cassettes/messages/valid_message.yml
198
+ - spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml
199
+ - spec/cassettes/practitionner/create_channel/address/valid_attributes.yml
200
+ - spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml
201
+ - spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml
202
+ - spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml
203
+ - spec/cassettes/practitionner/find_by_rpps/wrong_rpps.yml
203
204
  - spec/cassettes/settings/initial_state.yml
204
205
  - spec/cassettes/settings/reload.yml
205
206
  - spec/cassettes/settings/update.yml
@@ -222,10 +223,10 @@ files:
222
223
  - spec/cassettes/users/token/refresh/valid_user_uuid.yml
223
224
  - spec/category_spec.rb
224
225
  - spec/communication_request_spec.rb
225
- - spec/communication_spec.rb
226
226
  - spec/configuration_spec.rb
227
227
  - spec/flow_spec.rb
228
228
  - spec/message_spec.rb
229
+ - spec/practitionner_spec.rb
229
230
  - spec/settings_spec.rb
230
231
  - spec/spec_helper.rb
231
232
  - spec/support/master_plan.pdf
@@ -259,11 +260,6 @@ test_files:
259
260
  - spec/binary_spec.rb
260
261
  - spec/cassettes/binary/download/invalid.yml
261
262
  - spec/cassettes/binary/download/valid.yml
262
- - spec/cassettes/communication/find/invalid_uuid.yml
263
- - spec/cassettes/communication/find/valid_uuid.yml
264
- - spec/cassettes/communication/send/binary_and_content_string.yml
265
- - spec/cassettes/communication/send/binary_valid_attributes.yml
266
- - spec/cassettes/communication/send/valid_attributes.yml
267
263
  - spec/cassettes/communication_request/send/invalid_medium.yml
268
264
  - spec/cassettes/communication_request/send/valid_attributes.yml
269
265
  - spec/cassettes/communication_request/send/valid_attributes_binary.yml
@@ -279,6 +275,12 @@ test_files:
279
275
  - spec/cassettes/flows/update_valid_title.yml
280
276
  - spec/cassettes/flows/valid_token.yml
281
277
  - spec/cassettes/messages/valid_message.yml
278
+ - spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml
279
+ - spec/cassettes/practitionner/create_channel/address/valid_attributes.yml
280
+ - spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml
281
+ - spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml
282
+ - spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml
283
+ - spec/cassettes/practitionner/find_by_rpps/wrong_rpps.yml
282
284
  - spec/cassettes/settings/initial_state.yml
283
285
  - spec/cassettes/settings/reload.yml
284
286
  - spec/cassettes/settings/update.yml
@@ -301,10 +303,10 @@ test_files:
301
303
  - spec/cassettes/users/token/refresh/valid_user_uuid.yml
302
304
  - spec/category_spec.rb
303
305
  - spec/communication_request_spec.rb
304
- - spec/communication_spec.rb
305
306
  - spec/configuration_spec.rb
306
307
  - spec/flow_spec.rb
307
308
  - spec/message_spec.rb
309
+ - spec/practitionner_spec.rb
308
310
  - spec/settings_spec.rb
309
311
  - spec/spec_helper.rb
310
312
  - spec/support/master_plan.pdf
@@ -1,92 +0,0 @@
1
- module Lifen
2
- class Communication < Base
3
-
4
- attribute :uuid, String
5
-
6
- attribute :sender, Lifen::User
7
- attribute :recipient, Lifen::User
8
-
9
- attribute :category, Lifen::Category, default: Lifen::Category.new
10
- attribute :channel, Lifen::Channel
11
- attribute :patient, Lifen::Patient
12
- attribute :attachment, Lifen::Attachment
13
- attribute :binary, Lifen::Binary
14
- attribute :content_string, Lifen::ContentString
15
-
16
- attribute :status, String
17
- attribute :sent_at, DateTime
18
- attribute :received_at, DateTime
19
-
20
- def send
21
- json = application_client.post("fhir/CommunicationRequest", fhir_payload)
22
-
23
- self.uuid = json["id"]
24
-
25
- self
26
- end
27
-
28
- def self.find(uuid)
29
- json = application_client.get("fhir/Communication/#{uuid}")
30
-
31
- resource_type = json["resourceType"]
32
-
33
- raise Error, "Invalid resourceType (#{resource_type})" if resource_type != "Communication"
34
-
35
- attributes = {}
36
-
37
- attributes[:uuid] = json["id"]
38
- attributes[:status] = json["status"]
39
- attributes[:sent_at] = json["sent"]
40
- attributes[:received_at] = json["received"]
41
-
42
- attributes[:sender] = User.from_json(json["sender"])
43
- attributes[:recipient] = User.from_json(Array(json["recipient"]).first)
44
-
45
- new(attributes)
46
- end
47
-
48
- private
49
-
50
- def fhir_payload
51
-
52
- payload = {
53
- resourceType: "CommunicationRequest",
54
- sender: [ sender.fhir_payload ],
55
- recipient: [ recipient.fhir_payload ],
56
- contained: [ channel.fhir_payload(recipient) ],
57
- category: [ category.fhir_payload],
58
- payload: [ document_content ]
59
- }
60
-
61
- if patient
62
- payload[:contained] << patient.fhir_payload
63
- payload[:subject] = [
64
- {reference: "patient"}
65
- ]
66
- end
67
-
68
- if content_string
69
- payload[:payload] << content_string.fhir_payload
70
- end
71
-
72
- payload
73
- end
74
-
75
- def document_content
76
- if !attachment.nil?
77
- attachment.fhir_payload
78
- else
79
- binary.fhir_payload
80
- end
81
- end
82
-
83
- def application_client
84
- @application_client ||= AppAuthenticatedClient.new
85
- end
86
-
87
- def self.application_client
88
- @application_client ||= AppAuthenticatedClient.new
89
- end
90
-
91
- end
92
- end
@@ -1,96 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://develop.lifen.fr/fhir/Communication/11e71070-15f9-23c1-9ad2-0242ac110002
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
- Content-Type:
15
- - application/json
16
- Accept:
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
- - e3501c29e536dd60
31
- X-B3-Traceid:
32
- - e3501c29e536dd60
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.2 REST Server (FHIR Server; FHIR 1.0.2/DSTU2)
45
- Content-Location:
46
- - http://develop.lifen.fr/fhir/Communication/11e71070-15f9-23c1-9ad2-0242ac110002
47
- Location:
48
- - http://develop.lifen.fr/fhir/Communication/11e71070-15f9-23c1-9ad2-0242ac110002
49
- Content-Type:
50
- - application/json+fhir;charset=UTF-8
51
- Transfer-Encoding:
52
- - chunked
53
- Date:
54
- - Fri, 24 Mar 2017 09:35:35 GMT
55
- Connection:
56
- - close
57
- Access-Control-Allow-Credentials:
58
- - 'true'
59
- body:
60
- encoding: UTF-8
61
- string: |-
62
- {
63
- "resourceType": "Communication",
64
- "id": "11e71070-15f9-23c1-9ad2-0242ac110002",
65
- "sender": {
66
- "reference": "Practitioner/11e5b841-4ff1-2dbb-9643-eabb809fa654"
67
- },
68
- "recipient": [
69
- {
70
- "reference": "Practitioner/11e5c866-a698-cfb0-9b29-deb9993a92c0"
71
- }
72
- ],
73
- "payload": [
74
- {
75
- "contentReference": {
76
- "reference": "11e71070-15f3-5755-9ad2-0242ac110002"
77
- }
78
- }
79
- ],
80
- "medium": [
81
- {
82
- "coding": [
83
- {
84
- "system": "http://honestica.com/fhir/channel",
85
- "code": "APICRYPT"
86
- }
87
- ]
88
- }
89
- ],
90
- "status": "completed",
91
- "sent": "2017-03-24T08:58:45+00:00",
92
- "received": "2017-03-24T08:58:44+00:00"
93
- }
94
- http_version:
95
- recorded_at: Fri, 24 Mar 2017 09:35:35 GMT
96
- recorded_with: VCR 3.0.3
@@ -1,75 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://develop.lifen.fr/fhir/CommunicationRequest
6
- body:
7
- encoding: UTF-8
8
- string: '{"resourceType":"CommunicationRequest","sender":[{"reference":"valid_sender_uuid"}],"recipient":[{"reference":"valid_recipient_uuid"}],"contained":[{"id":"11e5b841-4ff8-2dbb-9643-eabb809fa654","resourceType":"Practitioner","address":[{"id":"valid_channel_uuid"}]}],"category":[{"coding":[{"system":"http://honestica.com/fhir/communication/category","code":"MEDICAL_REPORT"}]}],"payload":[{"contentReference":{"reference":"Binary/valid_binary_id"}},{"contentString":"Cher
9
- Dr Coeur, je viens de voir votre patiente Mme Paulette Michu"}]}'
10
- headers:
11
- User-Agent:
12
- - Faraday v0.11.0
13
- Authorization:
14
- - Bearer valid_application_access_token
15
- Accept:
16
- - application/json
17
- Content-Type:
18
- - application/json
19
- Accept-Encoding:
20
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
21
- response:
22
- status:
23
- code: 201
24
- message: Created
25
- headers:
26
- Server:
27
- - nginx/1.6.2
28
- Date:
29
- - Mon, 24 Apr 2017 07:36:03 GMT
30
- Content-Type:
31
- - application/json+fhir;charset=UTF-8
32
- Location:
33
- - http://develop.lifen.fr/fhir/OperationOutcome/f585aaf9-a024-4b40-bc30-727e9fa034e8
34
- Transfer-Encoding:
35
- - chunked
36
- Connection:
37
- - keep-alive
38
- X-B3-Sampled:
39
- - '1'
40
- X-B3-Spanid:
41
- - 18020f441c973c54
42
- X-B3-Traceid:
43
- - 18020f441c973c54
44
- X-Content-Type-Options:
45
- - nosniff
46
- X-Xss-Protection:
47
- - 1; mode=block
48
- Cache-Control:
49
- - no-cache, no-store, max-age=0, must-revalidate
50
- Pragma:
51
- - no-cache
52
- Expires:
53
- - '0'
54
- X-Powered-By:
55
- - HAPI FHIR 2.2 REST Server (FHIR Server; FHIR 1.0.2/DSTU2)
56
- Content-Location:
57
- - http://develop.lifen.fr/fhir/OperationOutcome/f585aaf9-a024-4b40-bc30-727e9fa034e8
58
- Access-Control-Allow-Credentials:
59
- - 'true'
60
- body:
61
- encoding: UTF-8
62
- string: |-
63
- {
64
- "resourceType": "OperationOutcome",
65
- "id": "f585aaf9-a024-4b40-bc30-727e9fa034e8",
66
- "issue": [
67
- {
68
- "severity": "information",
69
- "diagnostics": "CommunicationRequest accepted"
70
- }
71
- ]
72
- }
73
- http_version:
74
- recorded_at: Mon, 24 Apr 2017 07:36:04 GMT
75
- recorded_with: VCR 3.0.3
@@ -1,74 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://develop.lifen.fr/fhir/CommunicationRequest
6
- body:
7
- encoding: UTF-8
8
- string: '{"resourceType":"CommunicationRequest","sender":[{"reference":"valid_sender_uuid"}],"recipient":[{"reference":"valid_recipient_uuid"}],"contained":[{"id":"valid_recipient_uuid","resourceType":"Practitioner","address":[{"id":"valid_channel_uuid"}]},{"id":"patient","resourceType":"Patient","name":[{"family":["Dupond"],"given":["Jean"]}],"birthDate":"2000-01-01"}],"category":[{"coding":[{"system":"http://honestica.com/fhir/communication/category","code":"MEDICAL_REPORT"}]}],"payload":[{"contentReference":{"reference":"Binary/valid_binary_id"}}],"subject":[{"reference":"patient"}]}'
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: 201
23
- message: Created
24
- headers:
25
- Server:
26
- - nginx/1.6.2
27
- Date:
28
- - Wed, 05 Apr 2017 12:59:53 GMT
29
- Content-Type:
30
- - application/json+fhir;charset=UTF-8
31
- Location:
32
- - http://develop.lifen.fr/fhir/OperationOutcome/5be5ff4e-d110-4206-97ff-bcc059dd82f4
33
- Transfer-Encoding:
34
- - chunked
35
- Connection:
36
- - keep-alive
37
- X-B3-Sampled:
38
- - '1'
39
- X-B3-Spanid:
40
- - 3ce39e55c4819d06
41
- X-B3-Traceid:
42
- - 3ce39e55c4819d06
43
- X-Content-Type-Options:
44
- - nosniff
45
- X-Xss-Protection:
46
- - 1; mode=block
47
- Cache-Control:
48
- - no-cache, no-store, max-age=0, must-revalidate
49
- Pragma:
50
- - no-cache
51
- Expires:
52
- - '0'
53
- X-Powered-By:
54
- - HAPI FHIR 2.2 REST Server (FHIR Server; FHIR 1.0.2/DSTU2)
55
- Content-Location:
56
- - http://develop.lifen.fr:2129/fhir/OperationOutcome/5be5ff4e-d110-4206-97ff-bcc059dd82f4
57
- Access-Control-Allow-Credentials:
58
- - 'true'
59
- body:
60
- encoding: UTF-8
61
- string: |-
62
- {
63
- "resourceType": "OperationOutcome",
64
- "id": "5be5ff4e-d110-4206-97ff-bcc059dd82f4",
65
- "issue": [
66
- {
67
- "severity": "information",
68
- "diagnostics": "CommunicationRequest accepted"
69
- }
70
- ]
71
- }
72
- http_version:
73
- recorded_at: Wed, 05 Apr 2017 12:59:53 GMT
74
- recorded_with: VCR 3.0.3