Class: RubyGemsService

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycat/service/rubygems.rb

Instance Method Summary collapse

Constructor Details

#initializeRubyGemsService

Returns a new instance of RubyGemsService.



9
10
11
12
# File 'lib/rubycat/service/rubygems.rb', line 9

def initialize
  @worker   = Fetcher::Worker.new
  @api_base = 'http://rubygems.org/api/v1'
end

Instance Method Details

#info(name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# 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