module Socialmux::AuthMapper

Public Class Methods

init_with_data(data) click to toggle source
# File lib/socialmux/auth_mapper.rb, line 17
def self.init_with_data(data)
  data = Hashie::Mash.new(data)
  klass_name = "Socialmux::AuthMapper::#{data.provider.to_s.classify}"
  klass = klass_name.constantize
  klass.new(data)

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