Module: Zena::Remote::Interface::Delete::InstanceMethods

Included in:
InstanceMethods
Defined in:
lib/zena/remote/interface.rb

Overview

ConnectionMethods

Instance Method Summary collapse

Instance Method Details

#destroyObject



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/zena/remote/interface.rb', line 346

def destroy
  if id.nil?
    @errors = ["cannot destroy inexistant remote node"]
    return false
  end
  @previous_id = id
  result = @connection.http_delete(destroy_url)
  if result.code == 200
    logger.info "  %-10s: %s" % ['operation', 'destroy']
    logger.info "  %-10s: %s" % ['timestamp', Time.now]
    logger.info "  %-10s: %s" % ['node_id', id]
    logger.info "  attributes:"
    @attributes.keys.each do |key|
      logger.info "    #{key}: #{@attributes[key].inspect}"
    end
    true
  elsif errors = result['errors']
    @errors = errors
    false
  else
    log_message "Could not destroy.. error:"
    log_message result.inspect
    false
  end
end

#destroy_urlObject



342
343
344
# File 'lib/zena/remote/interface.rb', line 342

def destroy_url
  node_url
end