Class: SkypeApi::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/skype_api/skype_api.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



22
23
24
# File 'lib/skype_api/skype_api.rb', line 22

def self.instance
  @instance ||= new
end

Instance Method Details

#attach(protocol_number = 7, name = "SkypeApi") ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/skype_api/skype_api.rb', line 26

def attach(protocol_number = 7, name = "SkypeApi")
  unless @is_on
    api.Invoke "NAME #{name}"
    api.Invoke "PROTOCOL #{protocol_number}"

    thread = Thread.new do
      receiving_service = bus.request_service(SERVICE)
      receiving_service.export(Notify.new(SKYPE_TO_CLIENT_PATH))
      dbus_event_loop = DBus::Main.new
      dbus_event_loop << bus
      dbus_event_loop.run
    end
    thread.run

    @is_on = true
  end
end

#invoke(query) ⇒ Object



44
45
46
# File 'lib/skype_api/skype_api.rb', line 44

def invoke(query)
  api.Invoke(query)
end