Sha256: 5ffda5af278d33e578ae1eb6d47cd51341f5511487ae3e41e0a52c48666ad388

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

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

module FaceGroup
  # Main class to setup a Facebook group
  class Group
    attr_reader :name

    def initialize(data:)
      @name = data['name']
      @id = data['id']
    end

    def feed
      return @feed if @feed
      feed_data = FaceGroup::FbApi.group_feed(@id)
      @feed = Feed.new(postings_data: feed_data['data'],
                       paging_data: feed_data['paging'])
    end

    def self.find(id:)
      group_data = FbApi.group_info(id)
      new(data: group_data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facegroup-0.1.0 lib/facegroup/group.rb