Skip to content

Allow changing defaults for root url and api version #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/fb_graph2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
require 'patch/rack/oauth2/util'

module FbGraph2
mattr_accessor :gem_version, :logger, :debugging, :_http_config_, :object_classes
mattr_accessor :default_root_url, :default_api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes

DEFAULT_ROOT_URL = 'https://graph.facebook.com'
DEFAULT_API_VERSION = 'v7.0'
self.default_root_url = 'https://graph.facebook.com'
self.default_api_version = 'v7.0'
self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip
self.logger = Logger.new(STDOUT)
self.logger.progname = 'FbGraph2'

class << self
def root_url
::Thread.current['fb_graph2_root_url'] || DEFAULT_ROOT_URL
::Thread.current['fb_graph2_root_url'] || default_root_url
end

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

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

def api_version=(value)
Expand Down