Class: Funky::Page
- Inherits:
-
GraphRootNode
- Object
- GraphRootNode
- Funky::Page
- Defined in:
- lib/funky/page.rb
Instance Attribute Summary
Attributes inherited from GraphRootNode
Class Method Summary collapse
-
.where(id:) ⇒ Array<Funky::Page>
Fetches the data from Facebook’s APIs and instantiates the data into an Array of Funky::Page objects.
Instance Method Summary collapse
-
#city ⇒ String?
The city of the Facebook Page if it is present.
-
#country ⇒ String?
The country of the Facebook Page if it is present.
-
#latitude ⇒ Fixnum?
The latitude of the Facebook Page if it is present.
-
#location ⇒ Hash
The location of the Facebook Page if it is present.
-
#longitude ⇒ Fixnum?
The longitude of the Facebook Page if it is present.
-
#name ⇒ String
The name of the Facebook Page.
-
#state ⇒ String?
The state of the Facebook Page if it is present.
-
#street ⇒ String?
The street of the Facebook Page if it is present.
-
#username ⇒ String
The alias of the Facebook Page.
-
#zip ⇒ String
The zip code of the Facebook Page if it is present.
Methods inherited from GraphRootNode
Constructor Details
This class inherits a constructor from Funky::GraphRootNode
Class Method Details
.where(id:) ⇒ Array<Funky::Page>
Fetches the data from Facebook’s APIs and instantiates the data into an Array of Funky::Page objects. It can accept one page ID or an array of multiple page IDs.
85 86 87 88 |
# File 'lib/funky/page.rb', line 85 def self.where(id:) return nil unless id instantiate_collection(fetch_and_parse_data Array(id)) end |
Instance Method Details
#city ⇒ String?
Returns the city of the Facebook Page if it is present.
32 33 34 |
# File 'lib/funky/page.rb', line 32 def city location[:city] end |
#country ⇒ String?
Returns the country of the Facebook Page if it is present.
50 51 52 |
# File 'lib/funky/page.rb', line 50 def country location[:country] end |
#latitude ⇒ Fixnum?
Returns the latitude of the Facebook Page if it is present.
62 63 64 |
# File 'lib/funky/page.rb', line 62 def latitude location[:latitude] end |
#location ⇒ Hash
location is a Hash that contains more specific properties such as city, state, zip, etc.
Returns the location of the Facebook Page if it is present.
26 27 28 |
# File 'lib/funky/page.rb', line 26 def location data.fetch(:location, {}) end |
#longitude ⇒ Fixnum?
Returns the longitude of the Facebook Page if it is present.
68 69 70 |
# File 'lib/funky/page.rb', line 68 def longitude location[:longitude] end |
#name ⇒ String
For example, for www.facebook.com/platform the name is ‘Facebook For Developers’.
Returns the name of the Facebook Page.
17 18 19 |
# File 'lib/funky/page.rb', line 17 def name data[:name] end |
#state ⇒ String?
Returns the state of the Facebook Page if it is present.
44 45 46 |
# File 'lib/funky/page.rb', line 44 def state location[:state] end |
#street ⇒ String?
Returns the street of the Facebook Page if it is present.
38 39 40 |
# File 'lib/funky/page.rb', line 38 def street location[:street] end |
#username ⇒ String
For example, for www.facebook.com/platform the username is ‘platform’.
Returns the alias of the Facebook Page.
8 9 10 |
# File 'lib/funky/page.rb', line 8 def username data[:username] end |
#zip ⇒ String
Returns the zip code of the Facebook Page if it is present.
56 57 58 |
# File 'lib/funky/page.rb', line 56 def zip location[:zip] end |