Sha256: bbdfdbd7c5cd6330e28169c2113651e00d2fd2c84a911241f44701d222c96c67

Contents?: true

Size: 464 Bytes

Versions: 6

Compression:

Stored size: 464 Bytes

Contents

module Popularity
  class Rubygems < Crawler
    def downloads
      response_json["downloads"]
    end

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

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

6 entries across 4 versions & 1 rubygems

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