inferno_core 0.4.38 → 0.4.39

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.
@@ -1,3 +1,4 @@
1
+ require_relative '../dsl/auth_info'
1
2
  require_relative '../dsl/oauth_credentials'
2
3
 
3
4
  module Inferno
@@ -21,7 +22,7 @@ module Inferno
21
22
  )
22
23
  end
23
24
 
24
- def load(test_session_id:, name:, type: 'text')
25
+ def load(test_session_id:, name:, type: 'text') # rubocop:disable Metrics/CyclomaticComplexity
25
26
  raw_value =
26
27
  self.class::Model
27
28
  .find(test_session_id:, name: name.to_s.downcase)
@@ -32,6 +33,8 @@ module Inferno
32
33
  DSL::OAuthCredentials.new(JSON.parse(raw_value || '{}'))
33
34
  when 'checkbox'
34
35
  JSON.parse(raw_value || '[]')
36
+ when 'auth_info'
37
+ DSL::AuthInfo.new(JSON.parse(raw_value || '{}'))
35
38
  else
36
39
  raw_value
37
40
  end
@@ -64,6 +67,8 @@ module Inferno
64
67
  serialize_checkbox_input(params)
65
68
  when 'oauth_credentials'
66
69
  serialize_oauth_credentials_input(params)
70
+ when 'auth_info'
71
+ serialize_auth_info(params)
67
72
  else
68
73
  raise Exceptions::UnknownSessionDataType, params
69
74
  end
@@ -103,6 +108,24 @@ module Inferno
103
108
  credentials.to_s
104
109
  end
105
110
 
111
+ def serialize_auth_info(params)
112
+ auth =
113
+ if params[:value].is_a? String
114
+ DSL::AuthInfo.new(JSON.parse(params[:value]))
115
+ elsif !params[:value].is_a? DSL::AuthInfo
116
+ raise Exceptions::BadSessionDataType.new(
117
+ params[:name],
118
+ DSL::AuthInfo.name,
119
+ params[:value].class
120
+ )
121
+ else
122
+ params[:value]
123
+ end
124
+
125
+ auth.name = params[:name]
126
+ auth.to_s
127
+ end
128
+
106
129
  class Model < Sequel::Model(db)
107
130
  many_to_one :test_session, class: 'Inferno::Repositories::TestSessions::Model', key: :test_session_id
108
131
  end
@@ -34,7 +34,7 @@ module Inferno
34
34
 
35
35
  # rack.after_reply is handled by puma, which doesn't process requests
36
36
  # in unit tests, so we manually run them when in the test environment
37
- env['rack.after_reply']&.each(&:call) if (ENV['APP_ENV'] = 'test')
37
+ env['rack.after_reply']&.each(&:call) if ENV['APP_ENV'] == 'test'
38
38
 
39
39
  response
40
40
  end
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.4.38'.freeze
3
+ VERSION = '0.4.39'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.38
4
+ version: 0.4.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-06-05 00:00:00.000000000 Z
13
+ date: 2024-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -643,6 +643,7 @@ files:
643
643
  - lib/inferno/db/schema.rb
644
644
  - lib/inferno/dsl.rb
645
645
  - lib/inferno/dsl/assertions.rb
646
+ - lib/inferno/dsl/auth_info.rb
646
647
  - lib/inferno/dsl/configurable.rb
647
648
  - lib/inferno/dsl/fhir_client.rb
648
649
  - lib/inferno/dsl/fhir_client_builder.rb