Supermarket API
This gem is a simple and easy-to-use wrapper for Chef's Supermarket API.
Installation
Add this line to your application's Gemfile:
gem 'supermarketapi'
And then execute:
bundle install
Or install it yourself as:
gem install supermarketapi
Usage
To use the API methods, you'll need to instantiate a new client and use the API methods.
# Create a new client
client = SupermarketApi.client()
Cookbooks
cookbook
This method will return all metadata about the given cookbook in an hashie.mash
client.cookbook('apache2')
cookbook_version
This method retrieves information about the cookbook version and can be used to find the latest version of a cookbook
client.cookbook_version('apache2', 'latest')
client.cookbook_version('apache2', '7.0.0')
cookbooks
This method searches for cookbooks. It takes the following parameters:
name | required | type | default | description |
---|---|---|---|---|
:user |
Optional | String | nil |
this is the name of the user to search |
:start |
Optional | Integer | 0 |
Pagination page to start on |
:items |
Optional | Integer | 50 |
Number of items to return |
:order |
Optional | Symbol | :most_followed |
Search method, available options are: :recently_updated , :recently_added , :most_downloaded , or :most_followed
|
client.cookbooks(
:user => 'sous-chefs',
:start => 1,
:items => 50,
:order => :recently_updated,
)
Tools
tool
This method will return all metadata about the given tool in an hashie.mash
client.tool('berkshelf')
tools
This method will allow you to search for tools
client.tools(
:query => 'berks',
:start => 1,
:items => 50,
)
Users
user
This method will return all metadata about the given user in an hashie.mash
client.user('sous-chefs')
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request