lib/twitter_friendly/utils.rb in twitter_friendly-0.2.1 vs lib/twitter_friendly/utils.rb in twitter_friendly-0.3.0
- old
+ new
@@ -1,6 +1,19 @@
module TwitterFriendly
- class Utils
- class << self
+ module Utils
+ def uid_or_screen_name?(object)
+ raise NotImplementedError.new("You must implement ##{__method__}.")
+ object.kind_of?(String) || object.kind_of?(Integer)
+ end
+
+ def authenticating_user?(target)
+ raise NotImplementedError.new("You must implement ##{__method__}.")
+ user.id.to_i == user(target).id.to_i
+ end
+
+ def authorized_user?(target)
+ raise NotImplementedError.new("You must implement ##{__method__}.")
+ target_user = user(target)
+ !target_user.protected? || friendship?(user.id.to_i, target_user.id.to_i)
end
end
end
\ No newline at end of file