FileTransform ​File​Transform

yaml
type: "io.kestra.plugin.graalvm.ruby.filetransform"
yaml
id: transformRuby
namespace: company.team

tasks:
  - id: download
    type: io.kestra.plugin.core.http.Download
    uri: https://dummyjson.com/carts/1
  - id: jsonToIon
    type: io.kestra.plugin.serdes.json.JsonToIon
    from: "{{outputs.download.uri}}"
  - id: transformRuby
    type: io.kestra.plugin.graalvm.ruby.FileTransform
    from: "{{ outputs.jsonToIon.uri }}"
    script: |
      row = Polyglot.import('row')
      if row[:id] == 55
        # remove un-needed row
        Polyglot.export('row', nil)
      else
        # remove the 'products' column
        row[:products] = nil
        # add a 'totalItems' column
        row[:totalItems] = row[:totalProducts] * row[:totalQuantity]
      end
Properties
Format uri