workato-connector-sdk 1.3.4 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/workato/cli/exec_command.rb +1 -1
  4. data/lib/workato/cli/main.rb +8 -8
  5. data/lib/workato/cli/oauth2_command.rb +1 -1
  6. data/lib/workato/connector/sdk/action.rb +2 -2
  7. data/lib/workato/connector/sdk/connection.rb +72 -37
  8. data/lib/workato/connector/sdk/connector.rb +92 -66
  9. data/lib/workato/connector/sdk/core.rb +18 -18
  10. data/lib/workato/connector/sdk/dsl/aws.rb +1 -3
  11. data/lib/workato/connector/sdk/dsl/reinvoke_after.rb +1 -2
  12. data/lib/workato/connector/sdk/dsl/workato_package.rb +6 -8
  13. data/lib/workato/connector/sdk/dsl.rb +13 -13
  14. data/lib/workato/connector/sdk/lookup_tables.rb +1 -3
  15. data/lib/workato/connector/sdk/object_definitions.rb +4 -4
  16. data/lib/workato/connector/sdk/operation.rb +27 -23
  17. data/lib/workato/connector/sdk/request.rb +18 -23
  18. data/lib/workato/connector/sdk/schema/field/array.rb +1 -1
  19. data/lib/workato/connector/sdk/schema/field/date.rb +1 -1
  20. data/lib/workato/connector/sdk/schema/field/date_time.rb +1 -1
  21. data/lib/workato/connector/sdk/schema/field/integer.rb +1 -1
  22. data/lib/workato/connector/sdk/schema/field/number.rb +1 -1
  23. data/lib/workato/connector/sdk/schema/field/object.rb +1 -1
  24. data/lib/workato/connector/sdk/schema/field/string.rb +1 -1
  25. data/lib/workato/connector/sdk/schema.rb +11 -13
  26. data/lib/workato/connector/sdk/settings.rb +5 -5
  27. data/lib/workato/connector/sdk/stream.rb +1 -3
  28. data/lib/workato/connector/sdk/streams.rb +0 -2
  29. data/lib/workato/connector/sdk/trigger.rb +6 -8
  30. data/lib/workato/connector/sdk.rb +1 -2
  31. data/lib/workato/extension/currency.rb +2 -2
  32. data/lib/workato/extension/enumerable.rb +1 -1
  33. data/lib/workato/{extension → utilities}/hash_with_indifferent_access.rb +7 -4
  34. data/lib/workato/utilities/xml.rb +1 -1
  35. metadata +3 -3
@@ -4,8 +4,6 @@
4
4
  require 'aws-sigv4'
5
5
  require 'workato/utilities/xml'
6
6
 
7
- using Workato::Extension::HashWithIndifferentAccess
8
-
9
7
  module Workato
10
8
  module Connector
11
9
  module Sdk
@@ -68,7 +66,7 @@ module Workato
68
66
  method: method,
69
67
  path: path,
70
68
  params: params,
71
- headers: HashWithIndifferentAccess.wrap(headers),
69
+ headers: Utilities::HashWithIndifferentAccess.wrap(headers),
72
70
  payload: payload
73
71
  )
74
72
 
@@ -74,8 +74,7 @@ module Workato
74
74
 
75
75
  sig { returns(Integer) }
76
76
  def reinvoke_limit
77
- @reinvoke_limit = T.let(@reinvoke_limit, T.nilable(Integer))
78
- @reinvoke_limit ||= (ENV['MAX_REINVOKES'].presence || MAX_REINVOKES).to_i
77
+ @reinvoke_limit ||= T.let((ENV['MAX_REINVOKES'].presence || MAX_REINVOKES).to_i, T.nilable(Integer))
79
78
  end
80
79
  end
81
80
  end
@@ -2,11 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'jwt'
5
- require_relative './csv_package'
6
- require_relative './net_package'
7
- require_relative './stream_package'
8
-
9
- using Workato::Extension::HashWithIndifferentAccess
5
+ require_relative 'csv_package'
6
+ require_relative 'net_package'
7
+ require_relative 'stream_package'
10
8
 
11
9
  module Workato
12
10
  module Connector
@@ -72,9 +70,9 @@ module Workato
72
70
  end
73
71
  end
74
72
 
75
- header_fields = HashWithIndifferentAccess.wrap(header_fields)
76
- .except(:typ, :alg)
77
- .reverse_merge(typ: 'JWT', alg: algorithm)
73
+ header_fields = Utilities::HashWithIndifferentAccess.wrap(header_fields)
74
+ .except(:typ, :alg)
75
+ .reverse_merge(typ: 'JWT', alg: algorithm)
78
76
 
