Module: FbGraph2

Defined in:
lib/fb_graph2.rb,
lib/fb_graph2/app.rb,
lib/fb_graph2/auth.rb,
lib/fb_graph2/edge.rb,
lib/fb_graph2/node.rb,
lib/fb_graph2/page.rb,
lib/fb_graph2/post.rb,
lib/fb_graph2/user.rb,
lib/fb_graph2/util.rb,
lib/fb_graph2/album.rb,
lib/fb_graph2/event.rb,
lib/fb_graph2/group.rb,
lib/fb_graph2/offer.rb,
lib/fb_graph2/order.rb,
lib/fb_graph2/photo.rb,
lib/fb_graph2/place.rb,
lib/fb_graph2/video.rb,
lib/fb_graph2/domain.rb,
lib/fb_graph2/review.rb,
lib/fb_graph2/struct.rb,
lib/fb_graph2/thread.rb,
lib/fb_graph2/comment.rb,
lib/fb_graph2/insight.rb,
lib/fb_graph2/message.rb,
lib/fb_graph2/payment.rb,
lib/fb_graph2/request.rb,
lib/fb_graph2/edge/docs.rb,
lib/fb_graph2/edge/feed.rb,
lib/fb_graph2/edge/tags.rb,
lib/fb_graph2/exception.rb,
lib/fb_graph2/group_doc.rb,
lib/fb_graph2/milestone.rb,
lib/fb_graph2/place_tag.rb,
lib/fb_graph2/test_user.rb,
lib/fb_graph2/collection.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/searchable.rb,
lib/fb_graph2/struct/tag.rb,
lib/fb_graph2/achievement.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/friend_list.rb,
lib/fb_graph2/struct/poke.rb,
lib/fb_graph2/struct/role.rb,
lib/fb_graph2/struct/work.rb,
lib/fb_graph2/translation.rb,
lib/fb_graph2/conversation.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/notification.rb,
lib/fb_graph2/struct/score.rb,
lib/fb_graph2/struct/share.rb,
lib/fb_graph2/app_link_host.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/send_api.rb,
lib/fb_graph2/edge/settings.rb,
lib/fb_graph2/page_category.rb,
lib/fb_graph2/struct/action.rb,
lib/fb_graph2/struct/device.rb,
lib/fb_graph2/struct/friend.rb,
lib/fb_graph2/struct/rating.rb,
lib/fb_graph2/edge/attending.rb,
lib/fb_graph2/edge/interests.rb,
lib/fb_graph2/edge/locations.rb,
lib/fb_graph2/struct/context.rb,
lib/fb_graph2/struct/parking.rb,
lib/fb_graph2/struct/picture.rb,
lib/fb_graph2/struct/privacy.rb,
lib/fb_graph2/struct/setting.rb,
lib/fb_graph2/tagged_profile.rb,
lib/fb_graph2/token_metadata.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/struct/app_link.rb,
lib/fb_graph2/struct/currency.rb,
lib/fb_graph2/struct/location.rb,
lib/fb_graph2/struct/property.rb,
lib/fb_graph2/achievement_type.rb,
lib/fb_graph2/edge/permissions.rb,
lib/fb_graph2/struct/age_range.rb,
lib/fb_graph2/struct/education.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/searchable/result.rb,
lib/fb_graph2/struct/group_file.rb,
lib/fb_graph2/struct/permission.rb,
lib/fb_graph2/attribute_assigner.rb,
lib/fb_graph2/edge/conversations.rb,
lib/fb_graph2/edge/subscriptions.rb,
lib/fb_graph2/edge/tagged_places.rb,
lib/fb_graph2/struct/app_insight.rb,
lib/fb_graph2/auth/signed_request.rb,
lib/fb_graph2/edge/app_link_hosts.rb,
lib/fb_graph2/struct/image_source.rb,
lib/fb_graph2/struct/subscription.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/struct/app_event_type.rb,
lib/fb_graph2/edge/invitable_friends.rb,
lib/fb_graph2/struct/payment_options.rb,
lib/fb_graph2/struct/static_resource.rb,
lib/fb_graph2/request_filter/debugger.rb,
lib/fb_graph2/edge/payment_transactions.rb,
lib/fb_graph2/edge/global_brand_children.rb,
lib/fb_graph2/struct/restaurant_services.rb,
lib/fb_graph2/request_filter/authenticator.rb,
lib/fb_graph2/struct/restaurant_specialties.rb

Defined Under Namespace

Modules: AttributeAssigner, RequestFilter, Searchable, Util Classes: Achievement, AchievementType, Album, App, AppLinkHost, Auth, Collection, Comment, Conversation, Domain, Edge, Event, Exception, FriendList, Group, GroupDoc, Insight, Message, Milestone, Node, Notification, Offer, Order, Page, PageCategory, Payment, Photo, Place, PlaceTag, Post, Request, Review, Struct, TaggedProfile, TestUser, Thread, TokenMetadata, Translation, User, Video

Constant Summary collapse

DEFAULT_ROOT_URL =
'https://graph.facebook.com'
DEFAULT_API_VERSION =
'v7.0'

Class Method Summary collapse

Class Method Details

.api_versionObject



26
27
28
# File 'lib/fb_graph2.rb', line 26

def api_version
  ::Thread.current['fb_graph2_api_version'] || DEFAULT_API_VERSION
end

.api_version=(value) ⇒ Object



30
31
32
# File 'lib/fb_graph2.rb', line 30

def api_version=(value)
  ::Thread.current['fb_graph2_api_version'] = value
end

.debug!Object



41
42
43
44
# File 'lib/fb_graph2.rb', line 41

def debug!
  Rack::OAuth2.debug!
  self.debugging = true
end

.debugging?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fb_graph2.rb', line 38

def debugging?
  !!self.debugging
end

.http_client(access_token = nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fb_graph2.rb', line 46

def http_client(access_token = nil)
  _http_client_ = HTTPClient.new(
    agent_name: "FbGraph2 (#{gem_version})"
  )

  # NOTE: httpclient gem seems stopped maintaining root certtificate set, use OS default.
 _http_client_.ssl_config.clear_cert_store
 _http_client_.ssl_config.cert_store.set_default_paths

  _http_client_.request_filter.delete_if do |filter|
    filter.is_a? HTTPClient::WWWAuth
  end
  _http_client_.request_filter << RequestFilter::Authenticator.new(access_token) if access_token.present?
  _http_client_.request_filter << RequestFilter::Debugger.new if self.debugging?
  _http_config_.try(:call, _http_client_)
  _http_client_
end

.http_config(&block) ⇒ Object



63
64
65
66
# File 'lib/fb_graph2.rb', line 63

def http_config(&block)
  Rack::OAuth2.http_config &block unless Rack::OAuth2.http_config
  self._http_config_ ||= block
end

.object_classesObject



34
35
36
# File 'lib/fb_graph2.rb', line 34

def object_classes
  FbGraph2::Node.descendants
end

.root_urlObject



18
19
20
# File 'lib/fb_graph2.rb', line 18

def root_url
  ::Thread.current['fb_graph2_root_url'] || DEFAULT_ROOT_URL
end

.root_url=(value) ⇒ Object



22
23
24
# File 'lib/fb_graph2.rb', line 22

def root_url=(value)
  ::Thread.current['fb_graph2_root_url'] = value
end