lib/workato/connector/sdk/connector.rb in workato-connector-sdk-1.1.0 vs lib/workato/connector/sdk/connector.rb in workato-connector-sdk-1.2.0
- old
+ new
@@ -1,8 +1,10 @@
# typed: strict
# frozen_string_literal: true
+using Workato::Extension::HashWithIndifferentAccess
+
module Workato
module Connector
module Sdk
module SorbetTypes
SourceHash = T.type_alias { T.any(HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped]) }
@@ -19,13 +21,13 @@
new(eval(File.read(path_to_source_code), binding, path_to_source_code), settings) # rubocop:disable Security/Eval
end
sig { params(definition: SorbetTypes::SourceHash, settings: SorbetTypes::SettingsHash).void }
def initialize(definition, settings = {})
- @source = T.let(definition.with_indifferent_access, HashWithIndifferentAccess)
- @settings = T.let(settings.with_indifferent_access, HashWithIndifferentAccess)
- @connection_source = T.let(@source[:connection] || {}.with_indifferent_access, HashWithIndifferentAccess)
- @methods_source = T.let(@source[:methods] || {}.with_indifferent_access, HashWithIndifferentAccess)
+ @source = T.let(HashWithIndifferentAccess.wrap(definition), HashWithIndifferentAccess)
+ @settings = T.let(HashWithIndifferentAccess.wrap(settings), HashWithIndifferentAccess)
+ @connection_source = T.let(HashWithIndifferentAccess.wrap(@source[:connection]), HashWithIndifferentAccess)
+ @methods_source = T.let(HashWithIndifferentAccess.wrap(@source[:methods]), HashWithIndifferentAccess)
end
sig { params(path: String, params: T::Hash[Symbol, T.untyped]).returns(T.untyped) }
def invoke(path, params = {})
InvokePath.new(path: path, connector: self, params: params).call