Class: FacebookTopics::FeedCollection

Inherits:
Collection
  • Object
show all
Defined in:
lib/facebook_topics/results/feed_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/facebook_topics/results/feed_collection.rb', line 3

def id
  @id
end

#pagingObject

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

#nextObject



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

#previousObject



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