Class: CPEE::Frames::Handler

Inherits:
Riddl::Implementation
  • Object
show all
Defined in:
lib/cpee-frames/implementation.rb

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/cpee-frames/implementation.rb', line 392

def response
  data_dir      = @a[1]
  topic         = @p[1].value
  event_name    = @p[2].value
  notification  = JSON.parse(@p[3].value.read)

  instancenr = notification['instance']
  content = notification['content']
  activity = content['activity']
  parameters = content['parameters']
  receiving = content['received']

  #puts instancenr
  #puts activity
  puts content['values']


  if content['values']&.any?
    #puts alldata['ausfuehrungen']
    puts "writing file"
    path = File.join(data_dir,@r[0],'dataelements.json')
    File.write(path, JSON.dump(content['values']))
  end

  @a[0].send(@r[0])
  nil
end