Sha256: 8bfa2b81fb428740bab91077f3bb196ce21d4c4c51b4f1699eeb9e3d019d8735

Contents?: true

Size: 467 Bytes

Versions: 3

Compression:

Stored size: 467 Bytes

Contents

module Popularity
  class Github < Crawler
    def stars
      response_json.size
    end

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

    def total
      response_json.size
    end

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

    protected

    def request_url
      parts = @url.split("/").last(2)
      repo = parts.last
      owner = parts.first
      "https://api.github.com/repos/#{owner}/#{repo}/stargazers"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
popularity-0.1.1 lib/popularity/networks/github.rb
popularity-0.1.0 lib/popularity/networks/github.rb
popularity-0.0.1 lib/popularity/github.rb