class Berkshelf::APIClient::ChefServerConnection

Public Class Methods

new(**args) click to toggle source
# File lib/berkshelf/api_client/chef_server_connection.rb, line 8
def initialize(**args)
  @client = Berkshelf::RidleyCompat.new(**args)
  @url = args[:server_url]
end

Public Instance Methods

universe() click to toggle source
# File lib/berkshelf/api_client/chef_server_connection.rb, line 13
def universe
  response = @client.get("universe")

  [].tap do |cookbooks|
    response.each do |name, versions|
      versions.each do |version, attributes|
        attributes[:location_path] = @url
        cookbooks << RemoteCookbook.new(name, version, attributes)
      end
    end
  end
rescue Ridley::Errors::HTTPNotFound
  raise ServiceNotFound, "service not found at: #{@url}"
end