Class: SkypeApi::User
- Inherits:
-
Object
- Object
- SkypeApi::User
- Defined in:
- lib/skype_api/user.rb
Direct Known Subclasses
Constant Summary collapse
- COMMAND =
"USER"
- NOT_IN_CONTACT =
never been in contact list.
0
- DELETE_FROM_CONTACT =
deleted from contact list.
1
- AUTHORISATION_PENDING =
pending authorisation.
2
- ADD_TO_CONTACT =
added to contact list.
3
- METHOD_NAMES =
[:fullname, :birthday, :sex, :language, :province, :city, :phone_home, :phone_office, :phone_mobile, :homepage, :about, :buddystatus]
Instance Attribute Summary collapse
-
#about ⇒ Object
readonly
Returns the value of attribute about.
-
#birthday ⇒ Object
readonly
Returns the value of attribute birthday.
-
#buddystatus ⇒ Object
readonly
Returns the value of attribute buddystatus.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#fullname ⇒ Object
readonly
Returns the value of attribute fullname.
-
#homepage ⇒ Object
readonly
Returns the value of attribute homepage.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#phone_home ⇒ Object
readonly
Returns the value of attribute phone_home.
-
#phone_mobile ⇒ Object
readonly
Returns the value of attribute phone_mobile.
-
#phone_office ⇒ Object
readonly
Returns the value of attribute phone_office.
-
#province ⇒ Object
readonly
Returns the value of attribute province.
-
#sex ⇒ Object
readonly
Returns the value of attribute sex.
Instance Method Summary collapse
- #authorisation ⇒ Object
- #fifo ⇒ Object
- #get(*items) ⇒ Object
-
#initialize(name = "") ⇒ User
constructor
A new instance of User.
- #to_s ⇒ Object
- #update(text) ⇒ Object
Constructor Details
#initialize(name = "") ⇒ User
Returns a new instance of User.
18 19 20 21 22 23 |
# File 'lib/skype_api/user.rb', line 18 def initialize(name = "") @name = name @fullname, @birthday, @sex, @language, @province, @city = nil @phone_home, @phone_office, @phone_mobile = nil @homepage, @about, @buddystatus = nil end |
Instance Attribute Details
#about ⇒ Object (readonly)
Returns the value of attribute about.
16 17 18 |
# File 'lib/skype_api/user.rb', line 16 def about @about end |
#birthday ⇒ Object (readonly)
Returns the value of attribute birthday.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def birthday @birthday end |
#buddystatus ⇒ Object (readonly)
Returns the value of attribute buddystatus.
16 17 18 |
# File 'lib/skype_api/user.rb', line 16 def buddystatus @buddystatus end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def city @city end |
#fullname ⇒ Object (readonly)
Returns the value of attribute fullname.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def fullname @fullname end |
#homepage ⇒ Object (readonly)
Returns the value of attribute homepage.
16 17 18 |
# File 'lib/skype_api/user.rb', line 16 def homepage @homepage end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def name @name end |
#phone_home ⇒ Object (readonly)
Returns the value of attribute phone_home.
15 16 17 |
# File 'lib/skype_api/user.rb', line 15 def phone_home @phone_home end |
#phone_mobile ⇒ Object (readonly)
Returns the value of attribute phone_mobile.
15 16 17 |
# File 'lib/skype_api/user.rb', line 15 def phone_mobile @phone_mobile end |
#phone_office ⇒ Object (readonly)
Returns the value of attribute phone_office.
15 16 17 |
# File 'lib/skype_api/user.rb', line 15 def phone_office @phone_office end |
#province ⇒ Object (readonly)
Returns the value of attribute province.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def province @province end |
#sex ⇒ Object (readonly)
Returns the value of attribute sex.
14 15 16 |
# File 'lib/skype_api/user.rb', line 14 def sex @sex end |
Instance Method Details
#authorisation ⇒ Object
62 63 64 |
# File 'lib/skype_api/user.rb', line 62 def "SET #{COMMAND} #{@name} BUDDYSTATUS 2" end |
#fifo ⇒ Object
25 26 27 28 29 |
# File 'lib/skype_api/user.rb', line 25 def fifo self.methods.collect do |method| self.send method if /^get_.+$/.match(method.to_s) end.compact end |
#get(*items) ⇒ Object
47 48 49 50 51 |
# File 'lib/skype_api/user.rb', line 47 def get(*items) items.collect do |item| (self.respond_to? item) ? (self.send item) : nil end end |
#to_s ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/skype_api/user.rb', line 53 def to_s text = "<name = #{name.inspect}" METHOD_NAMES.each do |name| text << ", #{name.to_s} = #{(self.send name).inspect}" end text << ">" text end |
#update(text) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/skype_api/user.rb', line 31 def update(text) destination, user_name, property, *value = text.split property = "@#{property.downcase}".to_sym value = value.join(' ') if query_validate(destination, user_name, property) self.instance_variable_set property, /^\d+$/.match(value) ? value.to_i : value end self end |