Sha256: 4471f435d623b5a162fe54e7cd90ced7b2990b4be5bb8f0dd1ec168691dc0c68

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 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"
  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
      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

2 entries across 2 versions & 1 rubygems

Version Path
social_profile-0.2.1 lib/social_profile.rb
social_profile-0.2.0 lib/social_profile.rb