This gem is a simple and easy-to-use wrapper for Chef's Supermarket API.
Add this line to your application's Gemfile:
gem 'supermarketapi'
And then execute:
bundle install
Or install it yourself as:
gem install supermarketapi
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()
This method will return all metadata about the given cookbook in an hashie.mash
client.cookbook('apache2')
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')
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,
)
This method will return all metadata about the given tool in an hashie.mash
client.tool('berkshelf')
This method will allow you to search for tools
client.tools(
:query => 'berks',
:start => 1,
:items => 50,
)
This method will return all metadata about the given user in an hashie.mash
client.user('sous-chefs')
- 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