Class: Workato::Connector::Sdk::Dsl::StreamPackage

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/workato/connector/sdk/dsl/stream_package.rb

Instance Method Summary collapse

Constructor Details

#initialize(streams:, connection:) ⇒ void

Parameters:



12
13
14
15
# File 'lib/workato/connector/sdk/dsl/stream_package.rb', line 12

def initialize(streams:, connection:)
  @streams = streams
  @connection = connection
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *_args) ⇒ void (private)

This method returns an undefined value.

Parameters:

  • symbol (String, Symbol)
  • _args (T.untyped)

Raises:



41
42
43
# File 'lib/workato/connector/sdk/dsl/stream_package.rb', line 41

def method_missing(symbol, *_args)
  raise UndefinedStdLibMethodError.new(symbol.to_s, 'workato.stream')
end

Instance Method Details

#in(stream, from: nil, frame_size: nil, &blk) ⇒ T.untyped

Parameters:

Returns:

  • (T.untyped)


25
26
27
28
29
30
31
# File 'lib/workato/connector/sdk/dsl/stream_package.rb', line 25

def in(stream, from: nil, frame_size: nil, &blk)
  if stream.is_a?(Hash) && stream[:__stream__] && stream[:chunks].nil?
    stream = out(stream[:name], stream[:input] || {})
  end

  Stream.each_chunk(stream: stream, from: from, frame_size: frame_size, &blk)
end

#out(stream_name, input = {}) ⇒ Stream::Proxy

Parameters:

Returns:



34
35
36
# File 'lib/workato/connector/sdk/dsl/stream_package.rb', line 34

def out(stream_name, input = {})
  Stream::Proxy.new(input: Request.response!(input), name: stream_name, stream: streams[stream_name])
end