Sha256: f021002e1875697dfd87689c39fdd5070cc530d7fbad092ff14b87c98fa6ee76

Contents?: true

Size: 366 Bytes

Versions: 2

Compression:

Stored size: 366 Bytes

Contents

module Popularity
  class Rubygems < Crawler
    stats :downloads

    def downloads
      response_json["downloads"]
    end

    def valid?
      host == 'rubygems.org' && @url =~ /\/gems\//
    end

    protected

    def gem_name
      @url.split("/").last
    end

    def request_url
      "https://rubygems.org/api/v1/gems/#{gem_name}.json"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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