Class: CPEE::Frames::InitFrame

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/cpee-frames/implementation.rb', line 74

def response
  data_dir = @a[1]
  Dir.mkdir(File.join(data_dir,@r.last)) rescue nil

  if !@p[0].value.to_s.empty?
    File.write(File.join(data_dir,@r.last,'style.url'),@p[0].value)
  end

  File.write(File.join(data_dir,@r.last,'frames.json'),JSON.dump(JSON.parse('{"data":[]}')))

  #for handler
  File.write(File.join(data_dir,@r.last,'dataelements.json'),JSON.dump(JSON.parse('{"data":[]}')))

  File.write(File.join(data_dir,@r.last,'info.json'),JSON.dump(JSON.parse('{"x_amount":' + @p[2].value + ', "y_amount":' + @p[3].value + ', "lang":"' + @p[4].value  + '", "langs":["' + @p[4].value +  '"], "document_name": "' + @p[5].value + '"}')))

  File.write(File.join(data_dir,@r.last,'callback'),@h['CPEE_CALLBACK'])
  File.write(File.join(data_dir,@r.last,'cpeeinstance.url'),@h['CPEE_INSTANCE_URL'])

  @a[0].send('new')
  nil
end