lifen 2.0.0 → 2.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/lib/lifen/user.rb +25 -2
- data/lib/lifen/version.rb +1 -1
- data/spec/cassettes/users/create_channel/{valid_attributes.yml → address/old_valid_attributes.yml} +0 -0
- data/spec/cassettes/users/create_channel/address/valid_attributes.yml +70 -0
- data/spec/cassettes/users/create_channel/telecom/valid_attributes.yml +68 -0
- data/spec/user_spec.rb +24 -4
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fecc06b97e2fc280ee947c1fcfe3f62e71841475
|
4
|
+
data.tar.gz: 9ad6094a798bea54922907efbb2ba5ea3d710345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86d43d8443e22e8f97e50ef225d6accce74fa67a45bf2ad6c4446bd1d1fdc15826b436e0e0b4c7ba7bdd0758fee0e847e0bbf0af6118558c126068d148cd1779
|
7
|
+
data.tar.gz: 60aa9e72362b928dbfb08bf9d62fadfa1555bd78642bae69d24f9f0e9ce1be655b171af1c326cf15328415eae638a408aede963ce6d82a7a1dadbf5abc645f56
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
2.1.0
|
2
|
+
-----
|
3
|
+
|
4
|
+
- Added user :create_telecom for fax
|
5
|
+
- Added user :create_address (create_channel will be depreciated)
|
6
|
+
|
1
7
|
2.0.0
|
2
8
|
-----
|
3
9
|
|
@@ -103,4 +109,4 @@
|
|
103
109
|
-----
|
104
110
|
|
105
111
|
- Major refactoring
|
106
|
-
- Added OAuth support
|
112
|
+
- Added OAuth support
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -151,9 +151,15 @@ communication.status
|
|
151
151
|
|
152
152
|
```ruby
|
153
153
|
recipient = Lifen::User.new(uuid: "valid-user-uuid")
|
154
|
-
|
154
|
+
|
155
|
+
# To create a new mailing address channel
|
156
|
+
channel = recipient.create_address(type: "address", lines: ["39 rue Aboukir"], city: "Paris", postal_code: "75002", country: "France")
|
157
|
+
|
158
|
+
# To create a new telecom channel fax
|
159
|
+
channel = recipient.create_telecom(type: "telecom", system: "fax", value: "+33102030405")
|
155
160
|
```
|
156
161
|
|
162
|
+
|
157
163
|
## Contributing
|
158
164
|
|
159
165
|
1. Fork it
|
data/lib/lifen/user.rb
CHANGED
@@ -16,6 +16,7 @@ module Lifen
|
|
16
16
|
|
17
17
|
@@create_lock = Mutex.new
|
18
18
|
|
19
|
+
|
19
20
|
def flows
|
20
21
|
Lifen::Flows.new(user: self).all
|
21
22
|
end
|
@@ -138,7 +139,7 @@ module Lifen
|
|
138
139
|
user
|
139
140
|
end
|
140
141
|
|
141
|
-
def
|
142
|
+
def create_address(params)
|
142
143
|
filtered_params = {"resourceType" => "Practitioner"}
|
143
144
|
|
144
145
|
address = {
|
@@ -159,6 +160,8 @@ module Lifen
|
|
159
160
|
channel
|
160
161
|
end
|
161
162
|
|
163
|
+
alias_method :create_channel, :create_address
|
164
|
+
|
162
165
|
def self.from_json(json)
|
163
166
|
reference = json["reference"]
|
164
167
|
|
@@ -167,6 +170,26 @@ module Lifen
|
|
167
170
|
new(uuid: uuid)
|
168
171
|
end
|
169
172
|
|
173
|
+
def create_telecom(params)
|
174
|
+
filtered_params = {"resourceType" => "Practitioner"}
|
175
|
+
|
176
|
+
telecom = {
|
177
|
+
"system": params[:system],
|
178
|
+
"value": params[:value]
|
179
|
+
}
|
180
|
+
|
181
|
+
filtered_params[params[:type]] = telecom
|
182
|
+
|
183
|
+
json = application_client.post("fhir/Practitioner/#{uuid}/$add-telecom", filtered_params)
|
184
|
+
|
185
|
+
channel = Channel.new(uuid: json["issue"][0]["id"], type: params[:type], value: params[:value])
|
186
|
+
|
187
|
+
self.channels << channel
|
188
|
+
|
189
|
+
channel
|
190
|
+
|
191
|
+
end
|
192
|
+
|
170
193
|
private
|
171
194
|
|
172
195
|
def application_client
|
@@ -178,4 +201,4 @@ module Lifen
|
|
178
201
|
end
|
179
202
|
|
180
203
|
end
|
181
|
-
end
|
204
|
+
end
|
data/lib/lifen/version.rb
CHANGED
data/spec/cassettes/users/create_channel/{valid_attributes.yml → address/old_valid_attributes.yml}
RENAMED
File without changes
|
@@ -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":["Honestica", "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
|
@@ -0,0 +1,68 @@
|
|
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
|
+
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
|
+
- a112d0b5d16fd847
|
31
|
+
X-B3-Traceid:
|
32
|
+
- a112d0b5d16fd847
|
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
|
+
- Wed, 29 Mar 2017 11:51:04 GMT
|
51
|
+
Access-Control-Allow-Credentials:
|
52
|
+
- 'true'
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: |-
|
56
|
+
{
|
57
|
+
"resourceType": "OperationOutcome",
|
58
|
+
"issue": [
|
59
|
+
{
|
60
|
+
"id": "11e71475-fd0b-fdaf-b133-0242ac110005",
|
61
|
+
"severity": "information",
|
62
|
+
"diagnostics": "Fax created."
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
http_version:
|
67
|
+
recorded_at: Wed, 29 Mar 2017 11:50:47 GMT
|
68
|
+
recorded_with: VCR 3.0.3
|
data/spec/user_spec.rb
CHANGED
@@ -272,12 +272,22 @@ describe Lifen::User do
|
|
272
272
|
|
273
273
|
end
|
274
274
|
|
275
|
-
describe ':
|
275
|
+
describe ':create_address' do
|
276
276
|
|
277
277
|
let(:user) { Lifen::User.new(uuid: "11e5c85e-9bc0-4c6e-9b29-deb9993a92c0") }
|
278
278
|
|
279
|
-
it 'creates the
|
280
|
-
VCR.use_cassette "users/create_channel/valid_attributes" do
|
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
|
281
291
|
@channel = user.create_channel(type: "address", lines: ["Honestica", "39 rue d'Aboukir"], city: "Paris", postal_code: "75002", country: "France")
|
282
292
|
end
|
283
293
|
|
@@ -285,7 +295,17 @@ describe Lifen::User do
|
|
285
295
|
expect(@channel.uuid).to eq "11e70577-f114-5cde-b13b-0242ac110002"
|
286
296
|
expect(user.channels.size).to eq 1
|
287
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
|
288
307
|
end
|
289
308
|
|
290
309
|
|
291
|
-
|
310
|
+
|
311
|
+
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
|
+
version: 2.1.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-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -195,7 +195,9 @@ files:
|
|
195
195
|
- spec/cassettes/users/create/invalid_token.yml
|
196
196
|
- spec/cassettes/users/create/missing_fields.yml
|
197
197
|
- spec/cassettes/users/create/valid_attributes.yml
|
198
|
-
- spec/cassettes/users/create_channel/
|
198
|
+
- spec/cassettes/users/create_channel/address/old_valid_attributes.yml
|
199
|
+
- spec/cassettes/users/create_channel/address/valid_attributes.yml
|
200
|
+
- spec/cassettes/users/create_channel/telecom/valid_attributes.yml
|
199
201
|
- spec/cassettes/users/find/existing_uuid.yml
|
200
202
|
- spec/cassettes/users/find/missing_uuid.yml
|
201
203
|
- spec/cassettes/users/find_by_rpps/existing_rpps.yml
|
@@ -263,7 +265,9 @@ test_files:
|
|
263
265
|
- spec/cassettes/users/create/invalid_token.yml
|
264
266
|
- spec/cassettes/users/create/missing_fields.yml
|
265
267
|
- spec/cassettes/users/create/valid_attributes.yml
|
266
|
-
- spec/cassettes/users/create_channel/
|
268
|
+
- spec/cassettes/users/create_channel/address/old_valid_attributes.yml
|
269
|
+
- spec/cassettes/users/create_channel/address/valid_attributes.yml
|
270
|
+
- spec/cassettes/users/create_channel/telecom/valid_attributes.yml
|
267
271
|
- spec/cassettes/users/find/existing_uuid.yml
|
268
272
|
- spec/cassettes/users/find/missing_uuid.yml
|
269
273
|
- spec/cassettes/users/find_by_rpps/existing_rpps.yml
|