Class: CPEE::Frames::Delete

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/cpee-frames/implementation.rb', line 232

def response
  data_dir = @a[1]
  pp "in delete"
  if cbu = File.read(File.join(data_dir,@r.last,'callback'))
    send = { 'operation' => @p[0].value }
    case send['operation']
      when 'result'
        send['target'] = JSON::parse(@p[1].value.read)
    end
    cbu += '/' unless cbu[-1] == '/'
    pp "Sending"
    Typhoeus.put(cbu, body: JSON::generate(send), headers: { 'content-type' => 'application/json'})
  end

  # File.unlink(File.join(data_dir,@r.last,'callback')) rescue nil
  # File.unlink(File.join(data_dir,@r.last,'cpeeinstance.url')) rescue nil
  # File.unlink(File.join(data_dir,@r.last,'style.url')) rescue nil
  # File.unlink(File.join(data_dir,@r.last,'document.xml')) rescue nil
  # File.unlink(File.join(data_dir,@r.last,'info.json')) rescue nil

  @a[0].send(JSON.dump({ message: 'reset' }))
  nil
end