Class: SkypeMac::Iam

Inherits:
Object
  • Object
show all
Defined in:
lib/rb-skypemac/iam.rb

Overview

Singleton for managing Skype user status

Constant Summary collapse

@@STATUSES =
[:ONLINE, :OFFLINE, :SKYPEME, :AWAY, :NA, :DND, :INVISIBLE]

Class Method Summary collapse

Class Method Details

.method_missing(id) ⇒ Object

Handles all of the user status permutations accepted by Skype otherwise Errors. For example, Iam.away is legal.



18
19
20
# File 'lib/rb-skypemac/iam.rb', line 18

def Iam.method_missing(id)
  Iam.set_user_status(id.id2name)
end

.set_user_status(status) ⇒ Object

Raises:

  • (NoMethodError)


11
12
13
14
# File 'lib/rb-skypemac/iam.rb', line 11

def Iam.set_user_status(status)
  raise NoMethodError.new("#{status} in #{Iam.to_s}") if not @@STATUSES.index status.upcase.to_sym
  Skype.send_ :command => "SET USERSTATUS #{status}"
end