Using the Gems gem to query the RubyGems.org API

require 'gems'

# Return some basic information about rails.
Gems.info 'rails'

# Return an array of active gems that match the query.
Gems.search 'cucumber'

# Return all gems that you own.
Gems.gems 

# Return all gems owned by Erik Michaels-Ober.
Gems.gems("sferik")


# Return an array of version details for coulda.
Gems.versions 'coulda'

# Return an hash of latest version for coulda.
Gems.latest_version 'coulda'

# Return the total number of downloads for rails_admin 0.0.1.
# (Defaults to the latest version if no version is specified.)
Gems.total_downloads 'rails_admin', '0.0.1'

# Returns an array containing the top 50 downloaded gem versions of all time.
Gems.most_downloaded

# Return the total number of downloads by day for rails_admin 0.0.1.
# (Defaults to the latest version if no version is specified.)
Gems.downloads 'rails_admin', '0.0.1'

# Return the number of downloads by day for coulda 0.6.3 for the past 90 days.
# (Defaults to the latest version if no version is specified.)
Gems.downloads 'coulda', '0.6.3'

# Return the number of downloads by day for coulda 0.6.3 for the past year.
Gems.downloads 'coulda', '0.6.3', Date.today - 365, Date.today

# View all owners of a gem that you own.
Gems.owners 'gemcutter'

# Return all the webhooks registered under your account.
Gems.web_hooks

# Returns the 50 gems most recently added to RubyGems.org
Gems.latest

# Returns the 50 most recently updated gems
Gems.just_updated

# Return an array of gem dependency details for all versions of all the given gems.
Gems.dependencies ['rails', 'thor']

# Returns the reverse dependencies
Gems.reverse_dependencies 'dynarex'

# The following methods require authentication.
# By default, we load your API key from ~/.gem/credentials
# You can override this default by specifying a custom API key.
Gems.configure do |config|
  config.key = '1ff8dc6f713833d1w497t76a85d14280'
end


## Resources