Class: Popularity::GooglePlus
- Inherits:
-
Crawler
- Object
- Crawler
- Popularity::GooglePlus
show all
- Defined in:
- lib/popularity/networks/google_plus.rb
Instance Attribute Summary
Attributes inherited from Crawler
#url
Instance Method Summary
collapse
Methods inherited from Crawler
#async_done?, #fetch, #fetch_async, #has_response?, #host, #initialize, #name, #response, #response_json, #to_json, #valid?
Instance Method Details
#as_json(options = {}) ⇒ Object
8
9
10
|
# File 'lib/popularity/networks/google_plus.rb', line 8
def as_json(options = {})
{"plus_ones" => plus_ones}
end
|
#plus_ones ⇒ Object
3
4
5
6
|
# File 'lib/popularity/networks/google_plus.rb', line 3
def plus_ones
matches = response.scan(/window.__SSR = {c\: (\d+.\d+E?\d+)/)
matches.flatten.first.to_f.to_i
end
|
#total ⇒ Object
12
13
14
|
# File 'lib/popularity/networks/google_plus.rb', line 12
def total
plus_ones
end
|