Sha256: 724f55e3d73f09214fab8d06d38c3607e5b854cfd711b49574a9d14ef76ffcb8

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

require_relative 'fb_api'
require_relative 'posting'

module FansWatch 
  # Main class to setup a Facebook group 
  class Page 
    attr_reader :name

    def initialize(fb_api, data:) 
      @fb_api = fb_api
      @name = data['name'] 
      @id = data['id'] 
    end
    
    def feed 
      return @feed if @feed
      raw_feed = @fb_api.page_feed(@id)
      @feed = raw_feed.map do |posting| 
        FansWatch::Posting.new( 
          @fb_api,
          data: posting
        ) 
      end 
    end 

    def self.find(fb_api, id:)
      page_data = fb_api.page_info(id)
      new(fb_api, data: page_data)
    end

  end 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fanswatch-0.0.0 lib/fanswatch/page.rb