Class: Facebooker::Group

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/facebooker/models/group.rb

Defined Under Namespace

Classes: Membership

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Model

#anon=, included, #initialize, #populate, #populate_from_hash!, #populated?, #session

Instance Attribute Details

#creatorObject

Returns the value of attribute creator



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def creator
  @creator
end

#descriptionObject

Returns the value of attribute description



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def description
  @description
end

#group_subtypeObject

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_typeObject

Returns the value of attribute group_type



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def group_type
  @group_type
end

#nameObject

Returns the value of attribute name



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def name
  @name
end

#nidObject

Returns the value of attribute nid



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def nid
  @nid
end

#officeObject

Returns the value of attribute office



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def office
  @office
end

#picObject

Returns the value of attribute pic



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def pic
  @pic
end

#pic_bigObject

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_smallObject

Returns the value of attribute pic_small



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def pic_small
  @pic_small
end

#privacyObject

Returns the value of attribute privacy



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def privacy
  @privacy
end

#recent_newsObject

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_timeObject

Returns the value of attribute update_time



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def update_time
  @update_time
end

#venueObject

Returns the value of attribute venue



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def venue
  @venue
end

#websiteObject

Returns the value of attribute website



11
12
13
# File 'lib/facebooker/models/group.rb', line 11

def website
  @website
end

Instance Method Details

#membersObject

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

#membershipsObject

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