module IMP

Constants

PORT
VERSION

Public Instance Methods

close() click to toggle source
# File lib/api/open.rb, line 13
def close
  return if @@client.nil?
  @@client.close
  @@client = nil
  true
end
open() click to toggle source
# File lib/api/open.rb, line 3
def open
  return unless @@client.nil?
  begin
    @@client = Client.new
    return true
  rescue
    return false
  end
end
ping(*args, &hook) click to toggle source
# File lib/api/ping.rb, line 2
def ping *args, &hook
  @@client&.request('ping', args, &hook)
end
start_daemon() click to toggle source
# File lib/api/start_daemon.rb, line 3
def start_daemon
  begin
    Daemon.start nil
    return true
  rescue
    return false
  end
end
stop_daemon() click to toggle source
# File lib/api/stop_daemon.rb, line 2
def stop_daemon

  if @@client.nil? and open == false
    # no daemon running
    return
  end
  
  case @@client.request('stop', nil)
  when NilClass
    # not thoroughly implemented yet
    # nil is automatically assigned to all requests when disconnected
    @@client = nil
    true
  else
    # not thoroughly implemented yet
    # e.g. permissions
    false
  end

end