79
77
  ::JWT.encode(payload, key, algorithm, header_fields)
80
78
  rescue JWT::IncorrectAlgorithm
@@ -1,19 +1,19 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './block_invocation_refinements'
5
-
6
- require_relative './dsl/http'
7
- require_relative './dsl/call'
8
- require_relative './dsl/reinvoke_after'
9
- require_relative './dsl/error'
10
- require_relative './dsl/account_property'
11
- require_relative './dsl/lookup_table'
12
- require_relative './dsl/workato_package'
13
- require_relative './dsl/workato_schema'
14
- require_relative './dsl/time'
15
- require_relative './dsl/aws'
16
- require_relative './dsl/execution_context'
4
+ require_relative 'block_invocation_refinements'
5
+
6
+ require_relative 'dsl/http'
7
+ require_relative 'dsl/call'
8
+ require_relative 'dsl/reinvoke_after'
9
+ require_relative 'dsl/error'
10
+ require_relative 'dsl/account_property'
11
+ require_relative 'dsl/lookup_table'
12
+ require_relative 'dsl/workato_package'
13
+ require_relative 'dsl/workato_schema'
14
+ require_relative 'dsl/time'
15
+ require_relative 'dsl/aws'
16
+ require_relative 'dsl/execution_context'
17
17
 
18
18
  module Workato
19
19
  module Connector
@@ -4,8 +4,6 @@
4
4
  require 'csv'
5
5
  require 'singleton'
6
6
 
7
- using Workato::Extension::HashWithIndifferentAccess
8
-
9
7
  module Workato
10
8
  module Connector
11
9
  module Sdk
@@ -42,7 +40,7 @@ module Workato
42
40
  @table_by_id ||= {}
43
41
  @table_by_name ||= {}
44
42
  data.each do |name, table|
45
- table = HashWithIndifferentAccess.wrap(table)
43
+ table = Utilities::HashWithIndifferentAccess.wrap(table)
46
44
  rows = table['rows'].freeze
47
45
  @table_by_id[table['id'].to_i] = rows
48
46
  @table_by_name[name] = rows
@@ -1,13 +1,13 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './block_invocation_refinements'
4
+ require_relative 'block_invocation_refinements'
5
5
 
6
6
  module Workato
7
7
  module Connector
8
8
  module Sdk
9
9
  module SorbetTypes
10
- ObjectDefinitionOutput = T.type_alias { T::Array[HashWithIndifferentAccess] }
10
+ ObjectDefinitionOutput = T.type_alias { T::Array[ActiveSupport::HashWithIndifferentAccess] }
11
11
  end
12
12
 
13
13
  class ObjectDefinitions
@@ -34,7 +34,7 @@ module Workato
34
34
  params(
35
35
  settings: T.nilable(SorbetTypes::SettingsHash),
36
36
  config_fields: SorbetTypes::OperationInputHash
37
- ).returns(HashWithIndifferentAccess)
37
+ ).returns(ActiveSupport::HashWithIndifferentAccess)
38
38
  end
39
39
  def lazy(settings = nil, config_fields = {})
40
40
  DupHashWithIndifferentAccess.new do |object_definitions, name|
@@ -99,7 +99,7 @@ module Workato
99
99
 
100
100
  private_constant :ObjectDefinition
101
101
 
102
- class DupHashWithIndifferentAccess < HashWithIndifferentAccess
102
+ class DupHashWithIndifferentAccess < ActiveSupport::HashWithIndifferentAccess
103
103
  extend T::Sig
104
104
  extend T::Generic
105
105
 
@@ -1,11 +1,9 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './dsl'
5
- require_relative './block_invocation_refinements'
6
- require_relative './schema'
7
-
8
- using Workato::Extension::HashWithIndifferentAccess
4
+ require_relative 'dsl'
5
+ require_relative 'block_invocation_refinements'
6
+ require_relative 'schema'
9
7
 
10
8
  module Workato
11
9
  module Connector
@@ -15,11 +13,11 @@ module Workato
15
13
 
16
14
  OperationExecuteProc = T.type_alias do
