Class: FansWatch::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/fanswatch/page.rb

Overview

Main class to setup a Facebook group

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page_data:) ⇒ Page

Returns a new instance of Page.



10
11
12
13
14
15
# File 'lib/fanswatch/page.rb', line 10

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

end

Instance Attribute Details

#feedObject (readonly)

Returns the value of attribute feed.



8
9
10
# File 'lib/fanswatch/page.rb', line 8

def feed
  @feed
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/fanswatch/page.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/fanswatch/page.rb', line 8

def name
  @name
end

Class Method Details

.find(id:) ⇒ Object



17
18
19
20
# File 'lib/fanswatch/page.rb', line 17

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