Module: Liker
- Defined in:
- lib/liker.rb,
lib/liker/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.likes_count(*options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/liker.rb', line 6 def self.likes_count(*) url = [0] raise ArgumentError, "Specify the url as the first argument" unless url source = [1][:source] rescue nil if source Liker.send("#{source}_likes_count", url) else result = { :facebook => self.facebook_likes_count(url), :vk => self.vk_likes_count(url), :twitter => self.twitter_likes_count(url) } result[:total] = result.values.inject{|sum,value| sum + value} result end end |