Class: FbGraph2::Edge

Inherits:
Collection show all
Defined in:
lib/fb_graph2/edge.rb,
lib/fb_graph2/edge/docs.rb,
lib/fb_graph2/edge/feed.rb,
lib/fb_graph2/edge/tags.rb,
lib/fb_graph2/edge/books.rb,
lib/fb_graph2/edge/files.rb,
lib/fb_graph2/edge/games.rb,
lib/fb_graph2/edge/likes.rb,
lib/fb_graph2/edge/maybe.rb,
lib/fb_graph2/edge/music.rb,
lib/fb_graph2/edge/pokes.rb,
lib/fb_graph2/edge/posts.rb,
lib/fb_graph2/edge/roles.rb,
lib/fb_graph2/edge/admins.rb,
lib/fb_graph2/edge/albums.rb,
lib/fb_graph2/edge/banned.rb,
lib/fb_graph2/edge/events.rb,
lib/fb_graph2/edge/family.rb,
lib/fb_graph2/edge/groups.rb,
lib/fb_graph2/edge/movies.rb,
lib/fb_graph2/edge/offers.rb,
lib/fb_graph2/edge/photos.rb,
lib/fb_graph2/edge/scores.rb,
lib/fb_graph2/edge/tagged.rb,
lib/fb_graph2/edge/videos.rb,
lib/fb_graph2/edge/blocked.rb,
lib/fb_graph2/edge/dispute.rb,
lib/fb_graph2/edge/domains.rb,
lib/fb_graph2/edge/friends.rb,
lib/fb_graph2/edge/members.rb,
lib/fb_graph2/edge/noreply.rb,
lib/fb_graph2/edge/picture.rb,
lib/fb_graph2/edge/ratings.rb,
lib/fb_graph2/edge/refunds.rb,
lib/fb_graph2/edge/accounts.rb,
lib/fb_graph2/edge/comments.rb,
lib/fb_graph2/edge/declined.rb,
lib/fb_graph2/edge/insights.rb,
lib/fb_graph2/edge/messages.rb,
lib/fb_graph2/edge/settings.rb,
lib/fb_graph2/edge/attending.rb,
lib/fb_graph2/edge/interests.rb,
lib/fb_graph2/edge/locations.rb,
lib/fb_graph2/edge/activities.rb,
lib/fb_graph2/edge/milestones.rb,
lib/fb_graph2/edge/television.rb,
lib/fb_graph2/edge/test_users.rb,
lib/fb_graph2/edge/permissions.rb,
lib/fb_graph2/edge/achievements.rb,
lib/fb_graph2/edge/app_insights.rb,
lib/fb_graph2/edge/app_requests.rb,
lib/fb_graph2/edge/friend_lists.rb,
lib/fb_graph2/edge/shared_posts.rb,
lib/fb_graph2/edge/translations.rb,
lib/fb_graph2/edge/conversations.rb,
lib/fb_graph2/edge/subscriptions.rb,
lib/fb_graph2/edge/tagged_places.rb,
lib/fb_graph2/edge/app_link_hosts.rb,
lib/fb_graph2/edge/app_event_types.rb,
lib/fb_graph2/edge/promotable_posts.rb,
lib/fb_graph2/edge/static_resources.rb,
lib/fb_graph2/edge/taggable_friends.rb,
lib/fb_graph2/edge/invitable_friends.rb,
lib/fb_graph2/edge/payment_transactions.rb,
lib/fb_graph2/edge/global_brand_children.rb

Defined Under Namespace

Modules: Accounts, Achievements, Activities, Admins, Albums, AppEventTypes, AppInsights, AppLinkHosts, AppRequests, Attending, Banned, Blocked, Books, Comments, Conversations, Declined, Dispute, Docs, Domains, Events, Family, Feed, Files, FriendLists, Friends, Games, GlobalBrandChildren, Groups, Insights, Interests, InvitableFriends, Likes, Locations, Maybe, Members, Messages, Milestones, Movies, Music, Noreply, Offers, PaymentTransactions, Permissions, Photos, Picture, Pokes, Posts, PromotablePosts, Ratings, Refunds, Roles, Scores, Settings, SharedPosts, StaticResources, Subscriptions, TaggableFriends, Tagged, TaggedPlaces, Tags, Television, TestUsers, Translations, Videos

Instance Attribute Summary collapse

Attributes inherited from Collection

#after, #before, #summary, #total_count

Instance Method Summary collapse

Constructor Details

#initialize(owner, edge, params = {}, options = {}) ⇒ Edge

Returns a new instance of Edge.



6
7
8
9
10
11
12
13
# File 'lib/fb_graph2/edge.rb', line 6

def initialize(owner, edge, params = {}, options = {})
  self.owner = owner
  self.edge = edge
  self.params = params
  self.options = options
  self.collection = options.delete(:collection) || Collection.new
  replace collection
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



3
4
5
# File 'lib/fb_graph2/edge.rb', line 3

def collection
  @collection
end

#edgeObject

Returns the value of attribute edge.



3
4
5
# File 'lib/fb_graph2/edge.rb', line 3

def edge
  @edge
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/fb_graph2/edge.rb', line 3

def options
  @options
end

#ownerObject

Returns the value of attribute owner.



3
4
5
# File 'lib/fb_graph2/edge.rb', line 3

def owner
  @owner
end

#paramsObject

Returns the value of attribute params.



3
4
5
# File 'lib/fb_graph2/edge.rb', line 3

def params
  @params
end

Instance Method Details

#next(_options_ = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/fb_graph2/edge.rb', line 15

def next(_options_ = {})
  if collection.next.present?
    owner.send edge, options.merge(collection.next).merge(_options_)
  elsif collection.after.present?
    owner.send edge, options.merge(after: collection.after).merge(_options_)
  else
    self.class.new owner, edge
  end
end

#previous(_options_ = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/fb_graph2/edge.rb', line 25

def previous(_options_ = {})
  if self.collection.previous.present?
    owner.send edge, options.merge(collection.previous).merge(_options_)
  elsif collection.before.present?
    owner.send edge, options.merge(before: collection.before).merge(_options_)
  else
    self.class.new owner, edge
  end
end