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

- (Object) creator

Returns the value of attribute creator



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

def creator
  @creator
end

- (Object) description

Returns the value of attribute description



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

def description
  @description
end

- (Object) group_subtype

Returns the value of attribute group_subtype



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

def group_subtype
  @group_subtype
end

- (Object) group_type

Returns the value of attribute group_type



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

def group_type
  @group_type
end

- (Object) name

Returns the value of attribute name



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

def name
  @name
end

- (Object) nid

Returns the value of attribute nid



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

def nid
  @nid
end

- (Object) office

Returns the value of attribute office



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

def office
  @office
end

- (Object) pic

Returns the value of attribute pic



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

def pic
  @pic
end

- (Object) pic_big

Returns the value of attribute pic_big



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

def pic_big
  @pic_big
end

- (Object) pic_small

Returns the value of attribute pic_small



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

def pic_small
  @pic_small
end

- (Object) privacy

Returns the value of attribute privacy



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

def privacy
  @privacy
end

- (Object) recent_news

Returns the value of attribute recent_news



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

def recent_news
  @recent_news
end

- (Object) update_time

Returns the value of attribute update_time



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

def update_time
  @update_time
end

- (Object) venue

Returns the value of attribute venue



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

def venue
  @venue
end

- (Object) website

Returns the value of attribute website



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

def website
  @website
end

Instance Method Details

- (Object) members

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

- (Object) memberships

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