Class: FacebookTopics::FeedCollection
- Inherits:
-
Collection
- Object
- Collection
- FacebookTopics::FeedCollection
- Defined in:
- lib/facebook_topics/results/feed_collection.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#paging ⇒ Object
Returns the value of attribute paging.
Instance Method Summary collapse
-
#initialize(results = []) ⇒ FeedCollection
constructor
A new instance of FeedCollection.
- #next ⇒ Object
- #previous ⇒ Object
Constructor Details
#initialize(results = []) ⇒ FeedCollection
Returns a new instance of FeedCollection.
5 6 7 8 9 10 11 |
# File 'lib/facebook_topics/results/feed_collection.rb', line 5 def initialize(results = []) super(results) @id = results["id"] @paging = results["paging"] || results["ranked_posts"]["paging"] @results = (results["data"] || results["ranked_posts"]["data"] || []).collect { |r| FacebookTopics::Feed.new r } end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/facebook_topics/results/feed_collection.rb', line 3 def id @id end |
#paging ⇒ Object
Returns the value of attribute paging.
3 4 5 |
# File 'lib/facebook_topics/results/feed_collection.rb', line 3 def paging @paging end |
Instance Method Details
#next ⇒ Object
16 17 18 19 |
# File 'lib/facebook_topics/results/feed_collection.rb', line 16 def next next_url = URI.encode paging["next"] FeedCollection.new HTTParty.get(URI.parse(next_url)).parsed_response end |
#previous ⇒ Object
25 26 27 28 |
# File 'lib/facebook_topics/results/feed_collection.rb', line 25 def previous previous_url = URI.encode paging["previous"] FeedCollection.new HTTParty.get(URI.parse(previous_url)).parsed_response end |