Class: Ray::RubyGems
- Inherits:
-
Object
- Object
- Ray::RubyGems
- Includes:
- Search
- Defined in:
- lib/ray/search/rubygems.rb
Instance Attribute Summary (collapse)
-
- (Object) query
readonly
Returns the value of attribute query.
-
- (Object) results
Returns the value of attribute results.
-
- (Object) uri
readonly
Returns the value of attribute uri.
Instance Method Summary (collapse)
-
- (RubyGems) initialize(query)
constructor
A new instance of RubyGems.
- - (Object) normalize(response)
Methods included from Search
#cache, #merge, #multiple_choice, #output, #search
Constructor Details
- (RubyGems) initialize(query)
A new instance of RubyGems
12 13 14 15 16 |
# File 'lib/ray/search/rubygems.rb', line 12 def initialize query @query = query @uri = "#{Ray::RUBYGEMS_V1_API}/search.json?query=radiant-#{@query}" @results = search end |
Instance Attribute Details
- (Object) query (readonly)
Returns the value of attribute query
9 10 11 |
# File 'lib/ray/search/rubygems.rb', line 9 def query @query end |
- (Object) results
Returns the value of attribute results
10 11 12 |
# File 'lib/ray/search/rubygems.rb', line 10 def results @results end |
- (Object) uri (readonly)
Returns the value of attribute uri
9 10 11 |
# File 'lib/ray/search/rubygems.rb', line 9 def uri @uri end |
Instance Method Details
- (Object) normalize(response)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ray/search/rubygems.rb', line 18 def normalize response response = MultiJson.decode response results = {} response.each do |extension| results[extension["name"].to_extension_name] = { :author => extension["authors"], :description => extension["info"], :homepage => extension["homepage_uri"], :name => extension["name"].to_extension_name, :uri => extension["gem_uri"], :version => extension["version"] } end return results end |