Sha256: b9c8c2c30d3119712cc83c717c785b35c97944e34b24ea2755c5fbdb3b555534

Contents?: true

Size: 498 Bytes

Versions: 4

Compression:

Stored size: 498 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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facegroups-0.4.1 lib/facegroups/group.rb
facegroups-0.4.0 lib/facegroups/group.rb
facegroups-0.3.0 lib/facegroups/group.rb
facegroups-0.2.2 lib/facegroups/group.rb