Class: TheCount::Google::Buzz
- Defined in:
- lib/thecount/countable/google.rb
Instance Attribute Summary
Attributes inherited from Countable
Instance Method Summary collapse
- #count(data) ⇒ Object
-
#initialize ⇒ Buzz
constructor
A new instance of Buzz.
Constructor Details
#initialize ⇒ Buzz
Returns a new instance of Buzz.
10 11 12 13 14 |
# File 'lib/thecount/countable/google.rb', line 10 def initialize @service_name = "google" @unit = "buzz" @value = 0 end |
Instance Method Details
#count(data) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/thecount/countable/google.rb', line 15 def count(data) url = "http://www.google.com/buzz/api/buzzThis/buzzCounter?url=" url = "#{url}#{CGI::escape(data[:url])}" begin @value = JSON.parse(open(url).string.split('(')[1].split(')')[0])[data[:url]].to_i rescue Exception => e @value = 0 end end |