Class: KMExport::Reimporter
- Inherits:
-
Object
- Object
- KMExport::Reimporter
- Defined in:
- lib/reimporter.rb
Instance Method Summary collapse
Instance Method Details
#send_line_to_KM(line) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/reimporter.rb', line 17 def send_line_to_KM(line) identity = line.delete("_p") second_identity = line.delete("_p2") event = line.delete("_n") line["_d"] = 1 KMTS.alias(identity,second_identity) if second_identity KMTS.record(identity,event,line) if event KMTS.set(identity,line) unless event || second_identity end |
#send_to_KM(json, key) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/reimporter.rb', line 3 def send_to_KM(json, key) KMTS.init(key, :use_cron => false, :to_stderr => true) logs = JSON.parse(json) logs.each do |line| send_line_to_KM(line) STDOUT.print('.') end STDOUT.print('Reimportation process completed.') end |