Class: Workato::Types::UnicodeString

Inherits:
String
  • Object
show all
Defined in:
lib/workato/types/unicode_string.rb

Overview

Explicit wrapper for unicode strings.

Workato runtime always converts a String to UnicodeString and binary data to Binary before execute an action.

Call action or trigger by name

SDK emulator applies trigger’s or action’s input/output schema and normalize string when invoke them by name. If you call an operation like this, then emulator passes input with UnicodeString or Binary to the operation

CLI

workato exec 'actions.test_action'
workato exec 'triggers.test_poll_trigger'

RSpec

connector.actions.test_action.invoke(input)
connector.triggers.test_poll_trigger.invoke(input)

Direct call to execute or poll block

Schema is not applied when call an action’s execute block directly. For example

CLI

workato exec 'actions.test_action.execute'

RSpec

connector.actions.test_action.execute(settings, input, input_schema, output_schema)

In that case if action’s code relies on methods of UnicodeString or Binary then this explicit wrapper should be used for correct behavior.

Examples:

input = {
  file_content: Workato::Types::Binary.new(File.read('/path/to/file.bin', 'wb')),
  file_name: Workato::Types::UnicodeString.new("Hello World!")
}

connector.actions.upload(settings, input)

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ UnicodeString



49
50
51
52
# File 'lib/workato/types/unicode_string.rb', line 49

def initialize(str)
  super(str, **{})
  encode!('UTF-8')
end

Instance Method Details

#binary?Boolean

Returns false for unicode strings



57
58
59
# File 'lib/workato/types/unicode_string.rb', line 57

def binary?
  false
end