2

Devise、Omniauth、Koala を使用して Rails アプリを作成しました。これで、現在のユーザーの友達をすべてプルダウンできました。

  @graph = Koala::Facebook::GraphAPI.new(@token)
  @friends = @graph.get_connections("me", "friends")

現在のユーザーの関係ステータスを取得できました。

  @graph = Koala::Facebook::GraphAPI.new(@token)
  @relationship = @graph.get_object("me")

私が理解できていないのは、現在のユーザーのすべての友達に電話をかけ、関係ステータスも含む方法です。get_connections("me", "friends") 呼び出しに増分引数/パラメーターを含める必要があると思いますが、その増分引数パラメーターが何であるかはわかりません。

config/initializers/omniauth.rb ファイル内で、Facebook スコープに以下を含めました。

{:scope => 'publish_stream,offline_access,email,user_relationships,friends_relationships'}

この特定のコアラの質問について何か助けはありますか? Koala のさまざまな例と、それを使用して Facebook データのさまざまな呼び出しを行う方法を示すリストはどこかにありますか?

前もって感謝します!

4

2 に答える 2

2

最初に許可を得る必要があります

redirect_to session['oauth'].url_for_oauth_code(:permissions=>'friends_relationships')   
@graph.get_connections('me','friends',:fields=>"name,gender,relationship_status")
于 2011-12-21T08:27:04.673 に答える
1
@graph.fql_query("select uid, relationship_status from user where uid in (select uid2 from friend where uid1 = me())"

fql 呼び出しを行います。大量に使用する方がはるかに高速です。

于 2012-12-28T19:47:16.050 に答える