Module: Socialmux::AuthMapper

Defined in:
lib/socialmux/auth_mapper.rb,
lib/socialmux/auth_mapper/base.rb,
lib/socialmux/auth_mapper/github.rb,
lib/socialmux/auth_mapper/twitter.rb,
lib/socialmux/auth_mapper/facebook.rb,
lib/socialmux/auth_mapper/linkedin.rb,
lib/socialmux/auth_mapper/guess_name.rb,
lib/socialmux/auth_mapper/google_oauth2.rb

Defined Under Namespace

Classes: Base, Facebook, Github, GoogleOauth2, GuessName, Linkedin, NotFound, Twitter

Class Method Summary collapse

Class Method Details

.init_with_data(data) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/socialmux/auth_mapper.rb', line 16

def self.init_with_data(data)
  data = Hashie::Mash.new(data)

  klass_name = "Socialmux::AuthMapper::#{data.provider.classify}"
  klass = klass_name.constantize
  klass.new(data)

rescue NameError
  raise NotFound, "Mapper for provider #{data.provider} not found!"
end