Class: CPEE::Frames::Delete

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

Instance Method Summary collapse

Instance Method Details

#responseObject



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/cpee-frames/implementation.rb', line 223

def response
  data_dir = @a[1]
  pp "in delete"
  if cbu = File.read(File.join(data_dir,@r.last,'callback'))
    pp "XYZ"
    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('reset')
  nil
end