class RubyGems
Public Class Methods
new(gem_name)
click to toggle source
# File lib/ruby_gems.rb, line 6 def initialize(gem_name) @response = Faraday.get "https://rubygems.org/api/v1/gems/#{gem_name}.json" @body = JSON.parse(@response.body) end
Public Instance Methods
dependencies()
click to toggle source
# File lib/ruby_gems.rb, line 46 def dependencies Hash[@body["dependencies"].map{|(k,v)| [k.to_sym,[Hash[v.first.map{|(k,v)| [k.to_sym,v]}]]]}] end
description()
click to toggle source
# File lib/ruby_gems.rb, line 42 def description @body["info"] end
downloads()
click to toggle source
# File lib/ruby_gems.rb, line 15 def downloads @body["downloads"] end
licenses()
click to toggle source
# File lib/ruby_gems.rb, line 50 def licenses @body["licenses"] end
name()
click to toggle source
# File lib/ruby_gems.rb, line 58 def name @body["name"] end
platform()
click to toggle source
# File lib/ruby_gems.rb, line 62 def platform @body["platform"] end
status()
click to toggle source
# File lib/ruby_gems.rb, line 11 def status @response.status end
urls()
click to toggle source
# File lib/ruby_gems.rb, line 27 def urls url_hash = {} url_hash[:bug_tracker_uri] = @body["bug_tracker_uri"] if @body["bug_tracker_uri"] url_hash[:documentation_uri] = @body["documentation_uri"] if @body["documentation_uri"] url_hash[:gem_uri] = @body["gem_uri"] if @body["gem_uri"] url_hash[:homepage_uri] = @body["homepage_uri"] if @body["homepage_uri"] url_hash[:mailing_list_uri] = @body["mailing_list_uri"] if @body["mailing_list_uri"] url_hash[:project_uri] = @body["project_uri"] if @body["project_uri"] url_hash[:source_code_uri] = @body["source_code_uri"] if @body["source_code_uri"] url_hash[:wiki_uri] = @body["wiki_uri"] if @body["wiki_uri"] url_hash end
version()
click to toggle source
# File lib/ruby_gems.rb, line 19 def version @body["version"] end
version_downloads()
click to toggle source
# File lib/ruby_gems.rb, line 23 def version_downloads @body["version_downloads"] end