From 6144f5fed5c9929210720ef934ab394244b84074 Mon Sep 17 00:00:00 2001 From: Salahutdinov Dmitry Date: Tue, 1 Oct 2019 10:31:05 +0500 Subject: [PATCH 1/4] Thread safety config for root_url and api_version --- lib/fb_graph2.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/fb_graph2.rb b/lib/fb_graph2.rb index c700026..f3290b2 100644 --- a/lib/fb_graph2.rb +++ b/lib/fb_graph2.rb @@ -6,8 +6,10 @@ 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 + DEFAULT_ROOT_URL = 'https://graph.facebook.com' + DEFAULT_API_VERSION = 'v2.11' self.root_url = 'https://graph.facebook.com' self.api_version = 'v2.11' self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip @@ -15,6 +17,22 @@ module FbGraph2 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 From cd4a8b019ef2ad44f52ae050eb8f9e4498e1b11b Mon Sep 17 00:00:00 2001 From: Salahutdinov Dmitry Date: Tue, 1 Oct 2019 15:51:13 +0500 Subject: [PATCH 2/4] f --- lib/fb_graph2.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/fb_graph2.rb b/lib/fb_graph2.rb index f3290b2..ffe9783 100644 --- a/lib/fb_graph2.rb +++ b/lib/fb_graph2.rb @@ -10,8 +10,6 @@ module FbGraph2 DEFAULT_ROOT_URL = 'https://graph.facebook.com' DEFAULT_API_VERSION = 'v2.11' - self.root_url = 'https://graph.facebook.com' - self.api_version = 'v2.11' self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip self.logger = Logger.new(STDOUT) self.logger.progname = 'FbGraph2' From 8e9fbc0d85c3c93892cf118639ddedb1acb61985 Mon Sep 17 00:00:00 2001 From: Salahutdinov Dmitry Date: Tue, 1 Oct 2019 15:55:22 +0500 Subject: [PATCH 3/4] f --- lib/fb_graph2.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fb_graph2.rb b/lib/fb_graph2.rb index ffe9783..7bdc4e3 100644 --- a/lib/fb_graph2.rb +++ b/lib/fb_graph2.rb @@ -16,19 +16,19 @@ module 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 + ::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) - Thread.current['fb_graph2_api_version'] = value + ::Thread.current['fb_graph2_api_version'] = value end def object_classes From fbe5e4d5c3568a23a07bbf028399480ff5bb50c7 Mon Sep 17 00:00:00 2001 From: Salahutdinov Dmitry Date: Tue, 1 Oct 2019 16:01:28 +0500 Subject: [PATCH 4/4] Upgrade ruby for tests --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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