Module: SupermarketApi::Client::Cookbooks

Included in:
SupermarketApi::Client
Defined in:
lib/supermarketapi/client/cookbook.rb

Overview

Methods for the Cookbook API.

Instance Method Summary collapse

Instance Method Details

#cookbook(cookbook_name) ⇒ Hashie::Mash

Show all information about a cookbook

This method returns all available information for the given cookbook

Examples:

client.cookbook('apache2')

Returns:

  • (Hashie::Mash)

    The properties of the cookbook.



17
18
19
# File 'lib/supermarketapi/client/cookbook.rb', line 17

def cookbook(cookbook_name)
  get "/cookbooks/#{cookbook_name}"
end

#cookbook_version(cookbook_name, cookbook_version) ⇒ Hashie::Mash

Show informatiom about a cookbook version

This method returns all available information for the given cookbook version

Examples:

client.cookbook('apache2', 'latest')

Returns:

  • (Hashie::Mash)

    The properties of the cookbook.



29
30
31
# File 'lib/supermarketapi/client/cookbook.rb', line 29

def cookbook_version(cookbook_name, cookbook_version)
  get "/cookbooks/#{cookbook_name}/versions/#{cookbook_version}"
end

#cookbooks(user = nil, start = 0, items = 50, order = :most_followed) ⇒ Hashie::Mash

Show information about all cookbook

This method returns high level information for a number of cookbooks

Examples:

client.cookbooks(user='sous-chefs', start=0, items=100, order=:most_followed)

Returns:

  • (Hashie::Mash)

    The properties of the cookbook.



41
42
43
44
45
46
47
48
49
# File 'lib/supermarketapi/client/cookbook.rb', line 41

def cookbooks(user=nil, start=0, items=50, order=:most_followed)
  options = {
    :start => start,
    :items => items,
    :order => order,
  }
  options[:user] = user if user
  get "/cookbooks", options
end