lib/social_profile/person.rb in social_profile-0.3.1 vs lib/social_profile/person.rb in social_profile-0.3.2

- old
+ new

@@ -1,11 +1,11 @@ require "social_profile/version" module SocialProfile class Person attr_reader :uid, :access_token, :options - + def initialize(uid, access_token, options = {}) @uid = uid @access_token = access_token @options = options end @@ -16,39 +16,41 @@ klass = case provider.to_s when "facebook" then People::Facebook when "vkontakte" then People::Vkontakte when "twitter" then People::Twitter when "instagram" then People::Instagram + when "instagram_parser" then People::InstagramParser + when "google" then People::Google else Person end - + klass.new(uid, access_token, options) end - + # Find album by id def fetch_album(album_id) raise NotImplementedError("Subclasses should implement this!") end - + # Create new album id def album!(options = {}) raise NotImplementedError("Subclasses should implement this!") end def find_album(album_id) return if album_id.nil? begin - fetch_album(album_id) + fetch_album(album_id) rescue Exception => e return nil end end def find_or_create_album(album_id, options = {}) record = find_album(album_id) - record ||= album!(options) + record ||= album!(options) record end def share_photo!(album_id, filepath, options = {}) album = find_or_create_album(album_id, options[:album]) @@ -76,6 +78,6 @@ # Get followers count def followers_count(options = {}) nil end end -end \ No newline at end of file +end