Sha256: d55f47eb74930e50c7a1ad4e298581bed106a06d9d12c4243c65ed2da2f7a360
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require 'helper' require 'csv' require 'open-uri' require 'seedreader' require 'csvseedreader' require 'sqlseedreader' require 'xmlseedreader' require 'jsonseedreader' module I2X ## # = CSVDetector # # Detect changes in CSV files (using column numbers). # class CSVDetector < Detector public ## # == Detect the changes # def detect object begin CSV.new(open(object[:uri]), :headers => :first_row).each do |row| unless object[:cache].nil? then @cache = Cashier.verify row[object[:cache].to_i], object, row, object[:seed] else @cache = Cashier.verify row[0], object, row, object[:seed] end # The actual processing # if @cache[:status] == 100 then # add row data to payload from selectors (key => key, value => column name) payload = Hash.new JSON.parse(object[:selectors]).each do |selector| selector.each do |k,v| payload[k] = row[v.to_i] end end # add payload object to payloads list @payloads.push payload end end rescue Exception => e I2X::Slog.exception e end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i2x-0.0.3 | lib/i2x/csvdetector.rb |