Sha256: 952f79758b2f771a41ed25cf2b0311030dff166118ddceae444220bb203ca011

Contents?: true

Size: 366 Bytes

Versions: 2

Compression:

Stored size: 366 Bytes

Contents

module Popularity
  class Github < Crawler
    stats :stars

    def stars
      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

2 entries across 2 versions & 1 rubygems

Version Path
popularity-0.3.0 lib/popularity/networks/github.rb
popularity-0.2.1 lib/popularity/networks/github.rb