17
15
  T.proc.params(
18
- arg0: HashWithIndifferentAccess,
19
- arg1: HashWithIndifferentAccess,
20
- arg2: T.any(Schema, T::Array[HashWithIndifferentAccess]),
21
- arg3: T.any(Schema, T::Array[HashWithIndifferentAccess]),
22
- arg4: HashWithIndifferentAccess
16
+ arg0: ActiveSupport::HashWithIndifferentAccess,
17
+ arg1: ActiveSupport::HashWithIndifferentAccess,
18
+ arg2: T.any(Schema, T::Array[ActiveSupport::HashWithIndifferentAccess]),
19
+ arg3: T.any(Schema, T::Array[ActiveSupport::HashWithIndifferentAccess]),
20
+ arg4: ActiveSupport::HashWithIndifferentAccess
23
21
  ).returns(
24
22
  T.untyped
25
23
  )
@@ -31,9 +29,9 @@ module Workato
31
29
 
32
30
  OperationSchemaProc = T.type_alias do
33
31
  T.proc.params(
34
- arg0: HashWithIndifferentAccess,
35
- arg1: HashWithIndifferentAccess,
36
- arg2: HashWithIndifferentAccess
32
+ arg0: ActiveSupport::HashWithIndifferentAccess,
33
+ arg1: ActiveSupport::HashWithIndifferentAccess,
34
+ arg2: ActiveSupport::HashWithIndifferentAccess
37
35
  ).returns(
38
36
  T.nilable(T.any(SorbetTypes::OperationSchema, T::Hash[T.any(Symbol, String), T.untyped]))
39
37
  )
@@ -66,8 +64,14 @@ module Workato
66
64
  end
67
65
  def initialize(operation: {}, methods: {}, connection: Connection.new, streams: ProhibitedStreams.new,
68
66
  object_definitions: nil)
69
- @operation = T.let(HashWithIndifferentAccess.wrap(operation), HashWithIndifferentAccess)
70
- @_methods = T.let(HashWithIndifferentAccess.wrap(methods), HashWithIndifferentAccess)
67
+ @operation = T.let(
68
+ Utilities::HashWithIndifferentAccess.wrap(operation),
69
+ ActiveSupport::HashWithIndifferentAccess
70
+ )
71
+ @_methods = T.let(
72
+ Utilities::HashWithIndifferentAccess.wrap(methods),
73
+ ActiveSupport::HashWithIndifferentAccess
74
+ )
71
75
  @connection = T.let(connection, Connection)
72
76
  @streams = T.let(streams, Streams)
73
77
  @object_definitions = T.let(object_definitions, T.nilable(ObjectDefinitions))
@@ -90,10 +94,10 @@ module Workato
90
94
  connection.merge_settings!(settings) if settings
