Sha256: 8b16a50915ef133ee027ed5273fff7942c54faaae31a6637f54a94ce282f8ed1

Contents?: true

Size: 656 Bytes

Versions: 8

Compression:

Stored size: 656 Bytes

Contents

module ChefAPI
  #
  # In the real world, a "cookbook" is a single entity with multiple versions.
  # In Chef land, a "cookbook" is actually just a wrapper around a collection
  # of +cookbook_version+ objects that fully detail the layout of a cookbook.
  #
  class Resource::Cookbook < Resource::Base
    collection_path "/cookbooks"

    schema do
      attribute :name, type: String, primary: true, required: true
    end

    has_many :versions,
      class_name: CookbookVersion,
      rest_endpoint: "/?num_versions=all"

    class << self
      def from_json(response, prefix = {})
        new(name: response.keys.first)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
chef-infra-api-0.10.10 lib/chef-api/resources/cookbook.rb
chef-api-0.10.10 lib/chef-api/resources/cookbook.rb
chef-infra-api-0.10.7 lib/chef-api/resources/cookbook.rb
chef-api-0.10.7 lib/chef-api/resources/cookbook.rb
chef-infra-api-0.10.5 lib/chef-api/resources/cookbook.rb
chef-api-0.10.5 lib/chef-api/resources/cookbook.rb
chef-infra-api-0.10.2 lib/chef-api/resources/cookbook.rb
chef-api-0.10.2 lib/chef-api/resources/cookbook.rb