workato-connector-sdk 1.3.10 → 1.3.11

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: a4307598e8aa6c86eb54f75b63648f20bc192be58e22a6a5f7c5aa0b4efefd01
4
- data.tar.gz: 1db7b500cec4f2e761a2ca3eb9d21c11b14b0a7b67c239f600348bbdac0ec393
3
+ metadata.gz: 956c62d7ff8d5f45ee006d40583f55839f13a725823c6c087b94689cce68dcb2
4
+ data.tar.gz: 267438cf0f54e21c622c90eb1f1ebf4430108ef1c0831a6b7102e3b82167b2d9
5
5
  SHA512:
6
- metadata.gz: d4e29f03eed4679751a90297de15988ac154cd83404da08a95484d2651c95c2bdc3aa7bc6a3647225bbb78776de222fe482ef846e21f0d6e8a5cc4d7953be620
7
- data.tar.gz: 9d82d01badd7c60f971d3b2bbecf452d6d80314a7833f414b05fd8eb4d6510d7c7328a7c893c99daa6b713c7a66714e4f04d086f4bf2161bfb114e6f08639a47
6
+ metadata.gz: 3f34ed256d0b3a598e84974ed12ba317b83211664c58aace84e87441e824022b120397822a59769c5780eee03eff0167328f9392ceaaffc2847ed9769c5f8415
7
+ data.tar.gz: b2f22c5f643b3a641d9a17819e991eba37c8f09774e27e3a2ad130df005089d636b095373d64c336767bf26bce0b0fd747a352bdb603af0639dba71d4853fcba
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.10
1
+ 1.3.11
@@ -14,7 +14,7 @@ module Workato
14
14
  end
15
15
 
16
16
  refine BasicObject do
17
- def instance_exec(*args, &block)
17
+ ruby2_keywords def instance_exec(*args, &block)
18
18
  super(*args.take(block.parameters.length), &block)
19
19
  end
20
20
  end
@@ -32,7 +32,7 @@ module Workato
32
32
 
33
33
  sig { params(stream_name: String, input: SorbetTypes::StreamInputHash).returns(Stream::Proxy) }
34
34
  def out(stream_name, input = {})
35
- Stream::Proxy.new(input: input, name: stream_name, stream: streams[stream_name])
35
+ Stream::Proxy.new(input: Request.response!(input), name: stream_name, stream: streams[stream_name])
36
36
  end
37
37
 
38
38
  private
@@ -139,6 +139,9 @@ module Workato
139
139
  end
140
140
 
141
141
  def parse_json(source)
142
+ source = source.response! if source.is_a?(Request)
143
+ return source unless source.is_a?(String)
144
+
142
145
  JSON.parse(source)
143
146
  rescue JSON::ParserError => e
144
147
  raise JSONParsingError, e
@@ -215,42 +215,21 @@ module Workato
215
215
  def schema_fields(object_definitions_hash, settings, config_fields, &schema_proc)
216
216
  return [] unless schema_proc
217
217
 
218
- execute(settings, config_fields) do |connection, input|
219
- T.unsafe(self).instance_exec(
220
- object_definitions_hash,
221
- connection,
222
- input,
223
- &schema_proc
224
- )
225
- end
218
+ Array.wrap(
219
+ execute(settings, config_fields) do |connection, input|
220
+ T.unsafe(self).instance_exec(
221
+ object_definitions_hash,
222
+ connection,
223
+ input,
224
+ &schema_proc
225
+ )
226
+ end
227
+ )
226
228
  end
227
229
 
228
230
  sig { params(request_or_result: T.untyped).returns(T.untyped) }
229
231
  def resolve_request(request_or_result)
230
- case request_or_result
231
- when Request
232
- resolve_request(request_or_result.response!)
233
- when ::Array
234
- request_or_result.each_with_index.inject(request_or_result) do |acc, (item, index)|
235
- response_item = resolve_request(item)
236
- if response_item.equal?(item)
237
- acc
238
- else
239
- (acc == request_or_result ? acc.dup : acc).tap { |a| a[index] = response_item }
240
- end
241
- end
242
- when ::Hash
243
- request_or_result.inject(request_or_result) do |acc, (key, value)|
244
- response_value = resolve_request(value)
245
- if response_value.equal?(value)
246
- acc
247
- else
248
- (acc == request_or_result ? acc.dup : acc).tap { |h| h[key] = response_value }
249
- end
250
- end
251
- else
252
- request_or_result
253
- end
232
+ Request.response!(request_or_result)
254
233
  end
255
234
 
256
235
  sig { params(value: T.untyped).returns(T.untyped) }
@@ -257,6 +257,38 @@ module Workato
257
257
  response!.try(...)
258
258
  end
259
259
 
260
+ class << self
261
+ extend T::Sig
262
+
263
+ sig { params(request_or_result: T.untyped).returns(T.untyped) }
264
+ def response!(request_or_result)
265
+ case request_or_result
266
+ when Request
267
+ response!(request_or_result.response!)
268
+ when ::Array
269
+ request_or_result.each_with_index.inject(request_or_result) do |acc, (item, index)|
270
+ response_item = response!(item)
271
+ if response_item.equal?(item)
272
+ acc
273
+ else
274
+ (acc == request_or_result ? acc.dup : acc).tap { |a| a[index] = response_item }
275
+ end
276
+ end
277
+ when ::Hash
278
+ request_or_result.inject(request_or_result) do |acc, (key, value)|
279
+ response_value = response!(value)
280
+ if response_value.equal?(value)
281
+ acc
282
+ else
283
+ (acc == request_or_result ? acc.dup : acc).tap { |h| h[key] = response_value }
284
+ end
285
+ end
286
+ else
287
+ request_or_result
288
+ end
289
+ end
290
+ end
291
+
260
292
  private
261
293
 
262
294
  DEFAULT_RENDER_REQUEST = ->(_) {}
@@ -567,7 +599,7 @@ module Workato
567
599
  end
568
600
 
569
601
  def net_http_object(hostname, port)
570
- net = super(hostname, port)
602
+ net = super
571
603
  net.extra_chain_cert = ssl_extra_chain_cert if ssl_extra_chain_cert
572
604
  net
573
605
  end
@@ -44,7 +44,7 @@ module Workato
44
44
  end
45
45
 
46
46
  def self.xmlschema(str)
47
- from_time(super(str))
47
+ from_time(super)
48
48
  end
49
49
  end
50
50
  end
@@ -10,7 +10,7 @@ module Workato
10
10
  module Response
11
11
  def create(body, net_http_res, request, start_time)
12
12
  body = decode_content_encoding(net_http_res, body)
13
- super(body, net_http_res, request, start_time)
13
+ super
14
14
  end
15
15
 
16
16
  private
@@ -98,7 +98,9 @@ module Workato
98
98
  end
99
99
 
100
100
  def +(other)
101
- super(other&.to_s)
101
+ Kernel.raise Workato::Connector::Sdk::ArgumentError, 'Cannot concatenate string with nil' if other.nil?
102
+
103
+ super(other.to_s)
102
104
  end
103
105
 
104
106
  def to_hex
@@ -49,7 +49,7 @@ module Workato
49
49
  SUMMARY_LENGTH = 128
50
50
 
51
51
  def initialize(str)
52
- super(str)
52
+ super
53
53
  force_encoding(Encoding::ASCII_8BIT)
54
54
  end
55
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workato-connector-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Abolmasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport