如何添加访问令牌

时间:2017-03-26 12:16:22

标签: ruby-on-rails facebook-graph-api

如何为此网址添加访问令牌http://graph.facebook.com/?id=# {checked_url}& access_token =#{access_token}而不是http://graph.facebook.com/?id=# {checked_url}

module SocialShares
  class Facebook < Base
    def shares!
      response = RestClient.get(url, params: {
        fields: 'share'
      })
      json_response = JSON.parse(response)

      if json_response['share']
        json_response['share']['share_count'] || 0
      else
        0
      end
    end

  private

    def url
      "http://graph.facebook.com/?id=#{checked_url}"
    end
  end
end

1 个答案:

答案 0 :(得分:0)

将访问令牌添加到

 "http://graph.facebook.com/?id=#{checked_url}#{access_token}"
private
  def access_token
    youracesstoken
  end