inferno_core 0.4.16 → 0.4.18

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
  SHA256:
3
- metadata.gz: a1d6de1522b60ed9f571f8a7e153cc17698a8ea7f6e31ddd1e56f8c3f566a65f
4
- data.tar.gz: a5098db0ddc0bfe9a713f8e84a6c24f9852a71a43b4ad88aa8331a0576a29c3d
3
+ metadata.gz: 9fc795a49145b262a250f35b8653e39c506313af4788f1b82ef274c4c4ea7960
4
+ data.tar.gz: 29214802809c59187e4923eaa9f8b1844ebab5f0dffa32738242721de55b4b85
5
5
  SHA512:
6
- metadata.gz: 2ea8f2e9d4912a696771f95c5078cf02b682da5b9d43afb7f4758b57af4b906c0b92e9ed75eaed663528f29dac898d211ec98bab35601ce7c906e34694b492cc
7
- data.tar.gz: 4944badab9dcd3042dbc8893b75babdcd1386e297870c131c48a23a62de102aee90fae63fa56748e7fceeab0e0e0316e91deb0a62012a85334f379a540797348
6
+ metadata.gz: 71c77cd25ddef3ea505359a81b1e979fdcf528e87587ad3b518e5389418a423bacd1965396d7a31f7b7ad3bef3b70465c63654dbb95bd7290e7e35d9f906f7dc
7
+ data.tar.gz: fc5abb31735fbc351084ee8ed8d385dbcfab4637bcea8338c58fa79bebcf5bb65314e33cc3e619b96b83b495aadd1225b4cf9f8267ff0c92b0394fad0f2cb57d
@@ -130,6 +130,78 @@ module Inferno
130
130
  end
131
131
  end
132
132
 
133
+ # Perform a FHIR vread interaction.
134
+ #
135
+ # @param resource_type [String, Symbol, Class]
136
+ # @param id [String]
137
+ # @param version_id [String]
138
+ # @param client [Symbol]
139
+ # @param name [Symbol] Name for this request to allow it to be used by
140
+ # other tests
141
+ # @return [Inferno::Entities::Request]
142
+ def fhir_vread(resource_type, id, version_id, client: :default, name: nil)
143
+ store_request_and_refresh_token(fhir_client(client), name) do
144
+ tcp_exception_handler do
145
+ fhir_client(client).vread(fhir_class_from_resource_type(resource_type), id, version_id)
146
+ end
147
+ end
148
+ end
149
+
150
+ # Perform a FHIR update interaction.
151
+ #
152
+ # @param resource [FHIR::Model]
153
+ # @param id [String]
154
+ # @param client [Symbol]
155
+ # @param name [Symbol] Name for this request to allow it to be used by
156
+ # other tests
157
+ # @return [Inferno::Entities::Request]
158
+ def fhir_update(resource, id, client: :default, name: nil)
159
+ store_request_and_refresh_token(fhir_client(client), name) do
160
+ tcp_exception_handler do
161
+ fhir_client(client).update(resource, id)
162
+ end
163
+ end
164
+ end
165
+
166
+ # Perform a FHIR patch interaction.
167
+ #
168
+ # @param resource_type [String, Symbol, Class]
169
+ # @param id [String]
170
+ # @param patchset [Array]
171
+ # @param client [Symbol]
172
+ # @param name [Symbol] Name for this request to allow it to be used by
173
+ # other tests
174
+ # @return [Inferno::Entities::Request]
175
+ def fhir_patch(resource_type, id, patchset, client: :default, name: nil)
176
+ store_request_and_refresh_token(fhir_client(client), name) do
177
+ tcp_exception_handler do
178
+ fhir_client(client).partial_update(fhir_class_from_resource_type(resource_type), id, patchset)
179
+ end
180
+ end
181
+ end
182
+
183
+ # Perform a FHIR history interaction.
184
+ #
185
+ # @param resource_type [String, Symbol, Class]
186
+ # @param id [String]
187
+ # @param client [Symbol]
188
+ # @param name [Symbol] Name for this request to allow it to be used by
189
+ # other tests
190
+ # @return [Inferno::Entities::Request]
191
+ def fhir_history(resource_type = nil, id = nil, client: :default, name: nil)
192
+ store_request_and_refresh_token(fhir_client(client), name) do
193
+ tcp_exception_handler do
194
+ if id
195
+ fhir_client(client).resource_instance_history(fhir_class_from_resource_type(resource_type), id)
196
+ elsif resource_type
197
+ fhir_client(client).resource_history(fhir_class_from_resource_type(resource_type))
198
+ else
199
+ fhir_client(client).all_history
200
+ end
201
+ end
202
+ end
203
+ end
204
+
133
205
  # Perform a FHIR search interaction.
134
206
  #
135
207
  # @param resource_type [String, Symbol, Class]
@@ -139,7 +211,7 @@ module Inferno
139
211
  # other tests
140
212
  # @param search_method [Symbol] Use `:post` to search via POST
141
213
  # @return [Inferno::Entities::Request]
142
- def fhir_search(resource_type, client: :default, params: {}, name: nil, search_method: :get)
214
+ def fhir_search(resource_type = nil, client: :default, params: {}, name: nil, search_method: :get)
143
215
  search =
144
216
  if search_method == :post
145
217
  { body: params }
@@ -149,8 +221,12 @@ module Inferno
149
221
 
150
222
  store_request_and_refresh_token(fhir_client(client), name) do
151
223
  tcp_exception_handler do
152
- fhir_client(client)
153
- .search(fhir_class_from_resource_type(resource_type), { search: })
224
+ if resource_type
225
+ fhir_client(client)
226
+ .search(fhir_class_from_resource_type(resource_type), { search: })
227
+ else
228
+ fhir_client(client).search_all({ search: })
229
+ end
154
230
  end
155
231
  end
156
232
  end
@@ -97,7 +97,16 @@ module Inferno
97
97
  # `error`.
98
98
  # @return [void]
99
99
  def check_configuration(&block)
100
- @check_configuration_block = block
100
+ @check_configuration_block = lambda do
101
+ block.call&.each do |configuration_message|
102
+ case configuration_message[:type]
103
+ when 'warning'
104
+ Application[:logger].warn(configuration_message[:message])
105
+ when 'error'
106
+ Application[:logger].error(configuration_message[:message])
107
+ end
108
+ end
109
+ end
101
110
  end
102
111
 
103
112
  # @private