Class: SkypeMac::Group
- Inherits:
-
Object
- Object
- SkypeMac::Group
- Defined in:
- lib/rb-skypemac/group.rb
Overview
Represents Skype internal grouping of contacts; developer.skype.com/Docs/ApiDoc/GROUP_object
Instance Attribute Summary collapse
-
#gid ⇒ Object
readonly
Returns the value of attribute gid.
-
#gtype ⇒ Object
readonly
Returns the value of attribute gtype.
Class Method Summary collapse
-
.get_type(id) ⇒ Object
Gets the type of a group by id.
-
.groups ⇒ Object
Returns hash of symols (group types) => Group objects.
-
.types ⇒ Object
Returns an array of your Skype instance’s supported group types.
Instance Method Summary collapse
- #<=>(grp) ⇒ Object
-
#member_user_names ⇒ Object
Returns array of skype names of users in this group.
-
#users ⇒ Object
Returns array of Users in this Group.
Instance Attribute Details
#gid ⇒ Object (readonly)
Returns the value of attribute gid.
9 10 11 |
# File 'lib/rb-skypemac/group.rb', line 9 def gid @gid end |
#gtype ⇒ Object (readonly)
Returns the value of attribute gtype.
9 10 11 |
# File 'lib/rb-skypemac/group.rb', line 9 def gtype @gtype end |
Class Method Details
.get_type(id) ⇒ Object
Gets the type of a group by id
13 14 15 16 |
# File 'lib/rb-skypemac/group.rb', line 13 def get_type(id) r = Skype.send_ :command => "get group #{id} type" r.sub(/.*TYPE\b/, "").strip end |
.groups ⇒ Object
Returns hash of symols (group types) => Group objects
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rb-skypemac/group.rb', line 25 def groups r = Skype.send_ :command => "search groups hardwired", :script_name => "" r.gsub!(/^\D+/, "") group_ids = r.split ", " groups = [] group_ids.each do |id| groups << Group.new(id, Group.get_type(id)) end groups end |
Instance Method Details
#<=>(grp) ⇒ Object
50 51 52 |
# File 'lib/rb-skypemac/group.rb', line 50 def <=>(grp) @gtype <=> grp.gtype end |
#member_user_names ⇒ Object
Returns array of skype names of users in this group
38 39 40 41 |
# File 'lib/rb-skypemac/group.rb', line 38 def member_user_names r = Skype.send_ :command => "get group #{@gid} users" r.sub(/^.*USERS /, "").split(", ") end |
#users ⇒ Object
Returns array of Users in this Group
44 45 46 |
# File 'lib/rb-skypemac/group.rb', line 44 def users member_user_names.map { |h| User.new h } end |