Class: SkypeAPI::Event

Inherits:
AbstractObject show all
Defined in:
lib/skypeapi/event.rb

Constant Summary collapse

OBJECT_NAME =
"EVENT"

Instance Attribute Summary

Attributes included from AbstractObject::Get

#property2callback, #property2symbol

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractObject

inherited, #initialize, new, #to_s

Methods included from AbstractObject::Notify

#delNotify, #notify

Methods included from AbstractObject::Get

#def_parser, #notice

Methods included from AbstractObject::Invokers

#invoke_alter, #invoke_echo, #invoke_get, #invoke_one, #invoke_set

Constructor Details

This class inherits a constructor from SkypeAPI::AbstractObject

Class Method Details

.create(id, caption, hint, block = Proc.new) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/skypeapi/event.rb', line 6

def create id, caption, hint, block=Proc.new
  res = SkypeAPI.invoke "CREATE EVENT #{id} CAPTION #{caption} HINT #{hint}"
  res == "EVENT #{id} CREATED"
  instance = new id
  instance.setNotify block if block
  instance
end

.delete(id) ⇒ Object



29
30
31
# File 'lib/skypeapi/event.rb', line 29

def delete id
  new(id).delete
end

.notified(msg) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/skypeapi/event.rb', line 19

def notified msg
  if msg =~ /^([^ ]+) CLICKED$/m
    id = $1
    instance = new $1
    @notify[nil].call instance if @notify[nil]
    @notify[id].call instance if @notify[id]
    @@instance[self][id].notified if @@instance[self][id]
  end
end

.set_notify(id = nil, block = Proc.new) ⇒ Object



14
15
16
# File 'lib/skypeapi/event.rb', line 14

def set_notify id=nil, block=Proc.new
  @notify[id] = block
end

.setNotifyObject



17
18
19
# File 'lib/skypeapi/event.rb', line 17

def set_notify id=nil, block=Proc.new
  @notify[id] = block
end

Instance Method Details

#deleteObject



44
45
46
47
# File 'lib/skypeapi/event.rb', line 44

def delete
  res = invoke "DELETE EVENT #{@id}"
  res == "DELETE EVENT #{@id}"
end

#notifiedObject



35
36
37
# File 'lib/skypeapi/event.rb', line 35

def notified
  @notify.call self if @notify
end

#set_notify(block = Proc.new) ⇒ Object Also known as: setNotify



39
40
41
# File 'lib/skypeapi/event.rb', line 39

def set_notify block=Proc.new
  @notify = block
end