Class: Ecircle::Member
Instance Attribute Summary
Attributes inherited from Base
#all_fields, #id, #named_attrs
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #group ⇒ Object
- #group_id ⇒ Object
-
#initialize(xml_string) ⇒ Member
constructor
A new instance of Member.
- #user ⇒ Object
-
#user_id ⇒ Object
TODO with assume that the member id is the form of “<userid>g<groupid>”, hence TODO split on ‘g’ should work!.
Methods inherited from Base
#[], #init_with_xml, #method_missing
Constructor Details
#initialize(xml_string) ⇒ Member
Returns a new instance of Member.
9 10 11 12 |
# File 'lib/ecircle/member.rb', line 9 def initialize(xml_string) super() init_with_xml("member", xml_string) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ecircle::Base
Class Method Details
Instance Method Details
#delete ⇒ Object
14 15 16 |
# File 'lib/ecircle/member.rb', line 14 def delete Ecircle.client.delete_member :memberId => @id end |
#group ⇒ Object
23 24 25 |
# File 'lib/ecircle/member.rb', line 23 def group Ecircle::Group.find_by_id(group_id) end |
#group_id ⇒ Object
21 |
# File 'lib/ecircle/member.rb', line 21 def group_id ; @id.split(/g/).last ; end |
#user ⇒ Object
26 27 28 |
# File 'lib/ecircle/member.rb', line 26 def user Ecircle::User.find_by_id(user_id) end |
#user_id ⇒ Object
TODO with assume that the member id is the form of “<userid>g<groupid>”, hence TODO split on ‘g’ should work!
20 |
# File 'lib/ecircle/member.rb', line 20 def user_id ; @id.split(/g/).first ; end |