Class: Gems::Client
- Inherits:
-
Object
- Object
- Gems::Client
- Includes:
- Connection, Request
- Defined in:
- lib/gems/client.rb
Instance Method Summary collapse
-
#dependencies(*gems) ⇒ Array
Returns an array of hashes for all versions of given gems.
-
#downloads(gem, version, options = {}) ⇒ Hashie::Mash
Returns the number of downloads by day for a particular gem version.
-
#info(gem, options = {}) ⇒ Hashie::Mash
Returns some basic information about the given gem.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#search(query, options = {}) ⇒ Array<Hashie::Mash>
Returns an array of active gems that match the query.
-
#versions(gem, options = {}) ⇒ Hashie::Mash
Returns an array of gem version details.
Methods included from Request
Methods included from Connection
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/gems/client.rb', line 11 def initialize(={}) = Gems..merge() Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#dependencies(*gems) ⇒ Array
Returns an array of hashes for all versions of given gems
71 72 73 |
# File 'lib/gems/client.rb', line 71 def dependencies(*gems) get("/api/v1/dependencies", {:gems => gems.join(',')}, :marshal) end |
#downloads(gem, version, options = {}) ⇒ Hashie::Mash
Returns the number of downloads by day for a particular gem version
61 62 63 |
# File 'lib/gems/client.rb', line 61 def downloads(gem, version, ={}) get("/api/v1/versions/#{gem}-#{version}/downloads", , :json) end |
#info(gem, options = {}) ⇒ Hashie::Mash
Returns some basic information about the given gem
25 26 27 28 |
# File 'lib/gems/client.rb', line 25 def info(gem, ={}) response = get("/api/v1/gems/#{gem}", ) format.to_s.downcase == 'xml' ? response['rubygem'] : response end |
#search(query, options = {}) ⇒ Array<Hashie::Mash>
Returns an array of active gems that match the query
37 38 39 40 |
# File 'lib/gems/client.rb', line 37 def search(query, ={}) response = get("/api/v1/search", .merge(:query => query)) format.to_s.downcase == 'xml' ? response['rubygems'] : response end |
#versions(gem, options = {}) ⇒ Hashie::Mash
Returns an array of gem version details
49 50 51 |
# File 'lib/gems/client.rb', line 49 def versions(gem, ={}) get("/api/v1/versions/#{gem}", , :json) end |