class RubyGemsService

add to RubyCat module/namespace - why?? why not??

Public Class Methods

new() click to toggle source
# File lib/rubycat/service/rubygems.rb, line 9
def initialize
  @worker   = Fetcher::Worker.new
  @api_base = 'http://rubygems.org/api/v1'
end

Public Instance Methods

info( name ) click to toggle source
# File lib/rubycat/service/rubygems.rb, line 14
def info( name )
  api_url = "#{@api_base}/gems/#{name}.json"

  ### fix/todo: add read_json! -- !!!! to fetcher
  txt = @worker.read_utf8!( api_url )
  pp txt

  json = JSON.parse( txt )
  ## pp json
  json   ## return parsed json hash (or raise HTTP excep)
end