lifen_fhir 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +9 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +74 -0
  8. data/License.txt +22 -0
  9. data/README.md +131 -0
  10. data/lib/lifen_fhir/app_authenticated_client.rb +38 -0
  11. data/lib/lifen_fhir/attachment.rb +26 -0
  12. data/lib/lifen_fhir/base.rb +7 -0
  13. data/lib/lifen_fhir/binary.rb +29 -0
  14. data/lib/lifen_fhir/category.rb +26 -0
  15. data/lib/lifen_fhir/channel.rb +31 -0
  16. data/lib/lifen_fhir/client.rb +107 -0
  17. data/lib/lifen_fhir/communication_request.rb +67 -0
  18. data/lib/lifen_fhir/configuration.rb +22 -0
  19. data/lib/lifen_fhir/content_string.rb +15 -0
  20. data/lib/lifen_fhir/error.rb +27 -0
  21. data/lib/lifen_fhir/medium.rb +15 -0
  22. data/lib/lifen_fhir/patient.rb +27 -0
  23. data/lib/lifen_fhir/practitioner.rb +97 -0
  24. data/lib/lifen_fhir/user_authenticated_client.rb +39 -0
  25. data/lib/lifen_fhir/version.rb +3 -0
  26. data/lib/lifen_fhir.rb +29 -0
  27. data/lifen_fhir.gemspec +30 -0
  28. data/spec/binary_spec.rb +29 -0
  29. data/spec/cassettes/binary/download/invalid.yml +65 -0
  30. data/spec/cassettes/binary/download/valid.yml +1320 -0
  31. data/spec/cassettes/communication_request/send/invalid_medium.yml +69 -0
  32. data/spec/cassettes/communication_request/send/valid_attributes.yml +75 -0
  33. data/spec/cassettes/communication_request/send/valid_attributes_binary.yml +74 -0
  34. data/spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml +71 -0
  35. data/spec/cassettes/practitionner/create_channel/address/valid_attributes.yml +71 -0
  36. data/spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml +70 -0
  37. data/spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml +125 -0
  38. data/spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml +122 -0
  39. data/spec/cassettes/practitionner/find_by_rpps/wrong_rpps.yml +68 -0
  40. data/spec/category_spec.rb +21 -0
  41. data/spec/communication_request_spec.rb +64 -0
  42. data/spec/practitionner_spec.rb +76 -0
  43. data/spec/spec_helper.rb +24 -0
  44. data/spec/support/master_plan.pdf +0 -0
  45. metadata +232 -0
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+
3
+ describe LifenFhir::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 = LifenFhir::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 = LifenFhir::Practitioner.find_by_rpps("8888888888") }.to raise_error LifenFhir::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 = LifenFhir::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) { LifenFhir::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
@@ -0,0 +1,24 @@
1
+ require 'bundler/setup'
2
+ require 'webmock/rspec'
3
+ require 'vcr'
4
+ require 'awesome_print'
5
+
6
+ require_relative '../lib/lifen_fhir.rb'
7
+
8
+ VCR.configure do |c|
9
+ c.cassette_library_dir = 'spec/cassettes'
10
+ c.hook_into :webmock
11
+ c.allow_http_connections_when_no_cassette = false
12
+ c.before_record do |i|
13
+ i.response.body.force_encoding('UTF-8')
14
+ end
15
+ end
16
+
17
+ RSpec.configure do |c|
18
+ c.before(:each) do
19
+ LifenFhir.configure do |config|
20
+ config.site = "https://develop.lifen.fr/"
21
+ config.application_access_token = "valid_application_access_token"
22
+ end
23
+ end
24
+ end
Binary file
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lifen_fhir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Leonard Sellam
8
+ - Etienne Depaulis
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-05-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.12'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.12'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.5'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.5'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.5'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.5'
56
+ - !ruby/object:Gem::Dependency
57
+ name: vcr
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: webmock
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.24'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.24'
84
+ - !ruby/object:Gem::Dependency
85
+ name: awesome_print
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: virtus
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '1.0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '1.0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: inflecto
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: faraday
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0.9'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0.9'
140
+ description: Lifen FHIR API Ruby client
141
+ email:
142
+ - leonard@lifen.fr
143
+ - etienne@lifen.fr
144
+ executables: []
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".gitignore"
149
+ - ".rspec"
150
+ - ".ruby-version"
151
+ - CHANGELOG.md
152
+ - Gemfile
153
+ - Gemfile.lock
154
+ - License.txt
155
+ - README.md
156
+ - lib/lifen_fhir.rb
157
+ - lib/lifen_fhir/app_authenticated_client.rb
158
+ - lib/lifen_fhir/attachment.rb
159
+ - lib/lifen_fhir/base.rb
160
+ - lib/lifen_fhir/binary.rb
161
+ - lib/lifen_fhir/category.rb
162
+ - lib/lifen_fhir/channel.rb
163
+ - lib/lifen_fhir/client.rb
164
+ - lib/lifen_fhir/communication_request.rb
165
+ - lib/lifen_fhir/configuration.rb
166
+ - lib/lifen_fhir/content_string.rb
167
+ - lib/lifen_fhir/error.rb
168
+ - lib/lifen_fhir/medium.rb
169
+ - lib/lifen_fhir/patient.rb
170
+ - lib/lifen_fhir/practitioner.rb
171
+ - lib/lifen_fhir/user_authenticated_client.rb
172
+ - lib/lifen_fhir/version.rb
173
+ - lifen_fhir.gemspec
174
+ - spec/binary_spec.rb
175
+ - spec/cassettes/binary/download/invalid.yml
176
+ - spec/cassettes/binary/download/valid.yml
177
+ - spec/cassettes/communication_request/send/invalid_medium.yml
178
+ - spec/cassettes/communication_request/send/valid_attributes.yml
179
+ - spec/cassettes/communication_request/send/valid_attributes_binary.yml
180
+ - spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml
181
+ - spec/cassettes/practitionner/create_channel/address/valid_attributes.yml
182
+ - spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml
183
+ - spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml
184
+ - spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml
185
+ - spec/cassettes/practitionner/find_by_rpps/wrong_rpps.yml
186
+ - spec/category_spec.rb
187
+ - spec/communication_request_spec.rb
188
+ - spec/practitionner_spec.rb
189
+ - spec/spec_helper.rb
190
+ - spec/support/master_plan.pdf
191
+ homepage: https://github.com/honestica/lifen-fhir
192
+ licenses:
193
+ - MIT
194
+ metadata: {}
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 2.6.11
212
+ signing_key:
213
+ specification_version: 4
214
+ summary: Lifen FHIR API Ruby client
215
+ test_files:
216
+ - spec/binary_spec.rb
217
+ - spec/cassettes/binary/download/invalid.yml
218
+ - spec/cassettes/binary/download/valid.yml
219
+ - spec/cassettes/communication_request/send/invalid_medium.yml
220
+ - spec/cassettes/communication_request/send/valid_attributes.yml
221
+ - spec/cassettes/communication_request/send/valid_attributes_binary.yml
222
+ - spec/cassettes/practitionner/create_channel/address/old_valid_attributes.yml
223
+ - spec/cassettes/practitionner/create_channel/address/valid_attributes.yml
224
+ - spec/cassettes/practitionner/create_channel/telecom/valid_attributes.yml
225
+ - spec/cassettes/practitionner/find_by_rpps/existing_rpps.yml
226
+ - spec/cassettes/practitionner/find_by_rpps/missing_line_attribute.yml
227
+ - spec/cassettes/practitionner/find_by_rpps/wrong_rpps.yml
228
+ - spec/category_spec.rb
229
+ - spec/communication_request_spec.rb
230
+ - spec/practitionner_spec.rb
231
+ - spec/spec_helper.rb
232
+ - spec/support/master_plan.pdf