Class: Facebooker::Group
- Inherits:
-
Object
- Object
- Facebooker::Group
- Includes:
- Model
- Defined in:
- lib/facebooker/models/group.rb
Defined Under Namespace
Classes: Membership
Instance Attribute Summary collapse
-
#creator ⇒ Object
Returns the value of attribute creator.
-
#description ⇒ Object
Returns the value of attribute description.
-
#group_subtype ⇒ Object
Returns the value of attribute group_subtype.
-
#group_type ⇒ Object
Returns the value of attribute group_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nid ⇒ Object
Returns the value of attribute nid.
-
#office ⇒ Object
Returns the value of attribute office.
-
#pic ⇒ Object
Returns the value of attribute pic.
-
#pic_big ⇒ Object
Returns the value of attribute pic_big.
-
#pic_small ⇒ Object
Returns the value of attribute pic_small.
-
#recent_news ⇒ Object
Returns the value of attribute recent_news.
-
#update_time ⇒ Object
Returns the value of attribute update_time.
-
#venue ⇒ Object
Returns the value of attribute venue.
-
#website ⇒ Object
Returns the value of attribute website.
Instance Method Summary collapse
-
#members ⇒ Object
Get the full list of members as populated User objects.
-
#memberships ⇒ Object
Get a list of Membership instances associated with this Group.
Methods included from Model
#anon=, included, #initialize, #populate, #populate_from_hash!, #populated?, #session
Instance Attribute Details
#creator ⇒ Object
Returns the value of attribute creator.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def creator @creator end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def description @description end |
#group_subtype ⇒ Object
Returns the value of attribute group_subtype.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def group_subtype @group_subtype end |
#group_type ⇒ Object
Returns the value of attribute group_type.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def group_type @group_type end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def name @name end |
#nid ⇒ Object
Returns the value of attribute nid.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def nid @nid end |
#office ⇒ Object
Returns the value of attribute office.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def office @office end |
#pic ⇒ Object
Returns the value of attribute pic.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def pic @pic end |
#pic_big ⇒ Object
Returns the value of attribute pic_big.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def pic_big @pic_big end |
#pic_small ⇒ Object
Returns the value of attribute pic_small.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def pic_small @pic_small end |
#recent_news ⇒ Object
Returns the value of attribute recent_news.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def recent_news @recent_news end |
#update_time ⇒ Object
Returns the value of attribute update_time.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def update_time @update_time end |
#venue ⇒ Object
Returns the value of attribute venue.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def venue @venue end |
#website ⇒ Object
Returns the value of attribute website.
11 12 13 |
# File 'lib/facebooker/models/group.rb', line 11 def website @website end |
Instance Method Details
#members ⇒ Object
Get the full list of members as populated User objects. First time fetches group members via Facebook API call.
Subsequent calls return cached values. This is a convenience method for getting all of the Membership instances and instantiating User instances for each Membership.
19 20 21 22 23 |
# File 'lib/facebooker/models/group.rb', line 19 def members @members ||= memberships.map do |membership| User.new(membership.uid, session) end end |
#memberships ⇒ Object
Get a list of Membership instances associated with this Group. First call retrieves the Membership instances via a Facebook API call. Subsequent calls are retrieved from in-memory cache.
28 29 30 31 32 33 34 |
# File 'lib/facebooker/models/group.rb', line 28 def memberships @memberships ||= session.post('facebook.groups.getMembers', :gid => gid).map do |hash| Membership.from_hash(hash) do |membership| membership.gid = gid end end end |