2011-10-28 8 views
1

私はウォールポストにアプリ固有のアクションを投稿しようとしてきましたが、何も役に立たないようです。私は間違って何をしていますか?Facebook GraphAPIウォールポストのアプリケーションアクションが動作しない

oauth = Koala::Facebook::OAuth.new(CLIENT_ID, CLIENT_SECRET, "http://myurl.com/fb_auth") 
    token = oauth.get_access_token(params[:code]) 
    graph = Koala::Facebook::API.new token 
    p graph.put_wall_post("explodingdog!", { 
    :link => "http://youtube.com/", 
    :caption => "Youtube", 
    :actions => [{:name => "Share", :link => "http://google.com"}] 
    }) 

答えて

1

あなたは、これはあなたがそれを行うだろう方法ですJSONの宝石を使用して、JSON文字列にアクションを変換する必要があります。

宝石はJSONにあなたの配列を変換するために、to_jsonをを使用し、その後、JSON

をインストール:

oauth = Koala::Facebook::OAuth.new(CLIENT_ID, CLIENT_SECRET, "http://myurl.com/fb_auth") 
    token = oauth.get_access_token(params[:code]) 
    graph = Koala::Facebook::API.new token 
    p graph.put_wall_post("explodingdog!", { 
    :link => "http://youtube.com/", 
    :caption => "Youtube", 
    :actions => [{:name => "Share", :link => "http://google.com"}].to_json 
    }) 

完了しました:

関連する問題