Skip to content

Commit

Permalink
README: Use syntax highlighting for the example
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed May 14, 2020
1 parent 330f853 commit 74d3bf0
Showing 1 changed file with 70 additions and 67 deletions.
137 changes: 70 additions & 67 deletions README.md
Expand Up @@ -19,99 +19,102 @@ Ruby wrapper for the RubyGems.org API.
[https://rdoc.info/gems/gems](https://rdoc.info/gems/gems)

# Usage Examples
require 'rubygems'
require 'gems'

# Return some basic information about rails.
Gems.info 'rails'
```ruby
require 'rubygems'
require 'gems'

# Return an array of active gems that match the query.
Gems.search 'cucumber'
# Return some basic information about rails.
Gems.info 'rails'

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

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

# Submit a gem to RubyGems.org.
Gems.push File.new 'gemcutter-0.2.1.gem'
# Return all gems owned by Erik Michaels-Ober.
Gems.gems("sferik")

# Remove a gem from RubyGems.org's index.
# Defaults to the latest version if no version is specified.
Gems.yank 'bills', '0.0.1'
# Submit a gem to RubyGems.org.
Gems.push File.new 'gemcutter-0.2.1.gem'

# Update a previously yanked gem back into RubyGems.org's index.
# Defaults to the latest version if no version is specified.
Gems.unyank 'bills', '0.0.1'
# Remove a gem from RubyGems.org's index.
# Defaults to the latest version if no version is specified.
Gems.yank 'bills', '0.0.1'

# Return an array of version details for coulda.
Gems.versions 'coulda'
# Update a previously yanked gem back into RubyGems.org's index.
# Defaults to the latest version if no version is specified.
Gems.unyank 'bills', '0.0.1'

# Return an hash of latest version for coulda.
Gems.latest_version 'coulda'
# Return an array of version details for coulda.
Gems.versions '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'
# Return an hash of latest version for coulda.
Gems.latest_version 'coulda'

# Returns an array containing the top 50 downloaded gem versions of all time.
Gems.most_downloaded
# 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'

# 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'
# Returns an array containing the top 50 downloaded gem versions of all time.
Gems.most_downloaded

# 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', Date.today - 90, Date.today
# 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 year.
Gems.downloads 'coulda', '0.6.3', Date.today - 365, Date.today
# 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', Date.today - 90, Date.today

# View all owners of a gem that you own.
Gems.owners 'gemcutter'
# 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

# Add an owner to a RubyGem you own, giving that user permission to manage it.
Gems.add_owner 'josh@technicalpickles.com', 'gemcutter'
# View all owners of a gem that you own.
Gems.owners 'gemcutter'

# Remove a user's permission to manage a RubyGem you own.
Gems.remove_owner 'josh@technicalpickles.com', 'gemcutter'
# Add an owner to a RubyGem you own, giving that user permission to manage it.
Gems.add_owner 'josh@technicalpickles.com', 'gemcutter'

# Return all the webhooks registered under your account.
Gems.web_hooks
# Remove a user's permission to manage a RubyGem you own.
Gems.remove_owner 'josh@technicalpickles.com', 'gemcutter'

# Add a webhook.
Gems.add_web_hook 'rails', 'http://example.com'
# Return all the webhooks registered under your account.
Gems.web_hooks

# Remove a webhook.
Gems.remove_web_hook 'rails', 'http://example.com'
# Add a webhook.
Gems.add_web_hook 'rails', 'http://example.com'

# Test fire a webhook.
Gems.fire_web_hook 'rails', 'http://example.com'
# Remove a webhook.
Gems.remove_web_hook 'rails', 'http://example.com'

# Returns the 50 gems most recently added to RubyGems.org
Gems.latest
# Test fire a webhook.
Gems.fire_web_hook 'rails', 'http://example.com'

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

# Retrieve your API key using HTTP basic authentication.
Gems.configure do |config|
config.username = 'nick@gemcutter.org'
config.password = 'schwwwwing'
end
Gems.api_key
# 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']
# Retrieve your API key using HTTP basic authentication.
Gems.configure do |config|
config.username = 'nick@gemcutter.org'
config.password = 'schwwwwing'
end
Gems.api_key

# 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 = '701243f217cdf23b1370c7b66b65ca97'
end
# Return an array of gem dependency details for all versions of all the given gems.
Gems.dependencies ['rails', 'thor']

# 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 = '701243f217cdf23b1370c7b66b65ca97'
end
```

## Supported Ruby Versions
This library aims to support and is [tested against][travis] the following Ruby
Expand Down

0 comments on commit 74d3bf0

Please sign in to comment.