91
95
  request_or_result = T.unsafe(self).instance_exec(
92
96
  connection.settings,
93
- HashWithIndifferentAccess.wrap(input),
94
- Array.wrap(extended_input_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
95
- Array.wrap(extended_output_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
96
- HashWithIndifferentAccess.wrap(continue),
97
+ Utilities::HashWithIndifferentAccess.wrap(input),
98
+ Array.wrap(extended_input_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
99
+ Array.wrap(extended_output_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
100
+ Utilities::HashWithIndifferentAccess.wrap(continue),
97
101
  &block
98
102
  )
99
103
  result = resolve_request(request_or_result)
@@ -105,7 +109,7 @@ module Workato
105
109
  settings: T.nilable(SorbetTypes::SettingsHash),
106
110
  config_fields: SorbetTypes::OperationInputHash
107
111
  ).returns(
108
- HashWithIndifferentAccess
112
+ ActiveSupport::HashWithIndifferentAccess
109
113
  )
110
114
  end
111
115
  def extended_schema(settings = nil, config_fields = {})
@@ -200,7 +204,7 @@ module Workato
200
204
 
201
205
  sig do
202
206
  params(
203
- object_definitions_hash: HashWithIndifferentAccess,
207
+ object_definitions_hash: ActiveSupport::HashWithIndifferentAccess,
204
208
  settings: T.nilable(SorbetTypes::SettingsHash),
205
209
  config_fields: SorbetTypes::OperationInputHash,
206
210
  schema_proc: T.nilable(SorbetTypes::OperationSchemaProc)
@@ -253,7 +257,7 @@ module Workato
253
257
  def try_convert_to_hash_with_indifferent_access(value)
254
258
  case value
255
259
  when ::Hash
256
- HashWithIndifferentAccess.wrap(value)
260
+ Utilities::HashWithIndifferentAccess.wrap(value)
257
261
  when ::Array
258
262
  value.map! { |i| try_convert_to_hash_with_indifferent_access(i) }
259
263
  else
@@ -266,7 +270,7 @@ module Workato
266
270
  T.must(@object_definitions)
267
271
  end
268
272
 
269
- sig { returns(HashWithIndifferentAccess) }
273
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
270
274
  attr_reader :operation
271
275
 
272
276
  sig { override.returns(Connection) }
@@ -11,9 +11,7 @@ require 'active_support/json'
11
11
 
12
12
  require 'workato/utilities/encoding'
13
13
  require 'workato/utilities/xml'
14
- require_relative './block_invocation_refinements'
15
-
16
- using Workato::Extension::HashWithIndifferentAccess
14
+ require_relative 'block_invocation_refinements'
17
15
 
18
16
  module Workato
19
17
  module Connector
@@ -77,7 +75,7 @@ module Workato
77
75
 
78
76
  def params(params)
79
77
  if params.is_a?(Hash)
80
- @params ||= HashWithIndifferentAccess.new
78
+ @params ||= ActiveSupport::HashWithIndifferentAccess.new
81
79
  @params.merge!(params)
82
80
  else
83
81
  @params = params
@@ -86,15 +84,11 @@ module Workato
86
84
  end
87
85
 
88
86
  def payload(payload = nil)
89
- case payload
90
- when Array
91
- @payload ||= []
92
- @payload += payload
93
- when NilClass
94
- # no-op
87
+ if defined?(@payload) || payload.is_a?(Hash)
88
+ @payload ||= ActiveSupport::HashWithIndifferentAccess.new
89
+ @payload.merge!(payload) if payload
95
90
  else
96
- @payload ||= {}.with_indifferent_access
97
- @payload.merge!(payload)
91
+ @payload = payload
98
92
  end
99
93
  yield(@payload) if Kernel.block_given?
100
94
  self
@@ -367,7 +361,7 @@ module Workato
367
361
  end
368
362
 
369
363
  def detect_auth_error!(response)
370
- return unless authorized?
364
+ return unless authorization? && connection.authorization.reauthorizable?
371
365
 
372
366
  error_patterns = connection.authorization.detect_on
373
367
  return unless error_patterns.any? { |pattern| pattern === response rescue false }
@@ -376,7 +370,7 @@ module Workato
376
370
  end
377
371
 
378
372
  def after_error_response_matches?(exception)
379
- return if @after_error_response_matches.blank?
373
+ return false if @after_error_response_matches.blank?
380
374
 
381
375
  @after_error_response_matches.find do |match|
382
376
  case match
@@ -394,14 +388,15 @@ module Workato
394
388
  within_action_context(
395
389
  exception.http_code,
396
390
  exception.http_body,
397
- HashWithIndifferentAccess.wrap(exception.http_headers),
391
+ Utilities::HashWithIndifferentAccess.wrap(exception.http_headers),
398
392
  exception.message,
399
393
  &@after_error_response
400
394
  )
401
395
  end
402
396
 
403
397
  def apply_after_response(code, parsed_response, headers)
404
- encoded_headers = (headers || {}).each_with_object(HashWithIndifferentAccess.new) do |(k, v), h|
398
+ headers ||= {}
399
+ encoded_headers = headers.each_with_object(ActiveSupport::HashWithIndifferentAccess.new) do |(k, v), h|
405
400
  h[k] = Workato::Utilities::Encoding.force_best_encoding!(v.to_s)
406
401
  end
407
402
  within_action_context(code, parsed_response, encoded_headers, &@after_response)
@@ -412,12 +407,12 @@ module Workato
412
407
  end
413
408
 
414
409
  sig { returns(T::Boolean) }
415
- def authorized?
410
+ def authorization?
416
411
  !!@connection&.authorization?
417
412
  end
418
413
 
419
414
  def authorized
420
- return yield unless authorized?
415
+ return yield unless authorization?
421
416
 
422
417
  apply = connection.authorization.source[:apply] || connection.authorization.source[:credentials]
423
418
  return yield unless apply
@@ -442,11 +437,11 @@ module Workato
442
437
 
443
438
  sig do
444
439
  params(
445
- settings: HashWithIndifferentAccess,
440
+ settings: ActiveSupport::HashWithIndifferentAccess,
446
441
  access_token: T.untyped,
447
442
  auth_type: T.untyped,
448
443
  apply_proc: T.proc.params(
449
- settings: HashWithIndifferentAccess,
444
+ settings: ActiveSupport::HashWithIndifferentAccess,
450
445
  access_token: T.untyped,
451
446
  auth_type: T.untyped
452
447
  ).void
@@ -458,10 +453,10 @@ module Workato
458
453
 
459
454
  sig do
460
455
  params(
461
- settings: HashWithIndifferentAccess,
456
+ settings: ActiveSupport::HashWithIndifferentAccess,
462
457
  auth_type: T.untyped,
463
458
  apply_proc: T.proc.params(
464
- settings: HashWithIndifferentAccess,
459
+ settings: ActiveSupport::HashWithIndifferentAccess,
465
460
  auth_type: T.untyped
466
461
  ).void
467
462
  ).void
@@ -472,7 +467,7 @@ module Workato
472
467
 
473
468
  sig do
474
469
  params(
475
- settings_before: HashWithIndifferentAccess,
470
+ settings_before: ActiveSupport::HashWithIndifferentAccess,
476
471
  http_code: T.nilable(Integer),
477
472
  http_body: T.nilable(String),
478
473
  exception: T.nilable(String)
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,7 +1,7 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './convertors'
4
+ require_relative 'convertors'
5
5
 
6
6
  module Workato
7
7
  module Connector
@@ -1,22 +1,20 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
9
7
  class Schema < SimpleDelegator
10
8
  def initialize(schema: [])
11
- super(Fields.new(::Array.wrap(schema).map { |i| HashWithIndifferentAccess.wrap(i) }))
9
+ super(Fields.new(::Array.wrap(schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) }))
12
10
  end
13
11
 
14
12
  def trim(input)
15
- HashWithIndifferentAccess.wrap(input).keep_if { |property_name| includes_property?(property_name) }
13
+ Utilities::HashWithIndifferentAccess.wrap(input).keep_if { |property_name| includes_property?(property_name) }
16
14
  end
17
15
 
18
16
  def apply(input, enforce_required:, &block)
19
- HashWithIndifferentAccess.wrap(input).tap do |input_with_indifferent_access|
17
+ Utilities::HashWithIndifferentAccess.wrap(input).tap do |input_with_indifferent_access|
20
18
  apply_to_hash(self, input_with_indifferent_access, enforce_required: enforce_required, &block)
21
19
  end
22
20
  end
@@ -225,12 +223,12 @@ module Workato
225
223
  end
226
224
  end
227
225
 
228
- require_relative './schema/field/array'
229
- require_relative './schema/field/date'
230
- require_relative './schema/field/date_time'
231
- require_relative './schema/field/integer'
232
- require_relative './schema/field/number'
233
- require_relative './schema/field/object'
234
- require_relative './schema/field/string'
226
+ require_relative 'schema/field/array'
227
+ require_relative 'schema/field/date'
228
+ require_relative 'schema/field/date_time'
229
+ require_relative 'schema/field/integer'
230
+ require_relative 'schema/field/number'
231
+ require_relative 'schema/field/object'
232
+ require_relative 'schema/field/string'
235
233
 
236
- require_relative './schema/type/time'
234
+ require_relative 'schema/type/time'
@@ -3,13 +3,13 @@
3
3
 
4
4
  require 'active_support/encrypted_configuration'
5
5
 
6
- using Workato::Extension::HashWithIndifferentAccess
7
-
8
6
  module Workato
9
7
  module Connector
10
8
  module Sdk
11
9
  module SorbetTypes
12
- SettingsHash = T.type_alias { T.any(HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped]) }
10
+ SettingsHash = T.type_alias do
11
+ T.any(ActiveSupport::HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped])
12
+ end
13
13
  end
14
14
 
15
15
  class Settings
@@ -100,13 +100,13 @@ module Workato
100
100
  end
101
101
 
102
102
  def read_encrypted_file
103
- all_settings = HashWithIndifferentAccess.wrap(encrypted_configuration.config)
103
+ all_settings = Utilities::HashWithIndifferentAccess.wrap(encrypted_configuration.config)
104
104
 
105
105
  (name ? all_settings.fetch(name) : all_settings) || {}
106
106
  end
107
107
 
108
108
  def update_encrypted_file(new_settings)
109
- all_settings = HashWithIndifferentAccess.wrap(encrypted_configuration.config)
109
+ all_settings = Utilities::HashWithIndifferentAccess.wrap(encrypted_configuration.config)
110
110
 
111
111
  merge_settings(all_settings, new_settings)
112
112
 
@@ -1,8 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
@@ -152,7 +150,7 @@ module Workato
152
150
  when Proc
153
151
  Proxy.new(
154
152
  name: hash[:name],
155
- input: HashWithIndifferentAccess.wrap(hash[:input] || {}),
153
+ input: Utilities::HashWithIndifferentAccess.wrap(hash[:input] || {}),
156
154
  stream: Stream.new(
157
155
  stream: hash[:chunks],
158
156
  connection: Connection.new(
@@ -1,8 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
@@ -3,8 +3,6 @@
3
3
 
4
4
  require 'securerandom'
5
5
 
6
- using Workato::Extension::HashWithIndifferentAccess
7
-
8
6
  module Workato
9
7
  module Connector
10
8
  module Sdk
@@ -145,14 +143,14 @@ module Workato
145
143
  )
146
144
  connection.merge_settings!(settings) if settings
147
145
  output = global_dsl_context.execute(
148
- HashWithIndifferentAccess.wrap(input),
146
+ Utilities::HashWithIndifferentAccess.wrap(input),
149
147
  payload,
150
- Array.wrap(extended_input_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
151
- Array.wrap(extended_output_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
152
- HashWithIndifferentAccess.wrap(headers),
153
- HashWithIndifferentAccess.wrap(params),
148
+ Array.wrap(extended_input_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
149
+ Array.wrap(extended_output_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
150
+ Utilities::HashWithIndifferentAccess.wrap(headers),
151
+ Utilities::HashWithIndifferentAccess.wrap(params),
154
152
  connection.settings,
155
- HashWithIndifferentAccess.wrap(webhook_subscribe_output),
153
+ Utilities::HashWithIndifferentAccess.wrap(webhook_subscribe_output),
156
154
  &trigger[:webhook_notification]
157
155
  )
158
156
  if output.is_a?(::Array)
@@ -18,7 +18,6 @@ require_relative '../extension/date'
18
18
  require_relative '../extension/enumerable'
19
19
  require_relative '../extension/extra_chain_cert'
20
20
  require_relative '../extension/hash'
21
- require_relative '../extension/hash_with_indifferent_access'
22
21
  require_relative '../extension/integer'
23
22
  require_relative '../extension/nil_class'
24
23
  require_relative '../extension/object'
@@ -27,7 +26,7 @@ require_relative '../extension/string'
27
26
  require_relative '../extension/symbol'
28
27
  require_relative '../extension/time'
29
28
 
30
- require_relative './sdk/core'
29
+ require_relative 'sdk/core'
31
30
 
32
31
  begin
33
32
  tz = ENV.fetch('TZ', nil)
@@ -1,8 +1,8 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative './currency/currencies'
5
- require_relative './currency/countries'
4
+ require_relative 'currency/currencies'
5
+ require_relative 'currency/countries'
6
6
 
7
7
  module Workato
8
8
  module Extension
@@ -18,7 +18,7 @@ module Enumerable
18
18
  end
19
19
 
20
20
  map do |val|
21
- format % (Array.wrap(val).map { |v| v.is_a?(HashWithIndifferentAccess) ? v.symbolize_keys : v })
21
+ format % (Array.wrap(val).map { |v| v.is_a?(ActiveSupport::HashWithIndifferentAccess) ? v.symbolize_keys : v })
22
22
  end
23
23
  end
24
24
 
@@ -1,14 +1,17 @@
1
- # typed: false
1
+ # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'active_support/hash_with_indifferent_access'
5
5
 
6
6
  module Workato
7
- module Extension
7
+ module Utilities
8
8
  module HashWithIndifferentAccess
9
- refine ::ActiveSupport::HashWithIndifferentAccess.singleton_class do
9
+ class << self
10
+ extend T::Sig
11
+
12
+ sig { params(value: T.untyped).returns(ActiveSupport::HashWithIndifferentAccess) }
10
13
  def wrap(value)
11
- return ::ActiveSupport::HashWithIndifferentAccess.new unless value
14
+ return ActiveSupport::HashWithIndifferentAccess.new unless value
12
15
  return value if value.is_a?(ActiveSupport::HashWithIndifferentAccess)
13
16
 
14
17
  value.with_indifferent_access
@@ -14,7 +14,7 @@ module Workato
14
14
  ancestors.shift while ancestors.count > node.depth + 1
15
15
  case node.node_type
16
16
  when Nokogiri::XML::Reader::TYPE_ELEMENT
17
- element = HashWithIndifferentAccess.new
17
+ element = ActiveSupport::HashWithIndifferentAccess.new
18
18
  node.attributes&.each do |name, value|
19
19
  element["@#{strip_namespaces ? name[/(?:^xmlns:)?[^:]+$/] : name}"] = value
20
20
  end