mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
Merge pull request #129 from dsalahutdinov/master
Thread safety config for root_url and api_version
This commit is contained in:
commit
13a559297a
2 changed files with 22 additions and 6 deletions
|
@ -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
|
||||
- 2.5.6
|
||||
- 2.6.4
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue