Module: Exoteric::Twitter

Defined in:
lib/exoteric/counters/twitter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.idObject



3
4
5
# File 'lib/exoteric/counters/twitter.rb', line 3

def self.id
  :twitter
end

Instance Method Details

#twitter_countObject



11
12
13
14
15
16
# File 'lib/exoteric/counters/twitter.rb', line 11

def twitter_count
  res = RestClient.get(twitter_url)
  JSON.parse(res.to_str)['count'].to_i
rescue
  0
end

#twitter_urlObject



7
8
9
# File 'lib/exoteric/counters/twitter.rb', line 7

def twitter_url
  "http://urls.api.twitter.com/1/urls/count.json?url=#{url}"
end