inferno_core 0.3.11 → 0.4.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/lib/inferno/apps/cli/main.rb +13 -0
- data/lib/inferno/apps/cli/services.rb +56 -0
- data/lib/inferno/apps/web/application.rb +1 -0
- data/lib/inferno/apps/web/controllers/controller.rb +6 -8
- data/lib/inferno/apps/web/controllers/requests/show.rb +3 -3
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +13 -17
- data/lib/inferno/apps/web/controllers/test_runs/destroy.rb +8 -10
- data/lib/inferno/apps/web/controllers/test_runs/results/index.rb +4 -4
- data/lib/inferno/apps/web/controllers/test_runs/show.rb +9 -7
- data/lib/inferno/apps/web/controllers/test_sessions/create.rb +9 -8
- data/lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb +4 -4
- data/lib/inferno/apps/web/controllers/test_sessions/results/index.rb +6 -6
- data/lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb +10 -10
- data/lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb +5 -3
- data/lib/inferno/apps/web/controllers/test_sessions/show.rb +3 -3
- data/lib/inferno/apps/web/controllers/test_suites/check_configuration.rb +3 -3
- data/lib/inferno/apps/web/controllers/test_suites/index.rb +2 -2
- data/lib/inferno/apps/web/controllers/test_suites/show.rb +3 -3
- data/lib/inferno/apps/web/index.html.erb +4 -0
- data/lib/inferno/apps/web/router.rb +55 -41
- data/lib/inferno/apps/web/serializers/message.rb +2 -0
- data/lib/inferno/apps/web/serializers/preset.rb +2 -5
- data/lib/inferno/apps/web/serializers/request.rb +4 -1
- data/lib/inferno/apps/web/serializers/result.rb +5 -1
- data/lib/inferno/apps/web/serializers/session_data.rb +2 -0
- data/lib/inferno/apps/web/serializers/suite_option.rb +2 -0
- data/lib/inferno/apps/web/serializers/test.rb +3 -0
- data/lib/inferno/apps/web/serializers/test_group.rb +4 -2
- data/lib/inferno/apps/web/serializers/test_run.rb +3 -0
- data/lib/inferno/apps/web/serializers/test_suite.rb +5 -1
- data/lib/inferno/config/application.rb +1 -6
- data/lib/inferno/config/boot/web.rb +2 -7
- data/lib/inferno/config/boot.rb +6 -1
- data/lib/inferno/dsl/assertions.rb +2 -2
- data/lib/inferno/dsl/configurable.rb +4 -4
- data/lib/inferno/dsl/fhir_client.rb +3 -2
- data/lib/inferno/dsl/fhir_client_builder.rb +2 -2
- data/lib/inferno/dsl/fhir_validation.rb +5 -6
- data/lib/inferno/dsl/http_client.rb +17 -18
- data/lib/inferno/dsl/http_client_builder.rb +4 -4
- data/lib/inferno/dsl/input_output_handling.rb +1 -1
- data/lib/inferno/dsl/request_storage.rb +2 -2
- data/lib/inferno/dsl/resume_test_route.rb +36 -34
- data/lib/inferno/dsl/runnable.rb +13 -10
- data/lib/inferno/entities/header.rb +7 -7
- data/lib/inferno/entities/request.rb +35 -36
- data/lib/inferno/entities/session_data.rb +6 -6
- data/lib/inferno/entities/test.rb +4 -4
- data/lib/inferno/entities/test_group.rb +2 -2
- data/lib/inferno/entities/test_run.rb +1 -1
- data/lib/inferno/jobs/execute_test_run.rb +1 -1
- data/lib/inferno/jobs/resume_test_run.rb +1 -1
- data/lib/inferno/public/bundle.js +15 -15
- data/lib/inferno/repositories/messages.rb +1 -1
- data/lib/inferno/repositories/repository.rb +1 -1
- data/lib/inferno/repositories/requests.rb +6 -6
- data/lib/inferno/repositories/results.rb +16 -16
- data/lib/inferno/repositories/session_data.rb +6 -6
- data/lib/inferno/repositories/test_runs.rb +6 -6
- data/lib/inferno/repositories/test_sessions.rb +7 -7
- data/lib/inferno/test_runner.rb +3 -3
- data/lib/inferno/utils/preset_template_generator.rb +1 -1
- data/lib/inferno/version.rb +1 -1
- data/spec/factories/test_run.rb +1 -1
- data/spec/factories/test_session.rb +1 -1
- data/spec/fixtures/basic_test_suite.rb +1 -0
- metadata +25 -24
@@ -1,62 +1,76 @@
|
|
1
1
|
require 'erb'
|
2
2
|
|
3
|
+
Dir.glob(File.join(__dir__, 'controllers', '**', '*.rb')).each { |path| require_relative path }
|
4
|
+
|
3
5
|
module Inferno
|
4
6
|
module Web
|
5
7
|
client_page = ERB.new(File.read(File.join(Inferno::Application.root, 'lib', 'inferno', 'apps', 'web',
|
6
8
|
'index.html.erb'))).result
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
get '
|
10
|
+
base_path = Application['base_path']
|
11
|
+
base_path = "/#{base_path.delete_prefix('/')}" if base_path.present?
|
12
|
+
|
13
|
+
Router = Hanami::Router.new(prefix: base_path) do
|
14
|
+
scope 'api' do
|
15
|
+
scope 'test_runs' do
|
16
|
+
post '/', to: Inferno::Web::Controllers::TestRuns::Create, as: :create
|
17
|
+
get '/:id', to: Inferno::Web::Controllers::TestRuns::Show, as: :show
|
18
|
+
delete '/:id', to: Inferno::Web::Controllers::TestRuns::Destroy, as: :destroy
|
19
|
+
|
20
|
+
get '/results', to: Inferno::Web::Controllers::TestRuns::Results::Index, as: :results
|
21
|
+
end
|
22
|
+
|
23
|
+
scope 'test_sessions' do
|
24
|
+
post '/', to: Inferno::Web::Controllers::TestSessions::Create, as: :create
|
25
|
+
get '/:id', to: Inferno::Web::Controllers::TestSessions::Show, as: :show
|
26
|
+
|
27
|
+
get '/:id/last_test_run',
|
26
28
|
to: Inferno::Web::Controllers::TestSessions::LastTestRun,
|
27
29
|
as: :last_test_run
|
30
|
+
get '/:id/results',
|
31
|
+
to: Inferno::Web::Controllers::TestSessions::Results::Index,
|
32
|
+
as: :results
|
33
|
+
get '/:id/session_data',
|
34
|
+
to: Inferno::Web::Controllers::TestSessions::SessionData::Index
|
35
|
+
put '/:id/session_data/apply_preset',
|
36
|
+
to: Inferno::Web::Controllers::TestSessions::SessionData::ApplyPreset,
|
37
|
+
as: :session_data_apply_preset
|
38
|
+
end
|
28
39
|
|
29
|
-
|
30
|
-
|
40
|
+
scope 'test_suites' do
|
41
|
+
get '/', to: Inferno::Web::Controllers::TestSuites::Index, as: :index
|
42
|
+
get '/:id', to: Inferno::Web::Controllers::TestSuites::Show, as: :show
|
43
|
+
|
44
|
+
put '/:id/check_configuration',
|
31
45
|
to: Inferno::Web::Controllers::TestSuites::CheckConfiguration,
|
32
46
|
as: :check_configuration
|
47
|
+
end
|
33
48
|
|
34
|
-
|
49
|
+
get '/requests/:id', to: Inferno::Web::Controllers::Requests::Show, as: :requests_show
|
35
50
|
|
36
|
-
|
37
|
-
|
51
|
+
get '/version', to: ->(_env) { [200, {}, [{ 'version' => Inferno::VERSION.to_s }.to_json]] }, as: :version
|
52
|
+
end
|
38
53
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Inferno.routes.each do |route|
|
45
|
-
cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
|
46
|
-
path = "/custom/#{cleaned_id}#{route[:path]}"
|
47
|
-
Application['logger'].info("Registering custom route: #{path}")
|
48
|
-
if route[:method] == :all
|
49
|
-
mount route[:handler], at: path
|
50
|
-
else
|
51
|
-
send(route[:method], path, to: route[:handler])
|
52
|
-
end
|
53
|
-
end
|
54
|
+
# Should not need Content-Type header but GitHub Codespaces will not work without them.
|
55
|
+
# This could be investigated and likely removed if addressed properly elsewhere.
|
56
|
+
get '/', to: ->(_env) { [200, { 'Content-Type' => 'text/html' }, [client_page]] }
|
57
|
+
get '/test_sessions/:id', to: ->(_env) { [200, { 'Content-Type' => 'text/html' }, [client_page]] }
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
Inferno.routes.each do |route|
|
60
|
+
cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
|
61
|
+
path = "/custom/#{cleaned_id}#{route[:path]}"
|
62
|
+
Application['logger'].info("Registering custom route: #{path}")
|
63
|
+
if route[:method] == :all
|
64
|
+
mount route[:handler], at: path
|
65
|
+
else
|
66
|
+
send(route[:method], path, to: route[:handler])
|
58
67
|
end
|
59
68
|
end
|
69
|
+
|
70
|
+
Inferno::Repositories::TestSuites.all.map { |suite| "/#{suite.id}" }.each do |suite_path|
|
71
|
+
Application['logger'].info("Registering suite route: #{suite_path}")
|
72
|
+
get suite_path, to: ->(_env) { [200, {}, [client_page]] }
|
73
|
+
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'serializer'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Serializers
|
@@ -6,11 +8,6 @@ module Inferno
|
|
6
8
|
identifier :id
|
7
9
|
field :title
|
8
10
|
end
|
9
|
-
|
10
|
-
# view :full do
|
11
|
-
# include_view :summary
|
12
|
-
# field :inputs, blueprint: Input
|
13
|
-
# end
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'json'
|
2
|
+
require_relative 'message'
|
3
|
+
require_relative 'request'
|
2
4
|
|
3
5
|
module Inferno
|
4
6
|
module Web
|
@@ -27,7 +29,9 @@ module Inferno
|
|
27
29
|
end
|
28
30
|
|
29
31
|
association :messages, blueprint: Message, if: :field_present?
|
30
|
-
|
32
|
+
field :requests do |result, _options|
|
33
|
+
Request.render_as_hash(result.requests.sort_by(&:index), view: :summary)
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'test'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Serializers
|
@@ -19,11 +21,11 @@ module Inferno
|
|
19
21
|
end
|
20
22
|
field :test_groups do |group, options|
|
21
23
|
suite_options = options[:suite_options]
|
22
|
-
TestGroup.render_as_hash(group.groups(suite_options), suite_options:
|
24
|
+
TestGroup.render_as_hash(group.groups(suite_options), suite_options:)
|
23
25
|
end
|
24
26
|
field :tests do |group, options|
|
25
27
|
suite_options = options[:suite_options]
|
26
|
-
Test.render_as_hash(group.tests(suite_options), suite_options:
|
28
|
+
Test.render_as_hash(group.tests(suite_options), suite_options:)
|
27
29
|
end
|
28
30
|
field :inputs do |group, options|
|
29
31
|
suite_options = options[:suite_options]
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require_relative 'preset'
|
2
|
+
require_relative 'suite_option'
|
3
|
+
require_relative 'test_group'
|
4
|
+
|
1
5
|
module Inferno
|
2
6
|
module Web
|
3
7
|
module Serializers
|
@@ -25,7 +29,7 @@ module Inferno
|
|
25
29
|
include_view :summary
|
26
30
|
field :test_groups do |suite, options|
|
27
31
|
suite_options = options[:suite_options]
|
28
|
-
TestGroup.render_as_hash(suite.groups(suite_options), suite_options:
|
32
|
+
TestGroup.render_as_hash(suite.groups(suite_options), suite_options:)
|
29
33
|
end
|
30
34
|
field :configuration_messages
|
31
35
|
field :inputs do |suite, options|
|
@@ -25,13 +25,8 @@ module Inferno
|
|
25
25
|
|
26
26
|
configure do |config|
|
27
27
|
config.root = File.expand_path('../../..', __dir__)
|
28
|
-
config.default_namespace = 'inferno'
|
29
|
-
config.system_dir = File.join('lib', 'inferno', 'config')
|
30
28
|
config.bootable_dirs = [File.join('lib', 'inferno', 'config', 'boot')]
|
31
|
-
|
32
|
-
config.auto_register = 'lib'
|
29
|
+
config.component_dirs.add 'lib'
|
33
30
|
end
|
34
|
-
|
35
|
-
load_paths!('lib')
|
36
31
|
end
|
37
32
|
end
|
@@ -1,15 +1,10 @@
|
|
1
1
|
Inferno::Application.boot(:web) do |_app|
|
2
2
|
init do
|
3
3
|
require 'blueprinter'
|
4
|
-
require 'hanami
|
5
|
-
require 'hanami
|
4
|
+
require 'hanami/router'
|
5
|
+
require 'hanami/controller'
|
6
6
|
require 'oj'
|
7
7
|
|
8
|
-
Hanami::Controller.configure do
|
9
|
-
default_request_format :json
|
10
|
-
default_response_format :json
|
11
|
-
end
|
12
|
-
|
13
8
|
Blueprinter.configure do |config|
|
14
9
|
config.generator = Oj
|
15
10
|
end
|
data/lib/inferno/config/boot.rb
CHANGED
@@ -4,4 +4,9 @@ ENV['APP_ENV'] ||= 'development'
|
|
4
4
|
|
5
5
|
root_path = Dir.pwd
|
6
6
|
|
7
|
-
Dotenv.load(
|
7
|
+
Dotenv.load(
|
8
|
+
File.join(root_path, ".env.#{ENV.fetch('APP_ENV', nil)}.local"),
|
9
|
+
File.join(root_path, '.env.local'),
|
10
|
+
File.join(root_path, ".env.#{ENV.fetch('APP_ENV', nil)}"),
|
11
|
+
File.join(root_path, '.env')
|
12
|
+
)
|
@@ -58,7 +58,7 @@ module Inferno
|
|
58
58
|
# @param profile_url [String] url of the profile to validate against,
|
59
59
|
# defaults to validating against the base FHIR resource
|
60
60
|
def assert_valid_resource(resource: self.resource, profile_url: nil)
|
61
|
-
assert resource_is_valid?(resource
|
61
|
+
assert resource_is_valid?(resource:, profile_url:),
|
62
62
|
invalid_resource_message(profile_url)
|
63
63
|
end
|
64
64
|
|
@@ -100,7 +100,7 @@ module Inferno
|
|
100
100
|
.map(&:resource)
|
101
101
|
.select { |resource| types_to_check.empty? || types_to_check.include?(resource.resourceType) }
|
102
102
|
.reject do |resource|
|
103
|
-
validation_params = { resource:
|
103
|
+
validation_params = { resource: }
|
104
104
|
profile = types_to_check[resource.resourceType]
|
105
105
|
validation_params[:profile_url] = profile if profile
|
106
106
|
|
@@ -37,7 +37,7 @@ module Inferno
|
|
37
37
|
new_configuration
|
38
38
|
end
|
39
39
|
|
40
|
-
self.configuration = configuration.deep_merge(config_to_apply.
|
40
|
+
self.configuration = configuration.deep_merge(config_to_apply.except(:inputs))
|
41
41
|
|
42
42
|
config_to_apply[:inputs]&.each do |identifier, new_input|
|
43
43
|
add_input(identifier, new_input.to_hash)
|
@@ -58,13 +58,13 @@ module Inferno
|
|
58
58
|
existing_config = input(identifier)
|
59
59
|
|
60
60
|
if existing_config.nil?
|
61
|
-
return inputs[identifier] = Entities::Input.new(default_input_params(identifier).merge(new_config))
|
61
|
+
return inputs[identifier] = Entities::Input.new(**default_input_params(identifier).merge(new_config))
|
62
62
|
end
|
63
63
|
|
64
64
|
inputs[identifier] =
|
65
65
|
Entities::Input
|
66
|
-
.new(existing_config.to_hash)
|
67
|
-
.merge(Entities::Input.new(new_config))
|
66
|
+
.new(**existing_config.to_hash)
|
67
|
+
.merge(Entities::Input.new(**new_config))
|
68
68
|
end
|
69
69
|
|
70
70
|
def default_input_params(identifier)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'fhir_client_builder'
|
1
2
|
require_relative 'request_storage'
|
2
3
|
require_relative 'tcp_exception_handler'
|
3
4
|
|
@@ -136,7 +137,7 @@ module Inferno
|
|
136
137
|
store_request_and_refresh_token(fhir_client(client), name) do
|
137
138
|
tcp_exception_handler do
|
138
139
|
fhir_client(client)
|
139
|
-
.search(fhir_class_from_resource_type(resource_type), { search:
|
140
|
+
.search(fhir_class_from_resource_type(resource_type), { search: })
|
140
141
|
end
|
141
142
|
end
|
142
143
|
end
|
@@ -194,7 +195,7 @@ module Inferno
|
|
194
195
|
name: credentials.name,
|
195
196
|
value: credentials,
|
196
197
|
type: 'oauth_credentials',
|
197
|
-
test_session_id:
|
198
|
+
test_session_id:
|
198
199
|
)
|
199
200
|
end
|
200
201
|
rescue StandardError => e
|
@@ -73,8 +73,8 @@ module Inferno
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# @private
|
76
|
-
def method_missing(name, *args, &
|
77
|
-
return runnable.call(name, *args, &
|
76
|
+
def method_missing(name, *args, &)
|
77
|
+
return runnable.call(name, *args, &) if runnable.respond_to? name
|
78
78
|
|
79
79
|
super
|
80
80
|
end
|
@@ -45,8 +45,8 @@ module Inferno
|
|
45
45
|
attr_reader :requirements
|
46
46
|
|
47
47
|
# @private
|
48
|
-
def initialize(requirements = nil, &
|
49
|
-
instance_eval(&
|
48
|
+
def initialize(requirements = nil, &)
|
49
|
+
instance_eval(&)
|
50
50
|
@requirements = requirements
|
51
51
|
end
|
52
52
|
|
@@ -172,11 +172,10 @@ module Inferno
|
|
172
172
|
# @param profile_url [String]
|
173
173
|
# @return [String] the body of the validation response
|
174
174
|
def validate(resource, profile_url)
|
175
|
-
|
176
|
-
|
177
|
-
resource.source_contents,
|
175
|
+
Faraday.new(
|
176
|
+
url,
|
178
177
|
params: { profile: profile_url }
|
179
|
-
).body
|
178
|
+
).post('validate', resource.source_contents).body
|
180
179
|
end
|
181
180
|
end
|
182
181
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'faraday_middleware'
|
2
2
|
|
3
|
+
require_relative 'http_client_builder'
|
3
4
|
require_relative 'request_storage'
|
4
5
|
require_relative 'tcp_exception_handler'
|
5
6
|
|
@@ -66,18 +67,17 @@ module Inferno
|
|
66
67
|
# @param client [Symbol]
|
67
68
|
# @param name [Symbol] Name for this request to allow it to be used by
|
68
69
|
# other tests
|
69
|
-
# @
|
70
|
-
# must be entered as the last piece of input to this method
|
70
|
+
# @param headers [Hash] Input headers here
|
71
71
|
# @return [Inferno::Entities::Request]
|
72
|
-
def get(url = '', client: :default, name: nil,
|
72
|
+
def get(url = '', client: :default, name: nil, headers: nil)
|
73
73
|
store_request('outgoing', name) do
|
74
74
|
tcp_exception_handler do
|
75
75
|
client = http_client(client)
|
76
76
|
|
77
77
|
if client
|
78
|
-
client.get(url, nil,
|
78
|
+
client.get(url, nil, headers)
|
79
79
|
elsif url.match?(%r{\Ahttps?://})
|
80
|
-
connection.get(url, nil,
|
80
|
+
connection.get(url, nil, headers)
|
81
81
|
else
|
82
82
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
83
83
|
end
|
@@ -102,18 +102,17 @@ module Inferno
|
|
102
102
|
# @param client [Symbol]
|
103
103
|
# @param name [Symbol] Name for this request to allow it to be used by
|
104
104
|
# other tests
|
105
|
-
# @
|
106
|
-
# must be entered as the last piece of input to this method
|
105
|
+
# @param headers [Hash] Input headers here
|
107
106
|
# @return [Inferno::Entities::Request]
|
108
|
-
def post(url = '', body: nil, client: :default, name: nil,
|
107
|
+
def post(url = '', body: nil, client: :default, name: nil, headers: nil)
|
109
108
|
store_request('outgoing', name) do
|
110
109
|
tcp_exception_handler do
|
111
110
|
client = http_client(client)
|
112
111
|
|
113
112
|
if client
|
114
|
-
client.post(url, body,
|
113
|
+
client.post(url, body, headers)
|
115
114
|
elsif url.match?(%r{\Ahttps?://})
|
116
|
-
connection.post(url, body,
|
115
|
+
connection.post(url, body, headers)
|
117
116
|
else
|
118
117
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
119
118
|
end
|
@@ -129,16 +128,17 @@ module Inferno
|
|
129
128
|
# @param client [Symbol]
|
130
129
|
# @param name [Symbol] Name for this request to allow it to be used by
|
131
130
|
# other tests
|
131
|
+
# @param headers [Hash] Input headers here
|
132
132
|
# @return [Inferno::Entities::Request]
|
133
|
-
def delete(url = '', client: :default, name: :nil,
|
133
|
+
def delete(url = '', client: :default, name: :nil, headers: nil)
|
134
134
|
store_request('outgoing', name) do
|
135
135
|
tcp_exception_handler do
|
136
136
|
client = http_client(client)
|
137
137
|
|
138
138
|
if client
|
139
|
-
client.delete(url, nil,
|
139
|
+
client.delete(url, nil, headers)
|
140
140
|
elsif url.match?(%r{\Ahttps?://})
|
141
|
-
connection.delete(url, nil,
|
141
|
+
connection.delete(url, nil, headers)
|
142
142
|
else
|
143
143
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
144
144
|
end
|
@@ -158,10 +158,9 @@ module Inferno
|
|
158
158
|
# @param client [Symbol]
|
159
159
|
# @param name [Symbol] Name for this request to allow it to be used by
|
160
160
|
# other tests
|
161
|
-
# @
|
162
|
-
# must be entered as the last piece of input to this method
|
161
|
+
# @param headers [Hash] Input headers here
|
163
162
|
# @return [Inferno::Entities::Request]
|
164
|
-
def stream(block, url = '', limit = 100, client: :default, name: nil,
|
163
|
+
def stream(block, url = '', limit = 100, client: :default, name: nil, headers: nil)
|
165
164
|
streamed = []
|
166
165
|
|
167
166
|
collector = proc do |chunk, bytes|
|
@@ -175,9 +174,9 @@ module Inferno
|
|
175
174
|
client = http_client(client)
|
176
175
|
|
177
176
|
if client
|
178
|
-
response = client.get(url, nil,
|
177
|
+
response = client.get(url, nil, headers) { |req| req.options.on_data = collector }
|
179
178
|
elsif url.match?(%r{\Ahttps?://})
|
180
|
-
response = connection.get(url, nil,
|
179
|
+
response = connection.get(url, nil, headers) { |req| req.options.on_data = collector }
|
181
180
|
else
|
182
181
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
183
182
|
end
|
@@ -11,8 +11,8 @@ module Inferno
|
|
11
11
|
self.runnable = runnable
|
12
12
|
instance_exec(self, &block)
|
13
13
|
|
14
|
-
params = { url:
|
15
|
-
params.merge!(headers:
|
14
|
+
params = { url: }
|
15
|
+
params.merge!(headers:) if headers
|
16
16
|
|
17
17
|
Faraday.new(params) do |f|
|
18
18
|
f.request :url_encoded
|
@@ -44,8 +44,8 @@ module Inferno
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# @private
|
47
|
-
def method_missing(name, *args, &
|
48
|
-
return runnable.call(name, *args, &
|
47
|
+
def method_missing(name, *args, &)
|
48
|
+
return runnable.call(name, *args, &) if runnable.respond_to? name
|
49
49
|
|
50
50
|
super
|
51
51
|
end
|
@@ -183,7 +183,7 @@ module Inferno
|
|
183
183
|
config.inputs
|
184
184
|
.slice(*inputs)
|
185
185
|
.each_with_object({}) do |(_, input), inputs|
|
186
|
-
inputs[input.name.to_sym] = Entities::Input.new(input.to_hash)
|
186
|
+
inputs[input.name.to_sym] = Entities::Input.new(**input.to_hash)
|
187
187
|
end
|
188
188
|
|
189
189
|
available_inputs.each do |input, current_definition|
|
@@ -49,11 +49,11 @@ module Inferno
|
|
49
49
|
request =
|
50
50
|
if response.is_a? FHIR::ClientReply
|
51
51
|
Entities::Request.from_fhir_client_reply(
|
52
|
-
response, direction
|
52
|
+
response, direction:, name:, test_session_id:
|
53
53
|
)
|
54
54
|
else
|
55
55
|
Entities::Request.from_http_response(
|
56
|
-
response, direction
|
56
|
+
response, direction:, name:, test_session_id:
|
57
57
|
)
|
58
58
|
end
|
59
59
|
|