Sha256: 720ac8baedf912d84fe67521a6456641f07270afe41f1c20dcfb3f3460888727

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require "social_profile/version"

module SocialProfile
  autoload :Utils, "social_profile/utils"
  autoload :Response, "social_profile/response"
  autoload :Person, "social_profile/person"

  module Providers
    autoload :Base, "social_profile/providers/base"
    autoload :Facebook, "social_profile/providers/facebook"
    autoload :Vkontakte, "social_profile/providers/vkontakte"
    autoload :Twitter, "social_profile/providers/twitter"
    autoload :Instagram, "social_profile/providers/instagram"
    autoload :Odnoklassniki, "social_profile/providers/odnoklassniki"
  end

  module People
    autoload :Facebook, "social_profile/people/facebook"
    autoload :Vkontakte, "social_profile/people/vkontakte"
    autoload :Twitter, "social_profile/people/twitter"
  end
    
  def self.get(auth_hash, options = {})
    provider = auth_hash["provider"].to_s.downcase if auth_hash && auth_hash["provider"]
    
    klass = case provider
      when "facebook" then Providers::Facebook
      when "vkontakte" then Providers::Vkontakte
      when "twitter" then Providers::Twitter
      when "instagram" then Providers::Instagram
      when "odnoklassniki" then Providers::Odnoklassniki
      else Providers::Base
    end
    
    klass.new(auth_hash, options)
  end

  def self.root_path
    @root_path ||= Pathname.new(File.dirname(File.expand_path('../', __FILE__)))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
social_profile-0.2.2 lib/social_profile.rb