diff --git a/.travis.yml b/.travis.yml index a742b12..01bafb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ before_install: - gem install bundler rvm: - - 2.2.2 # NOTE: 2.2.1 or lower aren't supported by activesupport 5.0, CI isn't needed for such legacy versions. - - 2.2.6 - 2.3.3 - - 2.4.0 \ No newline at end of file + - 2.4.0 + - 2.5.6 + - 2.6.4 diff --git a/lib/fb_graph2.rb b/lib/fb_graph2.rb index c700026..7bdc4e3 100644 --- a/lib/fb_graph2.rb +++ b/lib/fb_graph2.rb @@ -6,15 +6,31 @@ require 'rack/oauth2' require 'patch/rack/oauth2/util' module FbGraph2 - mattr_accessor :root_url, :api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes + mattr_accessor :gem_version, :logger, :debugging, :_http_config_, :object_classes - self.root_url = 'https://graph.facebook.com' - self.api_version = 'v2.11' + DEFAULT_ROOT_URL = 'https://graph.facebook.com' + DEFAULT_API_VERSION = 'v2.11' 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 + 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 + end + + def api_version=(value) + ::Thread.current['fb_graph2_api_version'] = value + end + def object_classes FbGraph2::Node.descendants end