lifen 3.0.0 → 4.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +16 -16
  4. data/README.md +0 -77
  5. data/lib/lifen.rb +0 -11
  6. data/lib/lifen/configuration.rb +3 -1
  7. data/lib/lifen/token.rb +7 -2
  8. data/lib/lifen/user.rb +0 -11
  9. data/lib/lifen/version.rb +1 -1
  10. data/spec/token_spec.rb +37 -13
  11. metadata +2 -41
  12. data/lib/lifen/attachment.rb +0 -26
  13. data/lib/lifen/binary.rb +0 -31
  14. data/lib/lifen/category.rb +0 -26
  15. data/lib/lifen/channel.rb +0 -31
  16. data/lib/lifen/communication_request.rb +0 -67
  17. data/lib/lifen/content_string.rb +0 -15
  18. data/lib/lifen/medium.rb +0 -17
  19. data/lib/lifen/patient.rb +0 -27
  20. data/lib/lifen/practitioner.rb +0 -97
  21. data/spec/binary_spec.rb +0 -29
  22. data/spec/cassettes/binary/download/invalid.yml +0 -65
  23. data/spec/cassettes/binary/download/valid.yml +0 -1320
  24. data/spec/cassettes/communication_request/send/invalid_medium.yml +0 -69
  25. data/spec/cassettes/communication_request/send/valid_attributes.yml +0 -75
  26. data/spec/cassettes/communication_request/send/valid_attributes_binary.yml +0 -74
  27. data/spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml +0 -71
  28. data/spec/cassettes/practitionner/create_channel/address/valid_attributes.yml +0 -71
  29. data/spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml +0 -70
  30. data/spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml +0 -125
  31. data/spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml +0 -122
  32. data/spec/cassettes/practitionner/find_by_rpps/wrong_rpps.yml +0 -68
  33. data/spec/category_spec.rb +0 -21
  34. data/spec/communication_request_spec.rb +0 -64
  35. data/spec/practitionner_spec.rb +0 -76
@@ -1,122 +0,0 @@
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
@@ -1,68 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://develop.lifen.fr/fhir/Practitioner/?identifier=8888888888
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: 404
21
- message: Not Found
22
- headers:
23
- Server:
24
- - Apache-Coyote/1.1
25
- X-B3-Sampled:
26
- - '1'
27
- X-B3-Spanid:
28
- - a02774f0dfc94452
29
- X-B3-Traceid:
30
- - a02774f0dfc94452
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
- Content-Type:
44
- - application/json+fhir;charset=UTF-8
45
- Transfer-Encoding:
46
- - chunked
47
- Date:
48
- - Fri, 19 May 2017 15:35:06 GMT
49
- Connection:
50
- - close
51
- Access-Control-Allow-Credentials:
52
- - 'true'
53
- body:
54
- encoding: UTF-8
55
- string: |-
56
- {
57
- "resourceType": "OperationOutcome",
58
- "issue": [
59
- {
60
- "severity": "error",
61
- "code": "processing",
62
- "diagnostics": "Failed to find practitioner from system"
63
- }
64
- ]
65
- }
66
- http_version:
67
- recorded_at: Fri, 19 May 2017 15:34:36 GMT
68
- recorded_with: VCR 3.0.3
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Lifen::Category do
4
-
5
- let(:category) { Lifen::Category.new }
6
-
7
- describe ':valid?' do
8
-
9
- it 'default case is valid' do
10
- expect(category).to be_valid
11
- end
12
-
13
- it 'unknown case is not valid' do
14
- category.code = "UNKOWN CODE"
15
-
16
- expect(category).to_not be_valid
17
- end
18
-
19
- end
20
-
21
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Lifen::CommunicationRequest do
4
-
5
-
6
- let(:medium1) { Lifen::Medium.new(uuid: "valid-medium-uuid-1") } #valid_channel_uuid
7
- let(:medium2) { Lifen::Medium.new(uuid: "valid-medium-uuid-2") }
8
-
9
- let(:sender) { Lifen::Practitioner.new(uuid: "valid-sender-uuid") } #valid_sender_uuid
10
-
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
-
14
- let(:binary) { Lifen::Binary.new(uuid: "valid-binary-uuid") }
15
-
16
- let(:attachment) { Lifen::Attachment.new(title: "Master Plan", path: File.dirname(__FILE__) + "/support/master_plan.pdf", content_type: "application/pdf") }
17
-
18
- let(:patient) { Lifen::Patient.new(first_name: "Jean", last_name: "Dupond", birthdate: Date.new(2000,1,1)) }
19
-
20
-
21
-
22
- describe ':send multi-recipients with a binary' do
23
-
24
- let(:communication_request) { Lifen::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
- end
30
-
31
- expect(communication_request.uuid).to_not be_nil
32
- expect(communication_request.number_communications).to eq(2)
33
- end
34
- end
35
-
36
- describe ':send multi-recipients with an attachment' do
37
-
38
- let(:communication_request) { Lifen::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [medium1, medium2], attachment: attachment, patient: patient) }
39
-
40
- it 'works' do
41
- VCR.use_cassette "communication_request/send/valid_attributes" do
42
- communication_request.send
43
- end
44
-
45
- expect(communication_request.uuid).to_not be_nil
46
- expect(communication_request.number_communications).to eq(2)
47
- end
48
- end
49
-
50
- describe 'invalid medium' do
51
- let(:invalid_medium) { Lifen::Medium.new(uuid: "invalid-medium-uuid") }
52
- let(:communication_request) { Lifen::CommunicationRequest.new(sender: sender, recipients: [recipient1, recipient2], medium: [invalid_medium, medium2], binary: binary, patient: patient) }
53
-
54
- it 'raises an error' do
55
-
56
- VCR.use_cassette "communication_request/send/invalid_medium" do
57
- expect{
58
- communication_request.send
59
- }.to raise_error Lifen::Error
60
- end
61
- end
62
- end
63
-
64
- end
@@ -1,76 +0,0 @@
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