lifen 1.6.4 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88032ccb31895514a47363cba982a766bc14fce1
4
- data.tar.gz: 509bee800111a59beef136eee436a331c1062a6d
3
+ metadata.gz: 0f7482b071f425af6016a9c130d10f6bb02fa600
4
+ data.tar.gz: 3852ce021bd7fbafef57d93259aef0f4b175925a
5
5
  SHA512:
6
- metadata.gz: 112616d0fea4eb44dc20fccc0c1bc6a9ec577bd38ba4f628749ea8492a8b9fd9819737f6885ffe3187bf25a5e3a25d9e5ea13feecfea8ef614e8222eb634ae85
7
- data.tar.gz: 48eea0dee73a48e40d3a2a6797b71fa87a6d51ec46a21cadf2e8f9b18492e1e512467181f96ba3910ad31bdd01811ea67f7262fcc268d56dc403530795de51da
6
+ metadata.gz: 7efdc2fc2ccac4672b22535a9f432f2de3c1e83157e271f4404afa5a68eef3c7f8ca5a75c4608916f3455b5cb0d1cc5b6646f71ea7503ce47f226ec22134405c
7
+ data.tar.gz: 3c6e77819cd7fe0fe6e6a85ffb088d11562609bb092660850857a4de9f4bf08ff1569a266b3e0d4c00eac633101b18610b9b4c3121de074bbe73b78033194bf9
@@ -1,10 +1,14 @@
1
+ 1.6.5
2
+ -----
3
+
4
+ - Added custom addresses creation
5
+
1
6
  1.6.4
2
7
  -----
3
8
 
4
9
  - Added Patient management
5
10
  - Fixed missing informations about address type channels
6
11
 
7
-
8
12
  1.6.3
9
13
  -----
10
14
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lifen (1.6.4)
4
+ lifen (1.6.5)
5
5
  faraday (>= 0.9)
6
6
  inflecto
7
7
  virtus (>= 1.0)
data/README.md CHANGED
@@ -142,6 +142,13 @@ request = Lifen::Communication::Request.new(sender: sender, recipient: recipient
142
142
  request.send
143
143
  ```
144
144
 
145
+ ### Custom Addresses management
146
+
147
+ ```ruby
148
+ recipient = Lifen::User.new(uuid: "valid-user-uuid")
149
+ channel = recipient.create_channel(type: "address", lines: ["39 rue Aboukir"], city: "Paris", postal_code: "75002", country: "France")
150
+ ```
151
+
145
152
  ## Contributing
146
153
 
147
154
  1. Fork it
@@ -138,6 +138,27 @@ module Lifen
138
138
  user
139
139
  end
140
140
 
141
+ def create_channel(params)
142
+ filtered_params = {"resourceType" => "Practitioner"}
143
+
144
+ address = {
145
+ "line": Array(params[:lines]),
146
+ "city": params[:city],
147
+ "postalCode": params[:postal_code],
148
+ "country": params[:country]
149
+ }
150
+
151
+ filtered_params[params[:type]] = address
152
+
153
+ json = application_client.post("fhir/Practitioner/#{uuid}/$add-address", filtered_params)
154
+
155
+ channel = Communication::Channel.new(uuid: json["issue"][0]["id"], type: params[:type], value: "#{Array(params[:lines])[0]}, #{params[:postal_code]} #{params[:city]}")
156
+
157
+ self.channels << channel
158
+
159
+ channel
160
+ end
161
+
141
162
  private
142
163
 
143
164
  def application_client
@@ -1,3 +1,3 @@
1
1
  module Lifen
2
- VERSION = "1.6.4"
2
+ VERSION = "1.6.5"
3
3
  end
@@ -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-address
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"resourceType":"Practitioner","address":{"line":["39 rue Aboukir"],"city":"Paris","postalCode":"75002","country":"France"}}'
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
+ - ba943922b8381e3
31
+ X-B3-Traceid:
32
+ - ba943922b8381e3
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-Type:
46
+ - application/json+fhir;charset=UTF-8
47
+ Transfer-Encoding:
48
+ - chunked
49
+ Date:
50
+ - Fri, 10 Mar 2017 09:57:16 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": "11e70577-f114-5cde-b13b-0242ac110002",
63
+ "severity": "information",
64
+ "diagnostics": "Address created"
65
+ }
66
+ ]
67
+ }
68
+ http_version:
69
+ recorded_at: Fri, 10 Mar 2017 09:57:16 GMT
70
+ recorded_with: VCR 3.0.3
@@ -259,5 +259,20 @@ describe Lifen::User do
259
259
 
260
260
  end
261
261
 
262
+ describe ':create_channel' do
263
+
264
+ let(:user) { Lifen::User.new(uuid: "11e5c85e-9bc0-4c6e-9b29-deb9993a92c0") }
265
+
266
+ it 'creates the channel' do
267
+ VCR.use_cassette "users/create_channel/valid_attributes" do
268
+ @channel = user.create_channel(type: "address", lines: ["39 rue d'Aboukir"], city: "Paris", postal_code: "75002", country: "France")
269
+ end
270
+
271
+ expect(@channel.value).to eq "39 rue d'Aboukir, 75002 Paris"
272
+ expect(@channel.uuid).to eq "11e70577-f114-5cde-b13b-0242ac110002"
273
+ expect(user.channels.size).to eq 1
274
+ end
275
+ end
276
+
262
277
 
263
278
  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: 1.6.4
4
+ version: 1.6.5
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-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -193,6 +193,7 @@ files:
193
193
  - spec/cassettes/users/create/invalid_token.yml
194
194
  - spec/cassettes/users/create/missing_fields.yml
195
195
  - spec/cassettes/users/create/valid_attributes.yml
196
+ - spec/cassettes/users/create_channel/valid_attributes.yml
196
197
  - spec/cassettes/users/find/existing_uuid.yml
197
198
  - spec/cassettes/users/find/missing_uuid.yml
198
199
  - spec/cassettes/users/find_by_rpps/existing_rpps.yml
@@ -257,6 +258,7 @@ test_files:
257
258
  - spec/cassettes/users/create/invalid_token.yml
258
259
  - spec/cassettes/users/create/missing_fields.yml
259
260
  - spec/cassettes/users/create/valid_attributes.yml
261
+ - spec/cassettes/users/create_channel/valid_attributes.yml
260
262
  - spec/cassettes/users/find/existing_uuid.yml
261
263
  - spec/cassettes/users/find/missing_uuid.yml
262
264
  - spec/cassettes/users/find_by_rpps/existing_rpps.yml