lib/fb/auth.rb in fb-auth-1.0.0.alpha3 vs lib/fb/auth.rb in fb-auth-1.0.0.alpha4
- old
+ new
@@ -9,14 +9,17 @@
# @param [Hash] options the options to initialize an instance of Fb::Auth.
# @option [String] :redirect_uri The URI to redirect users to
# after they have completed the Facebook OAuth flow.
# @option [String] :code A single-use authorization code provided
# by Facebook OAuth to obtain an access token.
+ # @option [String] :refresh_token
+ # @option [Array<String>] :scope
def initialize(options = {})
@redirect_uri = options[:redirect_uri]
@code = options[:code]
@refresh_token = options[:refresh_token]
+ @scope = options[:scope]
end
# @return [Boolean] whether the authentication was revoked.
def revoke
!!HTTPRequest.new(revoke_options).run
@@ -44,10 +47,10 @@
def url_params
{}.tap do |params|
params[:client_id] = Fb.configuration.client_id
params[:redirect_uri] = @redirect_uri
- params[:scope] = 'email,pages_show_list,read_insights'
+ params[:scope] = Array(@scope).join(",")
end
end
def revoke_options
{path: '/v2.9/me/permissions', method: :delete, params: revoke_params}