Method: FlexmlsApi::Authentication::OAuth2Impl.load_provider

Defined in:
lib/flexmls_api/authentication/oauth2.rb

.load_provider(string, args = {}) ⇒ Object

Loads a provider class from a string



188
189
190
191
192
193
194
# File 'lib/flexmls_api/authentication/oauth2.rb', line 188

def self.load_provider(string, args={})
  constant = Object
  string.split("::").compact.each { |name| constant = constant.const_get(name) unless name == ""}
  constant.new(args)
rescue => e
  raise ArgumentError, "The value '#{string}' is an invalid class name for an oauth2 provider:  #{e.message}"
end