Class: Popularity::Github

Inherits:
Crawler
  • Object
show all
Defined in:
lib/popularity/networks/github.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

Constructor Details

This class inherits a constructor from Popularity::Crawler

Instance Method Details

#as_json(options = {}) ⇒ Object



7
8
9
# File 'lib/popularity/networks/github.rb', line 7

def as_json(options = {})      
  { "stars" => stars }
end

#starsObject



3
4
5
# File 'lib/popularity/networks/github.rb', line 3

def stars
  response_json.size
end

#totalObject



11
12
13
# File 'lib/popularity/networks/github.rb', line 11

def total
  response_json.size
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/popularity/networks/github.rb', line 15

def valid?
  host == 'github.com'
end