Sha256: 4bfadfe8828588d03bcd735439ca2edf35bac44860a0d46cf9c8d04d989c9ee0

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

require_relative 'all_jobs_shared'

class JsonJob < Remi::Job
  source :source_data do
    fields(
      {
        :json_array => { type: :json },
        :json_hash  => { type: :json }
      }
    )
  end

  target :target_data do
    fields(
      {
        :second_element => {},
        :name_field     => {}
      }
    )
  end

  transform :main do
    Remi::SourceToTargetMap.apply(source_data.df, target_data.df, source_metadata: source_data.fields) do
      map source(:json_array) .target(:second_element)
        .transform(->(values) { values[1] })
      map source(:json_hash) .target(:name_field)
        .transform(->(json_hash) { json_hash['name'] })
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
remi-0.3.3 jobs/json_job.rb
remi-0.3.2 jobs/json_job.rb
remi-0.3.1 jobs/json_job.rb
remi-0.3.0 jobs/json_job.rb