Sha256: 3364de5e5111ca557425944c341bb7864cf232b1d1eb064875f539f627136254

Contents?: true

Size: 569 Bytes

Versions: 3

Compression:

Stored size: 569 Bytes

Contents

# frozen_string_literal: true
require_relative 'fb_api'
require_relative 'feed'

module FaceGroups
  # Main class to setup a Facebook group
  class Group
    attr_reader :id, :name, :feed

    def initialize(group_data:)
      @name = group_data['name']
      @id = group_data['id']
      @feed = Feed.new(feed_data: group_data['feed'])
    end

    def self.find(id:)
      group_data = FbApi.group_data(id)
      group_data.include?('error') ? nil : new(group_data: group_data)
    end

    def latest_postings
      FbApi.newest_group_postings(id)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facegroups-0.6.2 lib/facegroups/group.rb
facegroups-0.6.1 lib/facegroups/group.rb
facegroups-0.6.0 lib/facegroups/group.rb