Class: SkypeAPI::User

Inherits:
Object
  • Object
show all
Defined in:
lib/skype-api/user.rb

Constant Summary collapse

@@users =
Hash.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ User

Returns a new instance of User.



10
11
12
# File 'lib/skype-api/user.rb', line 10

def initialize(id)
  @id = id
end

Class Method Details

.get_user(id) ⇒ Object



4
5
6
7
8
9
# File 'lib/skype-api/user.rb', line 4

def self.get_user(id)
  if @@users[id] == nil then
    @@users[id] = User.new(id)
  end
  @@users[id]
end

Instance Method Details

#aboutObject



55
56
57
# File 'lib/skype-api/user.rb', line 55

def about
  get_prop("ABOUT")
end

#birthdayObject



25
26
27
# File 'lib/skype-api/user.rb', line 25

def birthday
  get_prop("BIRTHDAY")
end

#blocked?Boolean

Returns:

  • (Boolean)


58
59
60
61
62
63
64
65
# File 'lib/skype-api/user.rb', line 58

def blocked?
  case get_prop("ISBLOCKED")
    when "TRUE"
      true
    when "FALSE"
      false
  end
end

#cell_numberObject



49
50
51
# File 'lib/skype-api/user.rb', line 49

def cell_number
  get_prop("PHONE_MOBILE")
end

#cityObject



40
41
42
# File 'lib/skype-api/user.rb', line 40

def city
  get_prop("CITY")
end

#countryObject



34
35
36
# File 'lib/skype-api/user.rb', line 34

def country
  get_prop("COUNTRY")
end

#handleObject



16
17
18
# File 'lib/skype-api/user.rb', line 16

def handle
  @id
end

#home_numberObject



43
44
45
# File 'lib/skype-api/user.rb', line 43

def home_number
  get_prop("PHONE_HOME")
end

#homepageObject



52
53
54
# File 'lib/skype-api/user.rb', line 52

def homepage
  get_prop("HOMEPAGE")
end

#idObject



13
14
15
# File 'lib/skype-api/user.rb', line 13

def id
  @id
end

#languageObject



31
32
33
# File 'lib/skype-api/user.rb', line 31

def language
  get_prop("LANGUAGE")
end

#last_onlineObject



73
74
75
# File 'lib/skype-api/user.rb', line 73

def last_online
  get_prop("LASTONLINETIMESTAMP")
end

#moodObject



76
77
78
# File 'lib/skype-api/user.rb', line 76

def mood
  get_prop("MOOD_TEXT")
end

#nameObject



19
20
21
# File 'lib/skype-api/user.rb', line 19

def name
  get_prop("FULLNAME")
end

#nicknameObject



22
23
24
# File 'lib/skype-api/user.rb', line 22

def nickname
  get_prop("DISPLAYNAME")
end

#office_numberObject



46
47
48
# File 'lib/skype-api/user.rb', line 46

def office_number
  get_prop("PHONE_OFFICE")
end

#online?Boolean

Returns:

  • (Boolean)


69
70
71
72
# File 'lib/skype-api/user.rb', line 69

def online?
  status = self.online_status
  return status == "ONLINE" || status == "DND"
end

#online_statusObject



66
67
68
# File 'lib/skype-api/user.rb', line 66

def online_status
  get_prop("ONLINESTATUS")
end

#provinceObject



37
38
39
# File 'lib/skype-api/user.rb', line 37

def province
  get_prop("PROVINCE")
end

#set_nickname(name) ⇒ Object



82
83
84
# File 'lib/skype-api/user.rb', line 82

def set_nickname(name)
  SkypeAPI::exec("SET USER #{self.id} DISPLAYNAME #{name}");
end

#sexObject



28
29
30
# File 'lib/skype-api/user.rb', line 28

def sex
  get_prop("SEX")
end

#timezoneObject



79
80
81
# File 'lib/skype-api/user.rb', line 79

def timezone
  get_prop("TIMEZONE")
end

#to_sObject



85
86
87
# File 'lib/skype-api/user.rb', line 85

def to_s
  self.handle
end