Class: Ecircle::Member
- Inherits:
-
Base
- Object
- Base
- Ecircle::Member
show all
- Defined in:
- lib/ecircle/member.rb
Instance Attribute Summary
Attributes inherited from Base
#all_fields, #id, #named_attrs
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#[], #init_with_xml, #method_missing
Constructor Details
#initialize(xml_string) ⇒ 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
.find_by_id(member_id) ⇒ Object
4
5
6
|
# File 'lib/ecircle/member.rb', line 4
def find_by_id(member_id)
Ecircle.client.lookup_member_by_id :memberid => member_id
end
|
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
|