Class: Popularity::Rubygems
- Inherits:
-
Crawler
- Object
- Crawler
- Popularity::Rubygems
show all
- Defined in:
- lib/popularity/rubygems.rb,
lib/popularity/networks/rubygems.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
Instance Method Details
#as_json(options = {}) ⇒ Object
7
8
9
|
# File 'lib/popularity/rubygems.rb', line 7
def as_json(options = {})
{"downloads" => downloads}
end
|
#downloads ⇒ Object
3
4
5
|
# File 'lib/popularity/rubygems.rb', line 3
def downloads
response_json["downloads"]
end
|
#total ⇒ Object
11
12
13
|
# File 'lib/popularity/rubygems.rb', line 11
def total
downloads
end
|
#valid? ⇒ Boolean
15
16
17
|
# File 'lib/popularity/rubygems.rb', line 15
def valid?
host == 'rubygems.org' && @url =~ /\/gems\//
end
|